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

jinrongtong 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 236ede218a Fix: avoid extra padding when message end position is 
already page-aligned (#10036)
236ede218a is described below

commit 236ede218abd57d1887adaa09a3d45da2dd4a046
Author: guyinyou <[email protected]>
AuthorDate: Wed Jan 21 17:19:34 2026 +0800

    Fix: avoid extra padding when message end position is already page-aligned 
(#10036)
    
    Change-Id: I3e7fad9c4b194b20015414bcceb830760df68fea
    
    Co-authored-by: guyinyou <[email protected]>
---
 .../main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java 
b/store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java
index 7c4e5e025a..7a7b5f8436 100644
--- 
a/store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java
+++ 
b/store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java
@@ -389,6 +389,9 @@ public class DefaultMappedFile extends AbstractMappedFile {
                         int endpos = currentPos + msgLen;
                         // alignment end position
                         int extraAppendSize = UNSAFE_PAGE_SIZE - endpos % 
UNSAFE_PAGE_SIZE;
+                        if (extraAppendSize == UNSAFE_PAGE_SIZE) {
+                            extraAppendSize = 0;
+                        }
                         int actualAppendSize = msgLen + extraAppendSize;
 
                         this.fileChannel.position(currentPos);

Reply via email to