Skip to content

Commit

Permalink
[fix](catalog) remove backend in black list from candidate backends f…
Browse files Browse the repository at this point in the history
…or external table (apache#38984)

When select backends for external table's query,
skip the backends in black list
  • Loading branch information
morningman authored Aug 7, 2024
1 parent f9788b4 commit 843afcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -209,6 +211,10 @@ public List<Backend> getCandidateBackends(ImmutableCollection<Backend> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 843afcc

Please sign in to comment.