This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 3006eea5cc4 branch-2.1: [Improve](Variant) pick random backend as
coordinator #45754 (#45771)
3006eea5cc4 is described below
commit 3006eea5cc4ebec0b30b75f3ee9f52b027f1518c
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Dec 23 14:02:18 2024 +0800
branch-2.1: [Improve](Variant) pick random backend as coordinator #45754
(#45771)
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 0e96dc8c593..de378c8b8e8 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]