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 09beca60eb [ISSUE #8549] Ipv6 enabled in broker, pickupStoreTimestamp 
size should be 20 (#8567)
09beca60eb is described below

commit 09beca60eb5f2bd75fd0b092a1a3b0f583d010c5
Author: Lei Zhiyuan <leizhiy...@gmail.com>
AuthorDate: Wed Aug 21 13:44:26 2024 +0800

    [ISSUE #8549] Ipv6 enabled in broker, pickupStoreTimestamp size should be 
20 (#8567)
    
    * fix: when ipv6 enabled in broker, pickupStoreTimestamp size should be 
12(20-8)
    
    * fix: when ipv6 enabled in broker, pickupStoreTimestamp size should be 20
---
 .../main/java/org/apache/rocketmq/store/DefaultMessageStore.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java 
b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
index a901e850ed..f159c31a7b 100644
--- a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
+++ b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
@@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Supplier;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.validator.routines.InetAddressValidator;
 import org.apache.rocketmq.common.AbstractBrokerRunnable;
 import org.apache.rocketmq.common.BoundaryType;
 import org.apache.rocketmq.common.BrokerConfig;
@@ -1178,7 +1179,11 @@ public class DefaultMessageStore implements MessageStore 
{
         if (this.getCommitLog() instanceof DLedgerCommitLog) {
             minPhyOffset += DLedgerEntry.BODY_OFFSET;
         }
-        final int size = MessageDecoder.MESSAGE_STORE_TIMESTAMP_POSITION + 8;
+        int size = MessageDecoder.MESSAGE_STORE_TIMESTAMP_POSITION + 8;
+        InetAddressValidator validator = InetAddressValidator.getInstance();
+        if (validator.isValidInet6Address(this.brokerConfig.getBrokerIP1())) {
+            size = MessageDecoder.MESSAGE_STORE_TIMESTAMP_POSITION + 20;
+        }
         return this.getCommitLog().pickupStoreTimestamp(minPhyOffset, size);
     }
 

Reply via email to