From d3a8fe0c5b7cff2329dd12974fb82459d033d2db Mon Sep 17 00:00:00 2001 From: guyinyou <36399867+guyinyou@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:26:11 +0800 Subject: [PATCH] [ISSUE #6587] fix getMax() in SparseConsumeQueue Co-authored-by: guyinyou --- .../org/apache/rocketmq/store/queue/SparseConsumeQueue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java b/store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java index 79b745d89cb..5b397d696bc 100644 --- a/store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java +++ b/store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java @@ -330,7 +330,7 @@ private T getMax(MappedFile mappedFile, Function function) { short batchSize = byteBuffer.getShort(); if (offset >= 0 && size > 0 && msgBaseOffset >= 0 && batchSize > 0) { byteBuffer.position(i); //reset position - return function.apply(byteBuffer); + return function.apply(byteBuffer.slice()); } }