未验证 提交 fae99ad0 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-5628]<fix>: prompt --force-keep-file if upgrade lower version with 2.0.16.0 (#7080)

上级 1f4d51c1
...@@ -54,6 +54,7 @@ if command -v sudo > /dev/null; then ...@@ -54,6 +54,7 @@ if command -v sudo > /dev/null; then
fi fi
update_flag=0 update_flag=0
prompt_force=0
initd_mod=0 initd_mod=0
service_mod=2 service_mod=2
...@@ -780,7 +781,18 @@ function is_version_compatible() { ...@@ -780,7 +781,18 @@ function is_version_compatible() {
min_compatible_version=$(${script_dir}/bin/taosd -V | head -1 | cut -d ' ' -f 5) min_compatible_version=$(${script_dir}/bin/taosd -V | head -1 | cut -d ' ' -f 5)
fi fi
# [TD-5628] prompt to execute taosd --force-keep-file if upgrade from lower version within 2.0.16.0
exist_version=$(/usr/local/taos/bin/taosd -V | head -1 | cut -d ' ' -f 3)
vercomp $exist_version "2.0.16.0"
case $? in
2)
prompt_force=1
;;
esac
vercomp $curr_version $min_compatible_version vercomp $curr_version $min_compatible_version
echo "" # avoid $? value not update
case $? in case $? in
0) return 0;; 0) return 0;;
1) return 0;; 1) return 0;;
...@@ -789,6 +801,12 @@ function is_version_compatible() { ...@@ -789,6 +801,12 @@ function is_version_compatible() {
} }
function update_TDengine() { function update_TDengine() {
# Check if version compatible
if ! is_version_compatible; then
echo -e "${RED}Version incompatible${NC}"
return 1
fi
# Start to update # Start to update
if [ ! -e taos.tar.gz ]; then if [ ! -e taos.tar.gz ]; then
echo "File taos.tar.gz does not exist" echo "File taos.tar.gz does not exist"
...@@ -797,12 +815,6 @@ function update_TDengine() { ...@@ -797,12 +815,6 @@ function update_TDengine() {
tar -zxf taos.tar.gz tar -zxf taos.tar.gz
install_jemalloc install_jemalloc
# Check if version compatible
if ! is_version_compatible; then
echo -e "${RED}Version incompatible${NC}"
return 1
fi
echo -e "${GREEN}Start to update TDengine...${NC}" echo -e "${GREEN}Start to update TDengine...${NC}"
# Stop the service if running # Stop the service if running
if pidof taosd &> /dev/null; then if pidof taosd &> /dev/null; then
...@@ -875,6 +887,10 @@ function update_TDengine() { ...@@ -875,6 +887,10 @@ function update_TDengine() {
echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos -h $serverFqdn${NC} in shell${NC}" echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos -h $serverFqdn${NC} in shell${NC}"
fi fi
if ((${prompt_force}==1)); then
echo ""
echo -e "${RED}Please run 'taosd --force-keep-file' at first time for the exist TDengine $exist_version!${NC}"
fi
echo echo
echo -e "\033[44;32;1mTDengine is updated successfully!${NC}" echo -e "\033[44;32;1mTDengine is updated successfully!${NC}"
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册