fix lite upgrade add rollback before upgrade-post

This commit is contained in:
zhang_xubo
2023-11-04 10:26:52 +08:00
parent a5cf4da03a
commit c6f95e3660
2 changed files with 11 additions and 7 deletions

View File

@ -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

View File

@ -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