From fd7da3502f3184fef1e1c7a5abdefb1af7b097b7 Mon Sep 17 00:00:00 2001 From: spiritsx <30772323+spiritsx@users.noreply.github.com> Date: Mon, 19 Oct 2020 19:57:01 +0800 Subject: [PATCH] [ISSUE #2338] use commitLeastPages parameters and substitute 'lastCommittedPosition' for duplicated 'this.committedPosition.get()' in 'commit0' method (#2338) (#2346) --- store/src/main/java/org/apache/rocketmq/store/MappedFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9185d21d..b5bdc776 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); -- GitLab