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 98308f616d [ISSUE #9182] Fix NameServer will be not ready forever when 
set needWaitForService to true (#9183)
98308f616d is described below

commit 98308f616d4bb9e2216cd80ae44e5a3407b1c9bb
Author: gaoyf <ga...@users.noreply.github.com>
AuthorDate: Mon Feb 17 11:38:51 2025 +0800

    [ISSUE #9182] Fix NameServer will be not ready forever when set 
needWaitForService to true (#9183)
    
    * Fix NameServer will be not ready forever when set needWaitForService to 
true
    
    * Remove unused import
---
 .../rocketmq/namesrv/processor/ClientRequestProcessor.java     | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git 
a/namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java
 
b/namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java
index 17a070c7f0..1ef6beadd3 100644
--- 
a/namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java
+++ 
b/namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java
@@ -21,7 +21,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
 import io.netty.channel.ChannelHandlerContext;
 import java.util.Optional;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.rocketmq.common.MQVersion;
 import org.apache.rocketmq.common.constant.LoggerName;
 import org.apache.rocketmq.common.help.FAQUrl;
@@ -43,8 +42,6 @@ public class ClientRequestProcessor implements 
NettyRequestProcessor {
     protected NamesrvController namesrvController;
     private long startupTimeMillis;
 
-    private AtomicBoolean needCheckNamesrvReady = new AtomicBoolean(true);
-
     public ClientRequestProcessor(final NamesrvController namesrvController) {
         this.namesrvController = namesrvController;
         this.startupTimeMillis = System.currentTimeMillis();
@@ -62,7 +59,7 @@ public class ClientRequestProcessor implements 
NettyRequestProcessor {
         final GetRouteInfoRequestHeader requestHeader =
             (GetRouteInfoRequestHeader) 
request.decodeCommandCustomHeader(GetRouteInfoRequestHeader.class);
 
-        boolean namesrvReady = needCheckNamesrvReady.get() && 
System.currentTimeMillis() - startupTimeMillis >= 
TimeUnit.SECONDS.toMillis(namesrvController.getNamesrvConfig().getWaitSecondsForService());
+        boolean namesrvReady = System.currentTimeMillis() - startupTimeMillis 
>= 
TimeUnit.SECONDS.toMillis(namesrvController.getNamesrvConfig().getWaitSecondsForService());
 
         if (namesrvController.getNamesrvConfig().isNeedWaitForService() && 
!namesrvReady) {
             log.warn("name server not ready. request code {} ", 
request.getCode());
@@ -74,11 +71,6 @@ public class ClientRequestProcessor implements 
NettyRequestProcessor {
         TopicRouteData topicRouteData = 
this.namesrvController.getRouteInfoManager().pickupTopicRouteData(requestHeader.getTopic());
 
         if (topicRouteData != null) {
-            //topic route info register success ,so disable namesrvReady check
-            if (needCheckNamesrvReady.get()) {
-                needCheckNamesrvReady.set(false);
-            }
-
             if 
(this.namesrvController.getNamesrvConfig().isOrderMessageEnable()) {
                 String orderTopicConf =
                     
this.namesrvController.getKvConfigManager().getKVConfig(NamesrvUtil.NAMESPACE_ORDER_TOPIC_CONFIG,

Reply via email to