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 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"); + } + // for master, the 'isReady' is set behind. // but we are sure that all metadata is replayed if we get here. // so no need to check 'isReady' flag in this method diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java b/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java index dc2e2aafbdc584..8d05fd2a698e3a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java @@ -68,4 +68,5 @@ public class FeConstants { public static String METADATA_FAILURE_RECOVERY_KEY = "metadata_failure_recovery"; public static String RECOVERY_JOURNAL_ID_KEY = "recovery_journal_id"; + public static String DROP_BACKENDS_KEY = "drop_backends"; }