Skip to content

Commit 236ede2

Browse files
guyinyouguyinyou
andauthored
Fix: avoid extra padding when message end position is already page-aligned (#10036)
Change-Id: I3e7fad9c4b194b20015414bcceb830760df68fea Co-authored-by: guyinyou <guyinyou.gyy@alibaba-inc.com>
1 parent 4aa6cdd commit 236ede2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ public AppendMessageResult appendMessagesInner(final MessageExt messageExt, fina
389389
int endpos = currentPos + msgLen;
390390
// alignment end position
391391
int extraAppendSize = UNSAFE_PAGE_SIZE - endpos % UNSAFE_PAGE_SIZE;
392+
if (extraAppendSize == UNSAFE_PAGE_SIZE) {
393+
extraAppendSize = 0;
394+
}
392395
int actualAppendSize = msgLen + extraAppendSize;
393396

394397
this.fileChannel.position(currentPos);

0 commit comments

Comments
 (0)