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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f57dc9298a9 [Fix]Fix publish may wait timeout because of dead BE 
(#40763)
f57dc9298a9 is described below

commit f57dc9298a94c6fc3504c2a78e974843a9dc7b50
Author: wangbo <wan...@apache.org>
AuthorDate: Mon Sep 23 14:40:12 2024 +0800

    [Fix]Fix publish may wait timeout because of dead BE (#40763)
    
    ## Proposed changes
    ```AckResponseHandler``` should only accept alive BE, otherwise pubslih may 
wait timeout if dead Be exists.
---
 .../doris/common/publish/TopicPublisherThread.java      | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/publish/TopicPublisherThread.java
 
b/fe/fe-core/src/main/java/org/apache/doris/common/publish/TopicPublisherThread.java
index 797b0893936..df3b06e8271 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/publish/TopicPublisherThread.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/publish/TopicPublisherThread.java
@@ -35,7 +35,6 @@ import org.apache.logging.log4j.Logger;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -76,18 +75,24 @@ public class TopicPublisherThread extends MasterDaemon {
         // because it may means workload group/policy is dropped
 
         // step 2: publish topic info to all be
-        Collection<Backend> nodesToPublish;
+        List<Backend> nodesToPublish = new ArrayList<>();
         try {
-            nodesToPublish = 
clusterInfoService.getAllBackendsByAllCluster().values();
+            for (Backend be : 
clusterInfoService.getAllBackendsByAllCluster().values()) {
+                if (be.isAlive()) {
+                    nodesToPublish.add(be);
+                }
+            }
         } catch (Exception e) {
             LOG.warn("get backends failed", e);
             return;
         }
+        if (nodesToPublish.isEmpty()) {
+            LOG.info("no alive backend, skip publish topic");
+            return;
+        }
         AckResponseHandler handler = new AckResponseHandler(nodesToPublish);
         for (Backend be : nodesToPublish) {
-            if (be.isAlive()) {
-                executor.submit(new TopicPublishWorker(request, be, handler));
-            }
+            executor.submit(new TopicPublishWorker(request, be, handler));
         }
         try {
             int timeoutMs = Config.publish_topic_info_interval_ms / 3 * 2;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to