horizonzy opened a new issue #2563:
URL: https://github.com/apache/rocketmq/issues/2563
**BUG REPORT**
1. Please describe the issue you observed:
The code as follow:
```
protected void commit0(final int commitLeastPages) {
int writePos = this.wrotePosition.get();
int lastCommittedPosition = this.committedPosition.get();
if (writePos - lastCommittedPosition > commitLeastPages) {
try {
ByteBuffer byteBuffer = writeBuffer.slice();
byteBuffer.position(lastCommittedPosition);
byteBuffer.limit(writePos);
this.fileChannel.position(lastCommittedPosition);
this.fileChannel.write(byteBuffer);
this.committedPosition.set(writePos);
} catch (Throwable e) {
log.error("Error occurred when commit data to FileChannel.",
e);
}
}
}
```
` if (writePos - lastCommittedPosition > commitLeastPages)` should be
`if (writePos - lastCommittedPosition > commitLeastPages * OS_PAGE_SIZE)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]