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()); } }