[Bug] Filter out unavaliable backends when getting tablet location (#6204)

* [Bug] Filter out unavaiable backends when getting scan range location

In the previous implementation, we will eliminate non-surviving BEs in the Coordinator phase.
But for Spark or Flink Connector, there is no such logic, so when a BE node is down,
it will cause the problem of querying errors through the Connector.

* fix ut

* fix compiule
This commit is contained in:
Mingyu Chen
2021-07-13 11:17:49 +08:00
committed by GitHub
parent 76e148988a
commit d79cdc829f
3 changed files with 14 additions and 4 deletions

View File

@ -430,8 +430,9 @@ public class OlapScanNode extends ScanNode {
boolean collectedStat = false;
for (Replica replica : replicas) {
Backend backend = Catalog.getCurrentSystemInfo().getBackend(replica.getBackendId());
if (backend == null) {
LOG.debug("replica {} not exists", replica.getBackendId());
if (backend == null || !backend.isAlive()) {
LOG.debug("backend {} not exists or is not alive for replica {}",
replica.getBackendId(), replica.getId());
continue;
}
String ip = backend.getHost();

View File

@ -263,10 +263,13 @@ abstract public class DorisHttpTestCase {
private static void assignBackends() {
Backend backend1 = new Backend(testBackendId1, "node-1", 9308);
backend1.setBePort(9300);
backend1.setAlive(true);
Backend backend2 = new Backend(testBackendId2, "node-2", 9308);
backend2.setBePort(9300);
backend2.setAlive(true);
Backend backend3 = new Backend(testBackendId3, "node-3", 9308);
backend3.setBePort(9300);
backend3.setAlive(true);
Catalog.getCurrentSystemInfo().addBackend(backend1);
Catalog.getCurrentSystemInfo().addBackend(backend2);
Catalog.getCurrentSystemInfo().addBackend(backend3);