diff --git a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java index 9185d21d874dce268c937321c2a19ca2a10790eb..b5bdc7766b118f02b7f6c152b85f509ca03e8644 100644 --- a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java +++ b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java @@ -321,7 +321,7 @@ public class MappedFile extends ReferenceResource { int writePos = this.wrotePosition.get(); int lastCommittedPosition = this.committedPosition.get(); - if (writePos - this.committedPosition.get() > 0) { + if (writePos - lastCommittedPosition > commitLeastPages) { try { ByteBuffer byteBuffer = writeBuffer.slice(); byteBuffer.position(lastCommittedPosition);