deardeng commented on code in PR #66984:
URL: https://github.com/apache/doris/pull/66984#discussion_r3838075231


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java:
##########
@@ -1017,6 +1027,15 @@ private boolean completeRouteInfo() {
             for (Tablet tablet : tablets) {
                 for (Replica r : tablet.getReplicas()) {
                     CloudReplica replica = (CloudReplica) r;
+                    // Drop routes of compute groups that no longer exist; 
gsonPostProcess() only converges
+                    // the catalog on image load, so without this the leader 
keeps them until it restarts.
+                    // No edit log op is written for the removal: the entries 
are already unroutable, every
+                    // FE reaches the same conclusion from its own backend 
set, and the image is written by
+                    // the checkpoint Env from a fresh load, so a 
leader/follower difference never reaches
+                    // persisted state and is gone after one round on the new 
leader.
+                    if (cluster.equals(cleanupPassTicket)) {
+                        staleRouteNum[0] += replica.removeInvalidRoutes();

Review Comment:
   Fixed. The sweep is now gated on the backend set losing a member — a route 
can only go stale when a backend disappears:
   
   return lastSweptBackends == null || 
!currentBes.containsAll(lastSweptBackends);
   
   Profiled on a 6M-tablet production image: removeInvalidRoutes went from 
1.905% of FE CPU to 0 samples. It sweeps once after startup, then skips every 
round until a backend goes away. Covered by testStaleRouteSweepGate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to