deardeng commented on code in PR #67636:
URL: https://github.com/apache/doris/pull/67636#discussion_r4061616307
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/datasource/CloudInternalCatalog.java:
##########
@@ -1390,6 +1392,83 @@ public void
replayUpdateCloudReplica(UpdateCloudReplicaInfo info) throws MetaNot
}
}
+ // The three private helpers below are each independently callable (one
per catalog level), so this
+ // guard is checked in every one of them rather than once at the top -- a
config flip mid-sweep then
+ // takes effect at the next db/table/partition boundary instead of only on
the next whole-catalog call.
+ private static boolean routeCleanupDisabled() {
+ return Config.isNotCloudMode() ||
!Config.enable_cloud_replica_stale_route_clean
+ || FeConstants.runningUnitTest;
+ }
+
+ /**
+ * @param systemInfo the backend set to judge staleness against. Must come
from the same Env this
+ * catalog belongs to (the serving Env during
replay/rebalancing, or the checkpoint's
+ * private Env while generating an image) -- never
resolved internally via
+ * Env.getCurrentSystemInfo(), so a caller cannot
accidentally sweep this catalog's
+ * replicas against a different Env's backend set.
+ */
+ public long removeInvalidCloudReplicaRoutes(SystemInfoService systemInfo) {
+ if (routeCleanupDisabled()) {
+ return 0;
+ }
+ long start = System.currentTimeMillis();
+ long removed = 0;
+ for (Long dbId : getDbIds()) {
+ Database db = getDbNullable(dbId);
+ if (db == null) {
+ continue; // The database can be dropped concurrently on the
serving Env.
+ }
+ removed += removeInvalidCloudReplicaRoutes(db, systemInfo);
+ }
+ LOG.info("swept stale cloud routes, entries dropped {}, cost {} ms",
+ removed, System.currentTimeMillis() - start);
+ return removed;
+ }
+
+ private static long removeInvalidCloudReplicaRoutes(Database db,
SystemInfoService systemInfo) {
+ if (routeCleanupDisabled()) {
+ return 0;
Review Comment:
ignore
--
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]