This is an automated email from the ASF dual-hosted git repository.
zhoubo 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 589e87c [ISSUE #3099] Fix the incorrect judegment 'writePos -
lastCommittedPosition > commitLeastPages' in the method 'commit0' of class
'MappedFile' (#3125)
589e87c is described below
commit 589e87c278147ee17cbcaac334d8558a8ef98ea2
Author: xiaoyaofawai <[email protected]>
AuthorDate: Fri Jul 9 13:40:02 2021 +0800
[ISSUE #3099] Fix the incorrect judegment 'writePos -
lastCommittedPosition > commitLeastPages' in the method 'commit0' of class
'MappedFile' (#3125)
---
store/src/main/java/org/apache/rocketmq/store/MappedFile.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 b5bdc77..25f0e39 100644
--- a/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
+++ b/store/src/main/java/org/apache/rocketmq/store/MappedFile.java
@@ -301,7 +301,7 @@ public class MappedFile extends ReferenceResource {
}
if (this.isAbleToCommit(commitLeastPages)) {
if (this.hold()) {
- commit0(commitLeastPages);
+ commit0();
this.release();
} else {
log.warn("in commit, hold failed, commit offset = " +
this.committedPosition.get());
@@ -317,11 +317,11 @@ public class MappedFile extends ReferenceResource {
return this.committedPosition.get();
}
- protected void commit0(final int commitLeastPages) {
+ protected void commit0() {
int writePos = this.wrotePosition.get();
int lastCommittedPosition = this.committedPosition.get();
- if (writePos - lastCommittedPosition > commitLeastPages) {
+ if (writePos - lastCommittedPosition > 0) {
try {
ByteBuffer byteBuffer = writeBuffer.slice();
byteBuffer.position(lastCommittedPosition);