From a62b4c4f8bb2a6be32fe4398818ef818d1b797dc Mon Sep 17 00:00:00 2001 From: meiyi Date: Fri, 15 May 2026 21:03:41 +0800 Subject: [PATCH 1/2] fix --- bin/start_fe.sh | 14 ++++++++++---- .../src/main/java/org/apache/doris/DorisFE.java | 5 +++++ .../main/java/org/apache/doris/catalog/Env.java | 13 +++++++++++++ .../java/org/apache/doris/common/FeConstants.java | 1 + 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/bin/start_fe.sh b/bin/start_fe.sh index 45b883ef1c5504..941e8c5a52daa4 100755 --- a/bin/start_fe.sh +++ b/bin/start_fe.sh @@ -36,6 +36,7 @@ OPTS="$(getopt \ -l 'recovery_journal_id:' \ -l 'console' \ -l 'cluster_snapshot:' \ + -l 'drop_backends' \ -- "$@")" eval set -- "${OPTS}" @@ -50,6 +51,7 @@ declare -a HELPER_ARGS=() declare -a METADATA_FAILURE_RECOVERY_ARGS=() declare -a RECOVERY_JOURNAL_ID_ARGS=() declare -a CLUSTER_SNAPSHOT_ARGS=() +declare -a DROP_BACKENDS_ARGS=() while true; do case "$1" in --daemon) @@ -85,6 +87,10 @@ while true; do CLUSTER_SNAPSHOT_ARGS=("--cluster_snapshot" "$2") shift 2 ;; + --drop_backends) + DROP_BACKENDS_ARGS=("--drop_backends") + shift + ;; --) shift break @@ -93,7 +99,7 @@ while true; do echo "Internal error" exit 1 ;; - esac +esac done DORIS_HOME="$( @@ -433,12 +439,12 @@ if [[ "${IMAGE_TOOL}" -eq 1 ]]; then echo "Internal error, USE IMAGE_TOOL like: ./start_fe.sh --image image_path" fi elif [[ "${RUN_DAEMON}" -eq 1 ]]; then - nohup ${LIMIT:+${LIMIT}} "${JAVA}" ${final_java_opt:+${final_java_opt}} -XX:-OmitStackTraceInFastThrow -XX:OnOutOfMemoryError="kill -9 %p" ${coverage_opt:+${coverage_opt}} org.apache.doris.DorisFE "${HELPER_ARGS[@]}" "${METADATA_FAILURE_RECOVERY_ARGS[@]}" "${RECOVERY_JOURNAL_ID_ARGS[@]}" "${CLUSTER_SNAPSHOT_ARGS[@]}" "$@" >>"${STDOUT_LOGGER}" 2>&1 >"${STDOUT_LOGGER}" 2>&1 >"${STDOUT_LOGGER}" >"${STDOUT_LOGGER}" >"${STDOUT_LOGGER}" 2>&1 >"${STDOUT_LOGGER}" 2>&1 Date: Sat, 16 May 2026 10:46:18 +0800 Subject: [PATCH 2/2] fix --- .../runtime/doris-compose/resource/init_fe.sh | 2 +- .../java/org/apache/doris/catalog/Env.java | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docker/runtime/doris-compose/resource/init_fe.sh b/docker/runtime/doris-compose/resource/init_fe.sh index c95c7e0416f001..4e3a3ffffe7b3c 100755 --- a/docker/runtime/doris-compose/resource/init_fe.sh +++ b/docker/runtime/doris-compose/resource/init_fe.sh @@ -188,7 +188,7 @@ start_cloud_fe() { exit $MV_RES fi health_log "Recovery script executed and renamed to ${RECOVERY_SCRIPT}.bak" - RECOVERY_ARGS="--metadata_failure_recovery --recovery_journal_id $JOURNAL_ID" + RECOVERY_ARGS="--metadata_failure_recovery --recovery_journal_id $JOURNAL_ID --drop_backends" fi if [ -f "$REGISTER_FILE" ] || [ -n "${CLUSTER_SNAPSHOT_FILE}" ] || [ -n "$RECOVERY_ARGS" ]; then diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java index 8531dd8f3cf86f..eb66b5213addcf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java @@ -55,6 +55,7 @@ import org.apache.doris.clone.TabletChecker; import org.apache.doris.clone.TabletScheduler; import org.apache.doris.clone.TabletSchedulerStat; +import org.apache.doris.cloud.system.CloudSystemInfoService; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.Config; import org.apache.doris.common.ConfigBase; @@ -1829,12 +1830,19 @@ private void transferToMaster() { if (Boolean.getBoolean(FeConstants.DROP_BACKENDS_KEY)) { 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); + try { + SystemInfoService systemInfoService = Env.getCurrentSystemInfo(); + List 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); } LOG.info("finished dropping all backends"); }