This is an automated email from the ASF dual-hosted git repository.
wyf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 53d00d9 [Doris On ES][Bug-Fix] ES queries always route at same 3 BE
nodes (#4351) (#4352)
53d00d9 is described below
commit 53d00d92cc29d2403e8a18d496c763957545f677
Author: caoyang10 <[email protected]>
AuthorDate: Tue Aug 18 10:36:18 2020 +0800
[Doris On ES][Bug-Fix] ES queries always route at same 3 BE nodes (#4351)
(#4352)
resolve the problem of querying ES table always route at same 3 BE nodes
because of random strategy
---
fe/fe-core/src/main/java/org/apache/doris/planner/EsScanNode.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/EsScanNode.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/EsScanNode.java
index 36984bf..7db0e00 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/EsScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/EsScanNode.java
@@ -204,13 +204,14 @@ public class EsScanNode extends ScanNode {
String.join(",", unPartitionedIndices),
String.join(",", partitionedIndices));
}
- int beIndex = random.nextInt(backendList.size());
+ int size = backendList.size();
+ int beIndex = random.nextInt(size);
List<TScanRangeLocations> result = Lists.newArrayList();
for (EsShardPartitions indexState : selectedIndex) {
for (List<EsShardRouting> shardRouting :
indexState.getShardRoutings().values()) {
// get backends
Set<Backend> colocatedBes = Sets.newHashSet();
- int numBe = Math.min(3, backendMap.size());
+ int numBe = Math.min(3, size);
List<TNetworkAddress> shardAllocations = new ArrayList<>();
for (EsShardRouting item : shardRouting) {
shardAllocations.add(EsTable.TRANSPORT_HTTP.equals(table.getTransport()) ?
item.getHttpAddress() : item.getAddress());
@@ -224,7 +225,7 @@ public class EsScanNode extends ScanNode {
List<Backend> candidateBeList = Lists.newArrayList();
if (usingRandomBackend) {
for (int i = 0; i < numBe; ++i) {
- candidateBeList.add(backendList.get(beIndex++ %
numBe));
+ candidateBeList.add(backendList.get(beIndex++ % size));
}
} else {
candidateBeList.addAll(colocatedBes);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]