Copilot commented on code in PR #63515:
URL: https://github.com/apache/doris/pull/63515#discussion_r3285733242


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -1769,6 +1771,26 @@ private void transferToMaster() {
             editLog.logMasterInfo(masterInfo);
             LOG.info("logMasterInfo:{}", masterInfo);
 
+            if (Boolean.getBoolean(FeConstants.DROP_BACKENDS_KEY)) {
+                LOG.info("drop_backends is set, dropping all backends...");
+                try {
+                    SystemInfoService systemInfoService = 
Env.getCurrentSystemInfo();
+                    List<Backend> bes = 
systemInfoService.getAllClusterBackendsNoException().values()
+                            .stream().collect(Collectors.toList());
+                    if (Config.isNotCloudMode()) {
+                        for (Backend be : bes) {
+                            systemInfoService.dropBackend(be.getHost(), 
be.getHeartbeatPort());
+                        }
+                    } else {
+                        ((CloudSystemInfoService) 
systemInfoService).updateCloudBackends(Collections.emptyList(), bes);
+                    }
+                } catch (Exception e) {
+                    LOG.warn("failed to drop backends", e);
+                }
+                System.clearProperty(FeConstants.DROP_BACKENDS_KEY);
+                LOG.info("finished dropping all backends");

Review Comment:
   The log message "finished dropping all backends" is printed even when an 
exception occurs (the catch only logs a warning). This can mislead operators 
into thinking the operation succeeded; also the system property is cleared 
outside of a finally block, making the intent less explicit.
   



-- 
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