Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deardeng committed Sep 6, 2024
1 parent 1a0bfcf commit a2b0075
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public long getIdx() {
return idx;
}

public Map<String, List<Long>> getClusterToBackends() {
public Map<String, List<Long>> getprimaryClusterToBackends() {
return primaryClusterToBackends;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ private void completeRouteInfo() {
List<Long> tabletIds = new ArrayList<Long>();
for (Tablet tablet : index.getTablets()) {
for (Replica replica : tablet.getReplicas()) {
Map<String, List<Long>> clusterToBackends =
((CloudReplica) replica).getClusterToBackends();
if (!clusterToBackends.containsKey(cluster)) {
Map<String, List<Long>> primaryClusterToBackends =
((CloudReplica) replica).getprimaryClusterToBackends();
if (!primaryClusterToBackends.containsKey(cluster)) {
long beId = ((CloudReplica) replica).hashReplicaToBe(cluster, true);
((CloudReplica) replica).updateClusterToBe(cluster, beId, true);
if (beId <= 0) {
Expand All @@ -510,13 +510,13 @@ private void completeRouteInfo() {
}
List<Long> bes = new ArrayList<Long>();
bes.add(beId);
clusterToBackends.put(cluster, bes);
primaryClusterToBackends.put(cluster, bes);

assigned = true;
beIds.add(beId);
tabletIds.add(tablet.getId());
} else {
beIds.add(clusterToBackends.get(cluster).get(0));
beIds.add(primaryClusterToBackends.get(cluster).get(0));
tabletIds.add(tablet.getId());
}
}
Expand Down Expand Up @@ -570,9 +570,9 @@ public void statRouteInfo() {
loopCloudReplica((Database db, Table table, Partition partition, MaterializedIndex index, String cluster) -> {
for (Tablet tablet : index.getTablets()) {
for (Replica replica : tablet.getReplicas()) {
Map<String, List<Long>> clusterToBackends =
((CloudReplica) replica).getClusterToBackends();
for (Map.Entry<String, List<Long>> entry : clusterToBackends.entrySet()) {
Map<String, List<Long>> primaryClusterToBackends =
((CloudReplica) replica).getprimaryClusterToBackends();
for (Map.Entry<String, List<Long>> entry : primaryClusterToBackends.entrySet()) {
if (!cluster.equals(entry.getKey())) {
continue;
}
Expand Down

0 comments on commit a2b0075

Please sign in to comment.