[opt](compute-node) refactor compute node doc and opt some default config (#31325)

* [opt](compute-node) refactor compute node doc and opt some default config

* 1

* 1
This commit is contained in:
Mingyu Chen
2024-02-24 08:37:33 +08:00
committed by yiguolei
parent 8d1221aa65
commit aee49adf1e
6 changed files with 314 additions and 124 deletions

View File

@ -181,8 +181,10 @@ public class BeSelectionPolicy {
filterBackends = preLocationFilterBackends;
}
Collections.shuffle(filterBackends);
int numComputeNode = filterBackends.stream().filter(Backend::isComputeNode).collect(Collectors.toList()).size();
List<Backend> candidates = new ArrayList<>();
if (preferComputeNode) {
if (preferComputeNode && numComputeNode > 0) {
int realExpectBeNum = expectBeNum == -1 ? numComputeNode : expectBeNum;
int num = 0;
// pick compute node first
for (Backend backend : filterBackends) {
@ -192,10 +194,10 @@ public class BeSelectionPolicy {
}
}
// fill with some mix node.
if (num < expectBeNum) {
if (num < realExpectBeNum) {
for (Backend backend : filterBackends) {
if (backend.isMixNode()) {
if (num >= expectBeNum) {
if (num >= realExpectBeNum) {
break;
}
candidates.add(backend);