未验证 提交 589e87c2 编写于 作者: 飞剑客_'s avatar 飞剑客_ 提交者: GitHub

[ISSUE #3099] Fix the incorrect judegment 'writePos - lastCommittedPosition >...

[ISSUE #3099] Fix the incorrect judegment  'writePos - lastCommittedPosition > commitLeastPages' in the method 'commit0' of class 'MappedFile' (#3125)
上级 2fc1148b
...@@ -301,7 +301,7 @@ public class MappedFile extends ReferenceResource { ...@@ -301,7 +301,7 @@ public class MappedFile extends ReferenceResource {
} }
if (this.isAbleToCommit(commitLeastPages)) { if (this.isAbleToCommit(commitLeastPages)) {
if (this.hold()) { if (this.hold()) {
commit0(commitLeastPages); commit0();
this.release(); this.release();
} else { } else {
log.warn("in commit, hold failed, commit offset = " + this.committedPosition.get()); log.warn("in commit, hold failed, commit offset = " + this.committedPosition.get());
...@@ -317,11 +317,11 @@ public class MappedFile extends ReferenceResource { ...@@ -317,11 +317,11 @@ public class MappedFile extends ReferenceResource {
return this.committedPosition.get(); return this.committedPosition.get();
} }
protected void commit0(final int commitLeastPages) { protected void commit0() {
int writePos = this.wrotePosition.get(); int writePos = this.wrotePosition.get();
int lastCommittedPosition = this.committedPosition.get(); int lastCommittedPosition = this.committedPosition.get();
if (writePos - lastCommittedPosition > commitLeastPages) { if (writePos - lastCommittedPosition > 0) {
try { try {
ByteBuffer byteBuffer = writeBuffer.slice(); ByteBuffer byteBuffer = writeBuffer.slice();
byteBuffer.position(lastCommittedPosition); byteBuffer.position(lastCommittedPosition);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册