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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 12e5ca63cc2 branch-3.0: [Improve](Variant) pick random backend as 
coordinator #45754 (#45770)
12e5ca63cc2 is described below

commit 12e5ca63cc289eb2927a7182c8cc9bd2d3fba156
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Dec 23 14:04:45 2024 +0800

    branch-3.0: [Improve](Variant) pick random backend as coordinator #45754 
(#45770)
    
    Cherry-picked from #45754
    
    Co-authored-by: lihangyu <[email protected]>
---
 .../apache/doris/common/util/FetchRemoteTabletSchemaUtil.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/FetchRemoteTabletSchemaUtil.java
 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/FetchRemoteTabletSchemaUtil.java
index 4a0b9d1ff59..00147207c14 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/FetchRemoteTabletSchemaUtil.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/FetchRemoteTabletSchemaUtil.java
@@ -98,16 +98,19 @@ public class FetchRemoteTabletSchemaUtil {
             if (!backend.isAlive()) {
                 continue;
             }
-            // need 2 be to provide a retry
-            if (coordinatorBackend.size() < 2) {
-                coordinatorBackend.add(backend);
-            }
+            coordinatorBackend.add(backend);
             PTabletsLocation.Builder locationBuilder = 
PTabletsLocation.newBuilder()
                                                         
.setHost(backend.getHost())
                                                         
.setBrpcPort(backend.getBrpcPort());
             PTabletsLocation location = 
locationBuilder.addAllTabletId(tabletIds).build();
             locations.add(location);
         }
+        // pick 2 random coordinator
+        Collections.shuffle(coordinatorBackend);
+        if (!coordinatorBackend.isEmpty()) {
+            coordinatorBackend = coordinatorBackend.subList(0, Math.min(2, 
coordinatorBackend.size()));
+            LOG.debug("pick coordinator backend {}", 
coordinatorBackend.get(0));
+        }
         PFetchRemoteSchemaRequest.Builder requestBuilder = 
PFetchRemoteSchemaRequest.newBuilder()
                                                                     
.addAllTabletLocation(locations)
                                                                     
.setIsCoordinator(true);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to