Copilot commented on code in PR #63795:
URL: https://github.com/apache/doris/pull/63795#discussion_r3315792936
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -1766,6 +1769,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:
"finished dropping all backends" is logged even when an exception occurs
(the exception is only logged at WARN and execution continues). This makes
recovery logs misleading. Consider logging success vs failure explicitly (e.g.,
only log "finished" on successful completion, and log an error/failure summary
otherwise).
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -1766,6 +1769,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 {
Review Comment:
The non-cloud path drops backends one-by-one via
SystemInfoService.dropBackend(), which regenerates backend tablet metrics on
every call (MetricRepo.generateBackendsTabletMetrics()). For clusters with many
BEs, this makes master transfer/recovery unnecessarily expensive. Consider
adding a bulk-drop path that regenerates metrics once (or deferring metric
regeneration until after the loop).
--
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]