From c6f95e3660ae199cf0f9782010e6e479e2e9ea47 Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Sat, 4 Nov 2023 10:26:52 +0800 Subject: [PATCH] fix lite upgrade add rollback before upgrade-post --- liteom/install.sh | 1 + liteom/upgrade_common.sh | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/liteom/install.sh b/liteom/install.sh index e0987fdec..cd592873e 100644 --- a/liteom/install.sh +++ b/liteom/install.sh @@ -653,6 +653,7 @@ function set_environment() gaussdata=$(cd ${data_path}; pwd) sed -i "/.*export\\s*GAUSSDATA=/d" ${env_file} echo "export GAUSSDATA=${gaussdata}" >> ${env_file} + echo "export PGDATA=${gaussdata}" >> ${env_file} info "[set GAUSSDATA environment variables success.]" elif [ "$2" = "log" ] then diff --git a/liteom/upgrade_common.sh b/liteom/upgrade_common.sh index f08888b82..d413152c8 100644 --- a/liteom/upgrade_common.sh +++ b/liteom/upgrade_common.sh @@ -222,10 +222,9 @@ function check_env() { if [[ "$GAUSSDATA" == "" ]] && [[ "$PGDATA" == "" ]]; then die "GAUSSDATA or PGDATA cannot be all null!" ${err_check_init} fi - if [[ "$PGDATA" == "" ]]; then + if [[ "$GAUSSDATA" != "" ]]; then PGDATA=${GAUSSDATA} - fi - if [[ "$GAUSSDATA" == "" ]]; then + elif [[ "$PGDATA" != "" ]]; then GAUSSDATA=${PGDATA} fi check_config_path "$GAUSSHOME" @@ -1133,10 +1132,7 @@ function upgrade_post() { die "Step file may be changed invalid" ${err_upgrade_post} elif [[ "$current_step" -lt 4 ]]; then die "You should exec upgrade_bin first" ${err_upgrade_post} - elif [[ "$current_step" -eq 4 ]]; then - upgrade_post_step56 - elif [[ "$current_step" -eq 5 ]]; then - rollback_post + elif [[ "$current_step" -lt 6 ]]; then upgrade_post_step56 else log "no need do upgrade_post step" @@ -1151,6 +1147,13 @@ function upgrade_post_step56() { die "Guassdb is not running" ${err_upgrade_post} fi record_step 5 + + if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_rollback-post_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_rollback-post_otherdb.sql otherdb; then + debug "upgrade-rollback post sql successfully" + else + die "upgrade-rollback post sql failed" ${err_rollback_post} + fi + if exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade-post_maindb.sql maindb && exec_sql "$GAUSS_TMP_PATH"/temp_sql/temp_upgrade-post_otherdb.sql otherdb; then debug "upgrade post sql successfully" else