diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java b/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java index ece95f1b00755e..59cb4f19139b46 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java +++ b/fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java @@ -17,6 +17,8 @@ package org.apache.doris.system; +import org.apache.doris.common.Config; +import org.apache.doris.qe.SimpleScheduler; import org.apache.doris.resource.Tag; import org.apache.doris.thrift.TStorageMedium; @@ -209,6 +211,10 @@ public List getCandidateBackends(Collection backends) { } else { candidates.addAll(filterBackends); } + // filter out backends in black list + if (!Config.disable_backend_black_list) { + candidates = candidates.stream().filter(b -> SimpleScheduler.isAvailable(b)).collect(Collectors.toList()); + } Collections.shuffle(candidates); return candidates; } diff --git a/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java b/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java index b36f4b2a8156e9..62ade50c9198f6 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/system/SystemInfoServiceTest.java @@ -21,6 +21,7 @@ import org.apache.doris.catalog.Env; import org.apache.doris.catalog.ReplicaAllocation; import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.Config; import org.apache.doris.common.FeMetaVersion; import org.apache.doris.common.Pair; import org.apache.doris.meta.MetaContext; @@ -133,6 +134,7 @@ public void testBackendHbResponseSerialization() throws IOException { @Test public void testSelectBackendIdsByPolicy() throws Exception { + Config.disable_backend_black_list = true; // 1. no backend BeSelectionPolicy policy = new BeSelectionPolicy.Builder().needLoadAvailable().build(); Assert.assertEquals(0, infoService.selectBackendIdsByPolicy(policy, 1).size());