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


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -1826,6 +1827,18 @@ private void transferToMaster() {
             editLog.logMasterInfo(masterInfo);
             LOG.info("logMasterInfo:{}", masterInfo);
 
+            if ("true".equals(System.getProperty("drop_backends"))) {
+                LOG.info("drop_backends is set, dropping all backends...");
+                for (Backend be : 
Env.getCurrentSystemInfo().getAllClusterBackendsNoException().values()) {
+                    try {
+                        Env.getCurrentSystemInfo().dropBackend(be.getHost(), 
be.getHeartbeatPort());
+                    } catch (Exception e) {
+                        LOG.warn("failed to drop backend {}: {}", be.getId(), 
e.getMessage());

Review Comment:
   When a backend drop fails, the log only prints e.getMessage() and drops the 
stack trace, which makes diagnosing partial failures difficult. Log the 
exception itself (e.g., pass the Throwable to LOG.warn) so operators can see 
the full cause.
   



##########
fe/fe-core/src/main/java/org/apache/doris/DorisFE.java:
##########
@@ -363,6 +363,8 @@ private static CommandLineOptions parseArgs(String[] args) {
                 .desc("Specify the recovery truncate journal id, and journals 
greater than this id will be removed")
                 .build());
         options.addOption("c", "cluster_snapshot", true, "Specify the cluster 
snapshot json file");
+        
options.addOption(Option.builder().longOpt(FeConstants.DROP_BACKENDS_KEY)
+                .desc("Drop all backends on startup").build());

Review Comment:
   The option help text says "Drop all backends on startup", but the actual 
behavior happens when this FE executes transferToMaster (i.e., when it becomes 
MASTER), which may be later than startup. Consider clarifying the description 
to reflect the real trigger and that the action is destructive (removes BEs 
from cluster metadata).
   



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -1826,6 +1827,18 @@ private void transferToMaster() {
             editLog.logMasterInfo(masterInfo);
             LOG.info("logMasterInfo:{}", masterInfo);
 
+            if ("true".equals(System.getProperty("drop_backends"))) {

Review Comment:
   Env checks the system property using the hard-coded key "drop_backends" and 
a string equality check. Since the property is set via 
FeConstants.DROP_BACKENDS_KEY in DorisFE, this should also reference the 
constant here (and preferably parse as a boolean via Boolean.parseBoolean / 
Boolean.getBoolean) to avoid key drift and make the intent 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