[bugfix](fe) should use equals not == to get failed to select replica message (#45602)

### What problem does this PR solve?

The original code use == to filter tag, it is wrong.
This commit is contained in:
yiguolei
2024-12-18 22:26:26 +08:00
committed by GitHub
parent ca24cd1cd9
commit bc048a3e36
3 changed files with 5 additions and 3 deletions

View File

@ -178,7 +178,8 @@ public class SimpleScheduler {
}
blacklistBackends.put(backendID, Pair.of(Config.blacklist_duration_second + 1, reason));
LOG.warn("add backend {} to black list. reason: {}", backendID, reason);
// Should print the exception stack, so that we will know when it is added to blacklist.
LOG.warn("add backend {} to black list. reason: {}", backendID, reason, new Exception());
}
public static boolean isAvailable(Backend backend) {

View File

@ -237,7 +237,8 @@ public class BeSelectionPolicy {
@Override
public String toString() {
return String.format("computeNode=%s | query=%s | load=%s | schedule=%s | tags=%s(%s) | medium=%s",
return String.format("computeNode=%s | query=%s | load=%s | schedule=%s | tags=%s |"
+ "resource_downgrade=%s | medium=%s",
preferComputeNode, needQueryAvailable, needLoadAvailable, needScheduleAvailable,
resourceTags.stream().map(tag -> tag.toString()).collect(Collectors.joining(",")),
this.allowResourceTagDowngrade, storageMedium);

View File

@ -563,7 +563,7 @@ public class SystemInfoService {
StringBuilder sb = new StringBuilder(" Backends details: ");
for (Tag tag : replicaAlloc.getAllocMap().keySet()) {
sb.append("backends with tag ").append(tag).append(" is ");
sb.append(idToBackendRef.values().stream().filter(be -> be.getLocationTag() == tag)
sb.append(idToBackendRef.values().stream().filter(be -> be.getLocationTag().equals(tag))
.map(Backend::getDetailsForCreateReplica)
.collect(Collectors.toList()));
sb.append(", ");