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 @@ -517,14 +517,18 @@ protected void runAfterCatalogReady() {
return;
}

statRouteInfo();
migrateTabletsForSmoothUpgrade();
statRouteInfo();
try {
statRouteInfo();
migrateTabletsForSmoothUpgrade();
statRouteInfo();

indexBalanced = true;
tableBalanced = true;
indexBalanced = true;
tableBalanced = true;

performBalancing();
performBalancing();
} finally {
releaseSchedulingIndexes();
}

checkDecommissionState(clusterToBes);
inited = true;
Expand Down Expand Up @@ -640,6 +644,15 @@ private void performBalancing() {
}
}

private void releaseSchedulingIndexes() {
// These indexes are no longer used after balancing. Replace their top-level maps instead of clearing
// every entry so the complete tablet membership graphs can become collectible without an O(N) traversal.
partitionToTablets = new ConcurrentHashMap<>();
futurePartitionToTablets = new ConcurrentHashMap<>();
beToTabletsInTable = new ConcurrentHashMap<>();
futureBeToTabletsInTable = new ConcurrentHashMap<>();
}

private boolean balanceAllPartitionsByPhase(ActiveSchedulePhase phase) {
// Reuse existing "balanced" flags as a per-phase signal.
indexBalanced = true;
Expand Down
Loading