You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by vo...@apache.org on 2020/10/19 11:57:20 UTC

[rocketmq] branch develop updated: [ISSUE #2338] use commitLeastPages parameters and substitute 'lastCommittedPosition' for duplicated 'this.committedPosition.get()' in 'commit0' method (#2338) (#2346)

This is an automated email from the ASF dual-hosted git repository.

vongosling pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new fd7da35  [ISSUE #2338] use commitLeastPages parameters and substitute 'lastCommittedPosition' for duplicated 'this.committedPosition.get()' in 'commit0' method (#2338) (#2346)
fd7da35 is described below

commit fd7da3502f3184fef1e1c7a5abdefb1af7b097b7
Author: spiritsx <30...@users.noreply.github.com>
AuthorDate: Mon Oct 19 19:57:01 2020 +0800

    [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 9185d21..b5bdc77 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);