Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -1002,8 +1003,9 @@ public void modifyBackends(ModifyBackendOp op) throws UserException {
boolean shouldModify = false;
Map<String, String> tagMap = op.getTagMap();
if (!tagMap.isEmpty()) {
Map<String, String> oldTagMap = new HashMap<>(be.getTagMap());
be.setTagMap(tagMap);
shouldModify = true;
shouldModify = !areTagEntriesEqual(oldTagMap, tagMap);
}

if (op.isQueryDisabled() != null) {
Expand Down Expand Up @@ -1118,4 +1120,25 @@ public static boolean needRetryWithReplan(String errorMsg) {
}
return false;
}

private static boolean areTagEntriesEqual(Map<String, String> oldTagMap, Map<String, String> newTagMap) {
Map<String, String> oldTagEntries = filterTagEntries(oldTagMap);
Map<String, String> newTagEntries = filterTagEntries(newTagMap);
return oldTagEntries.equals(newTagEntries);
}

private static Map<String, String> filterTagEntries(Map<String, String> map) {
Map<String, String> result = new HashMap<>();
if (map == null) {
return result;
}
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
if (key != null && key.startsWith("tag.")) {
result.put(key, entry.getValue());
}
}
return result;
}

}