+ Teardown: |
+
+ Show Teardown
+
+ |
+
+ '''.format(stdout.strip())
+
+ # 如果需要在 Python 脚本中生成 HTML,并使用 JavaScript 控制折叠内容的显示,可以这样做:
+
+ html_script = '''
+
+ '''
+
+ # 输出完整的 HTML 代码
+ final_html = html_content + html_script
+ rows.append(final_html)
+
+ prefix.extend(rows)
diff --git a/packaging/smokeTest/debRpmAutoInstall.sh b/packaging/smokeTest/debRpmAutoInstall.sh
new file mode 100755
index 0000000000..8fadffe4c6
--- /dev/null
+++ b/packaging/smokeTest/debRpmAutoInstall.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/expect
+set packageName [lindex $argv 0]
+set packageSuffix [lindex $argv 1]
+set timeout 30
+if { ${packageSuffix} == "deb" } {
+ spawn dpkg -i ${packageName}
+} elseif { ${packageSuffix} == "rpm"} {
+ spawn rpm -ivh ${packageName}
+}
+expect "*one:"
+send "\r"
+expect "*skip:"
+send "\r"
+
+expect eof
diff --git a/packaging/smokeTest/getAndRunInstaller.bat b/packaging/smokeTest/getAndRunInstaller.bat
new file mode 100644
index 0000000000..08b04a0271
--- /dev/null
+++ b/packaging/smokeTest/getAndRunInstaller.bat
@@ -0,0 +1,57 @@
+set baseVersion=%1%
+set version=%2%
+set verMode=%3%
+set sType=%4%
+echo %fileType%
+rem stop services
+if EXIST C:\TDengine (
+ if EXIST C:\TDengine\stop-all.bat (
+ call C:\TDengine\stop-all.bat /silent
+ echo "***************Stop taos services***************"
+ )
+ if exist C:\TDengine\unins000.exe (
+ call C:\TDengine\unins000.exe /silent
+ echo "***************uninstall TDengine***************"
+ )
+ rd /S /q C:\TDengine
+)
+if EXIST C:\ProDB (
+ if EXIST C:\ProDB\stop-all.bat (
+ call C:\ProDB\stop-all.bat /silent
+ echo "***************Stop taos services***************"
+ )
+ if exist C:\ProDB\unins000.exe (
+ call C:\ProDB\unins000.exe /silent
+ echo "***************uninstall TDengine***************"
+ )
+ rd /S /q C:\ProDB
+)
+if "%verMode%"=="enterprise" (
+ if "%sType%"=="client" (
+ set fileType=enterprise-client
+ ) else (
+ set fileType=enterprise
+ )
+) else (
+ set fileType=%sType%
+)
+
+if "%baseVersion%"=="ProDB" (
+ echo %fileType%
+ set installer=ProDB-%fileType%-%version%-Windows-x64.exe
+) else (
+ echo %fileType%
+ set installer=TDengine-%fileType%-%version%-Windows-x64.exe
+)
+
+if "%baseVersion%"=="ProDB" (
+ echo %installer%
+ scp root@192.168.1.213:/nas/OEM/ProDB/v%version%/%installer% C:\workspace
+) else (
+ echo %installer%
+ scp root@192.168.1.213:/nas/TDengine/%baseVersion%/v%version%/%verMode%/%installer% C:\workspace
+)
+
+echo "***************Finish installer transfer!***************"
+C:\workspace\%installer% /silent
+echo "***************Finish install!***************"
\ No newline at end of file
diff --git a/packaging/smokeTest/getAndRunInstaller.sh b/packaging/smokeTest/getAndRunInstaller.sh
new file mode 100755
index 0000000000..7defe6394c
--- /dev/null
+++ b/packaging/smokeTest/getAndRunInstaller.sh
@@ -0,0 +1,325 @@
+#!/bin/sh
+
+
+function usage() {
+ echo "$0"
+ echo -e "\t -f test file type,server/client/tools/"
+ echo -e "\t -m pacakage version Type,community/enterprise"
+ echo -e "\t -l package type,lite or not"
+ echo -e "\t -c operation type,x64/arm64"
+ echo -e "\t -v pacakage version,3.0.1.7"
+ echo -e "\t -o pacakage version,3.0.1.7"
+ echo -e "\t -s source Path,web/nas"
+ echo -e "\t -t package Type,tar/rpm/deb"
+ echo -e "\t -h help"
+}
+
+
+#parameter
+scriptDir=$(dirname $(readlink -f $0))
+version="3.0.1.7"
+originversion="smoking"
+testFile="server"
+verMode="communtity"
+sourcePath="nas"
+cpuType="x64"
+lite="true"
+packageType="tar"
+subFile="package.tar.gz"
+while getopts "m:c:f:l:s:o:t:v:h" opt; do
+ case $opt in
+ m)
+ verMode=$OPTARG
+ ;;
+ v)
+ version=$OPTARG
+ ;;
+ f)
+ testFile=$OPTARG
+ ;;
+ l)
+ lite=$OPTARG
+ ;;
+ s)
+ sourcePath=$OPTARG
+ ;;
+ o)
+ originversion=$OPTARG
+ ;;
+ c)
+ cpuType=$OPTARG
+ ;;
+ t)
+ packageType=$OPTARG
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ ?)
+ echo "Invalid option: -$OPTARG"
+ usage
+ exit 0
+ ;;
+ esac
+done
+
+systemType=`uname`
+if [ ${systemType} == "Darwin" ]; then
+ platform="macOS"
+else
+ platform="Linux"
+fi
+
+echo "testFile:${testFile},verMode:${verMode},lite:${lite},cpuType:${cpuType},packageType:${packageType},version-${version},originversion:${originversion},sourcePath:${sourcePath}"
+# Color setting
+RED='\033[41;30m'
+GREEN='\033[1;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[1;34m'
+GREEN_DARK='\033[0;32m'
+YELLOW_DARK='\033[0;33m'
+BLUE_DARK='\033[0;34m'
+GREEN_UNDERLINE='\033[4;32m'
+NC='\033[0m'
+if [ "${originversion}" = "ProDB" ]; then
+ TDengine="ProDB"
+else
+ TDengine="TDengine"
+fi
+if [[ ${verMode} = "enterprise" ]];then
+ prePackage="${TDengine}-enterprise"
+ if [[ ${testFile} = "client" ]];then
+ prePackage="${TDengine}-enterprise-${testFile}"
+ fi
+elif [ ${verMode} = "community" ];then
+ prePackage="${TDengine}-${testFile}"
+fi
+if [ ${lite} = "true" ];then
+ packageLite="-Lite"
+elif [ ${lite} = "false" ];then
+ packageLite=""
+fi
+if [[ "$packageType" = "tar" ]] ;then
+ packageType="tar.gz"
+fi
+
+tdPath="${prePackage}-${version}"
+
+packageName="${tdPath}-${platform}-${cpuType}${packageLite}.${packageType}"
+
+if [ "$testFile" == "server" ] ;then
+ installCmd="install.sh"
+elif [ ${testFile} = "client" ];then
+ installCmd="install_client.sh"
+fi
+
+echo "tdPath:${tdPath},packageName:${packageName}}"
+cmdInstall() {
+command=$1
+if command -v ${command} ;then
+ echoColor YD "${command} is already installed"
+else
+ if command -v apt ;then
+ apt-get install ${command} -y
+ elif command -v yum ;then
+ yum -y install ${command}
+ echoColor YD "you should install ${command} manually"
+ fi
+fi
+}
+
+echoColor() {
+ color=$1
+ command=$2
+ if [ ${color} = 'Y' ];then
+ echo -e "${YELLOW}${command}${NC}"
+ elif [ ${color} = 'YD' ];then
+ echo -e "${YELLOW_DARK}${command}${NC}"
+ elif [ ${color} = 'R' ];then
+ echo -e "${RED}${command}${NC}"
+ elif [ ${color} = 'G' ];then
+ echo -e "${GREEN}${command}${NC}\r\n"
+ elif [ ${color} = 'B' ];then
+ echo -e "${BLUE}${command}${NC}"
+ elif [ ${color} = 'BD' ];then
+ echo -e "${BLUE_DARK}${command}${NC}"
+ fi
+}
+
+wgetFile() {
+
+ file=$1
+ versionPath=$2
+ sourceP=$3
+ nasServerIP="192.168.1.213"
+ if [ "${originversion}" = "ProDB" ]; then
+ packagePath="/nas/OEM/ProDB/v${versionPath}"
+ else
+ packagePath="/nas/TDengine/${originversion}/v${versionPath}/${verMode}"
+ fi
+ if [ -f ${file} ];then
+ echoColor YD "${file} already exists ,it will delete it and download it again "
+ # rm -rf ${file}
+ fi
+
+ if [[ ${sourceP} = 'web' ]];then
+ echoColor BD "====download====:wget https://www.taosdata.com/assets-download/3.0/${file}"
+ wget https://www.taosdata.com/assets-download/3.0/${file}
+ elif [[ ${sourceP} = 'nas' ]];then
+ echoColor BD "====download====:scp root@${nasServerIP}:${packagePath}/${file} ."
+ scp root@${nasServerIP}:${packagePath}/${file} .
+ fi
+}
+
+function newPath {
+
+buildPath=$1
+
+if [ ! -d ${buildPath} ] ;then
+ echoColor BD "mkdir -p ${buildPath}"
+ mkdir -p ${buildPath}
+else
+ echoColor YD "${buildPath} already exists"
+fi
+
+}
+
+echoColor G "===== install basesoft ====="
+cmdInstall tree
+cmdInstall wget
+cmdInstall expect
+
+echoColor G "===== Uninstall all components of TDeingne ====="
+
+if command -v rmtaos ;then
+ echoColor YD "uninstall all components of TDeingne:rmtaos"
+ rmtaos
+else
+ echoColor YD "os doesn't include TDengine"
+fi
+
+if [[ ${packageName} =~ "server" ]] ;then
+ echoColor BD " pkill -9 taosd "
+ pkill -9 taosd
+fi
+
+if command -v rmprodb ;then
+ echoColor YD "uninstall all components of TDeingne:rmprodb"
+ rmprodb
+else
+ echoColor YD "os doesn't include TDengine"
+fi
+
+if [[ ${packageName} =~ "server" ]] ;then
+ echoColor BD " pkill -9 prodbd "
+ pkill -9 prodbd
+fi
+
+echoColor G "===== new workroom path ====="
+installPath="/usr/local/src/packageTest"
+
+if [ ${systemType} == "Darwin" ]; then
+ installPath="${WORK_DIR}/packageTest"
+fi
+
+newPath ${installPath}
+
+#if [ -d ${installPath}/${tdPath} ] ;then
+# echoColor BD "rm -rf ${installPath}/${tdPath}/*"
+# rm -rf ${installPath}/${tdPath}/*
+#fi
+
+echoColor G "===== download installPackage ====="
+cd ${installPath} && wgetFile ${packageName} ${version} ${sourcePath}
+#cd ${oriInstallPath} && wgetFile ${originPackageName} ${originversion} ${sourcePath}
+
+
+cd ${installPath}
+cp -r ${scriptDir}/debRpmAutoInstall.sh .
+
+packageSuffix=$(echo ${packageName} | awk -F '.' '{print $NF}')
+
+
+if [ ! -f debRpmAutoInstall.sh ];then
+ echo '#!/usr/bin/expect ' > debRpmAutoInstall.sh
+ echo 'set packageName [lindex $argv 0]' >> debRpmAutoInstall.sh
+ echo 'set packageSuffix [lindex $argv 1]' >> debRpmAutoInstall.sh
+ echo 'set timeout 30 ' >> debRpmAutoInstall.sh
+ echo 'if { ${packageSuffix} == "deb" } {' >> debRpmAutoInstall.sh
+ echo ' spawn dpkg -i ${packageName} ' >> debRpmAutoInstall.sh
+ echo '} elseif { ${packageSuffix} == "rpm"} {' >> debRpmAutoInstall.sh
+ echo ' spawn rpm -ivh ${packageName}' >> debRpmAutoInstall.sh
+ echo '}' >> debRpmAutoInstall.sh
+ echo 'expect "*one:"' >> debRpmAutoInstall.sh
+ echo 'send "\r"' >> debRpmAutoInstall.sh
+ echo 'expect "*skip:"' >> debRpmAutoInstall.sh
+ echo 'send "\r" ' >> debRpmAutoInstall.sh
+fi
+
+
+echoColor G "===== install Package ====="
+
+if [[ ${packageName} =~ "deb" ]];then
+ cd ${installPath}
+ dpkg -r taostools
+ dpkg -r tdengine
+ if [[ ${packageName} =~ "TDengine" ]];then
+ echoColor BD "./debRpmAutoInstall.sh ${packageName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packageName} ${packageSuffix}
+ else
+ echoColor BD "dpkg -i ${packageName}" && dpkg -i ${packageName}
+ fi
+elif [[ ${packageName} =~ "rpm" ]];then
+ cd ${installPath}
+ sudo rpm -e tdengine
+ sudo rpm -e taostools
+ if [[ ${packageName} =~ "TDengine" ]];then
+ echoColor BD "./debRpmAutoInstall.sh ${packageName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packageName} ${packageSuffix}
+ else
+ echoColor BD "rpm -ivh ${packageName}" && rpm -ivh ${packageName}
+ fi
+elif [[ ${packageName} =~ "tar" ]];then
+ echoColor G "===== check installPackage File of tar ====="
+
+ cd ${installPath}
+ echoColor YD "unzip the new installation package"
+ echoColor BD "tar -xf ${packageName}" && tar -xf ${packageName}
+
+ cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile
+
+ cd ${installPath}
+ diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log
+ diffNumbers=`cat ${installPath}/diffFile.log |wc -l `
+
+ if [ ${diffNumbers} != 0 ];then
+ echoColor R "The number and names of files is different from the previous installation package"
+ diffLog=`cat ${installPath}/diffFile.log`
+ echoColor Y "${diffLog}"
+ exit -1
+ else
+ echoColor G "The number and names of files are the same as previous installation packages"
+ rm -rf ${installPath}/diffFile.log
+ fi
+ echoColor YD "===== install Package of tar ====="
+ cd ${installPath}/${tdPath}
+ if [ ${testFile} = "server" ];then
+ echoColor BD "bash ${installCmd} -e no "
+ bash ${installCmd} -e no
+ else
+ echoColor BD "bash ${installCmd} "
+ bash ${installCmd}
+ fi
+elif [[ ${packageName} =~ "pkg" ]];then
+ cd ${installPath}
+ sudo installer -pkg ${packageName} -target /
+ echoColor YD "===== install Package successfully! ====="
+fi
+
+#cd ${installPath}
+#
+#rm -rf ${installPath}/${packageName}
+#if [ ${platform} == "Linux" ]; then
+# rm -rf ${installPath}/${tdPath}/
+#fi
+echoColor YD "===== end of shell file ====="
+
diff --git a/packaging/smokeTest/lib.py b/packaging/smokeTest/lib.py
new file mode 100644
index 0000000000..86c30bf8b1
--- /dev/null
+++ b/packaging/smokeTest/lib.py
@@ -0,0 +1,12 @@
+
+import subprocess
+
+
+def run_cmd(command):
+ print("CMD:", command)
+ result = subprocess.run(command, capture_output=True, text=True, shell=True)
+ print("STDOUT:", result.stdout)
+ print("STDERR:", result.stderr)
+ print("Return Code:", result.returncode)
+ #assert result.returncode == 0
+ return result
diff --git a/packaging/smokeTest/main.py b/packaging/smokeTest/main.py
new file mode 100644
index 0000000000..cb7356f80e
--- /dev/null
+++ b/packaging/smokeTest/main.py
@@ -0,0 +1,21 @@
+import pytest
+
+# python3 -m pytest test_server.py -v --html=/var/www/html/report.html --json-report --json-report-file="/var/www/html/report.json" --timeout=60
+
+# pytest.main(["-s", "-v"])
+import pytest
+
+import subprocess
+
+
+# define cmd function
+
+
+
+
+def main():
+ pytest.main(['--html=report.html'])
+
+
+if __name__ == '__main__':
+ main()
diff --git a/packaging/smokeTest/pytest_require.txt b/packaging/smokeTest/pytest_require.txt
new file mode 100644
index 0000000000..34019c6e8a
--- /dev/null
+++ b/packaging/smokeTest/pytest_require.txt
@@ -0,0 +1,17 @@
+pytest-html
+pytest-json-report
+pytest-timeout
+taospy
+numpy
+fabric2
+psutil
+pandas
+toml
+distro
+requests
+pexpect
+faker
+pyopenssl
+taos-ws-py
+taospy
+tzlocal
\ No newline at end of file
diff --git a/packaging/smokeTest/runCases.bat b/packaging/smokeTest/runCases.bat
new file mode 100644
index 0000000000..922766785c
--- /dev/null
+++ b/packaging/smokeTest/runCases.bat
@@ -0,0 +1,11 @@
+rm -rf %WIN_TDENGINE_ROOT_DIR%\debug
+mkdir %WIN_TDENGINE_ROOT_DIR%\debug
+mkdir %WIN_TDENGINE_ROOT_DIR%\debug\build
+mkdir %WIN_TDENGINE_ROOT_DIR%\debug\build\bin
+xcopy C:\TDengine\taos*.exe %WIN_TDENGINE_ROOT_DIR%\debug\build\bin
+
+set case_out_file=%cd%\case.out
+
+cd %WIN_TDENGINE_ROOT_DIR%\tests\system-test
+python3 .\test.py -f 0-others\taosShell.py
+python3 .\test.py -f 6-cluster\5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3
\ No newline at end of file
diff --git a/packaging/smokeTest/runCases.sh b/packaging/smokeTest/runCases.sh
new file mode 100644
index 0000000000..4de7a7658b
--- /dev/null
+++ b/packaging/smokeTest/runCases.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+ulimit -c unlimited
+
+rm -rf ${TDENGINE_ROOT_DIR}/debug
+mkdir ${TDENGINE_ROOT_DIR}/debug
+mkdir ${TDENGINE_ROOT_DIR}/debug/build
+mkdir ${TDENGINE_ROOT_DIR}/debug/build/bin
+
+systemType=`uname`
+if [ ${systemType} == "Darwin" ]; then
+ cp /usr/local/bin/taos* ${TDENGINE_ROOT_DIR}/debug/build/bin/
+else
+ cp /usr/bin/taos* ${TDENGINE_ROOT_DIR}/debug/build/bin/
+fi
+
+case_out_file=`pwd`/case.out
+python3 -m pip install -r ${TDENGINE_ROOT_DIR}/tests/requirements.txt >> $case_out_file
+python3 -m pip install taos-ws-py taospy >> $case_out_file
+
+cd ${TDENGINE_ROOT_DIR}/tests/army
+python3 ./test.py -f query/query_basic.py -N 3 >> $case_out_file
+
+cd ${TDENGINE_ROOT_DIR}/tests/system-test
+python3 ./test.py -f 1-insert/insert_column_value.py >> $case_out_file
+python3 ./test.py -f 2-query/primary_ts_base_5.py >> $case_out_file
+python3 ./test.py -f 2-query/case_when.py >> $case_out_file
+python3 ./test.py -f 2-query/partition_limit_interval.py >> $case_out_file
+python3 ./test.py -f 2-query/join.py >> $case_out_file
+python3 ./test.py -f 2-query/fill.py >> $case_out_file
diff --git a/packaging/smokeTest/smokeTestClient.py b/packaging/smokeTest/smokeTestClient.py
new file mode 100644
index 0000000000..eee9667300
--- /dev/null
+++ b/packaging/smokeTest/smokeTestClient.py
@@ -0,0 +1,251 @@
+#!/usr/bin/python
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+# install pip
+# pip install src/connector/python/
+
+# -*- coding: utf-8 -*-
+import sys, os
+import re
+import platform
+import getopt
+import subprocess
+# from this import d
+import time
+
+# input for server
+
+opts, args = getopt.gnu_getopt(sys.argv[1:], 'h:P:v:u', [
+ 'host=', 'Port=', 'version='])
+serverHost = ""
+serverPort = 0
+version = ""
+uninstall = False
+for key, value in opts:
+ if key in ['--help']:
+ print('A collection of test cases written using Python')
+ print('-h serverHost')
+ print('-P serverPort')
+ print('-v test client version')
+ print('-u test uninstall process, will uninstall TDengine')
+ sys.exit(0)
+
+ if key in ['-h']:
+ serverHost = value
+ if key in ['-P']:
+ serverPort = int(value)
+ if key in ['-v']:
+ version = value
+ if key in ['-u']:
+ uninstall = True
+if not serverHost:
+ print("Please input use -h to specify your server host.")
+ sys.exit(0)
+if not version:
+ print("No version specified, will not run version check.")
+if serverPort == 0:
+ serverPort = 6030
+ print("No server port specified, use default 6030.")
+
+
+system = platform.system()
+
+arch = platform.machine()
+
+databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
+# install taospy
+taospy_version = ""
+if system == 'Windows':
+ taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
+else:
+ taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
+
+print("taospy version %s " % taospy_version)
+if taospy_version == "":
+ subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
+ print("install taos python connector")
+else:
+ subprocess.getoutput("pip3 install taospy")
+
+# prepare data by taosBenchmark
+cmd = "taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d &" % (databaseName, serverHost, serverPort)
+process_out = subprocess.getoutput(cmd)
+print(cmd)
+#os.system("taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d" % (databaseName, serverHost, serverPort))
+taosBenchmark_test_result = True
+time.sleep(10)
+import taos
+
+conn = taos.connect(host=serverHost,
+ user="root",
+ password="taosdata",
+ database=databaseName,
+ port=serverPort,
+ timezone="Asia/Shanghai") # default your host's timezone
+
+server_version = conn.server_info
+print("server_version", server_version)
+client_version = conn.client_info
+print("client_version", client_version) # 3.0.0.0
+
+# Execute a sql and get its result set. It's useful for SELECT statement
+result: taos.TaosResult = conn.query("SELECT count(*) from meters")
+
+data = result.fetch_all()
+print(data)
+if data[0][0] !=10000:
+ print(" taosBenchmark work not as expected ")
+ print("!!!!!!!!!!!Test Result: taosBenchmark test failed! !!!!!!!!!!")
+ sys.exit(1)
+#else:
+# print("**********Test Result: taosBenchmark test passed **********")
+
+
+# drop database of test
+taos_test_result = False
+print("drop database test")
+print("run taos -s 'drop database %s;' -h %s -P %d" % (databaseName, serverHost, serverPort))
+taos_cmd_outpur = subprocess.getoutput('taos -s "drop database %s;" -h %s -P %d' % (databaseName, serverHost, serverPort))
+print(taos_cmd_outpur)
+if ("Drop OK" in taos_cmd_outpur):
+ taos_test_result = True
+ #print("*******Test Result: taos test passed ************")
+
+version_test_result = False
+if version:
+ print("Client info is: %s"%conn.client_info)
+ taos_V_output = ""
+ if system == "Windows":
+ taos_V_output = subprocess.getoutput("taos -V | findstr version")
+ else:
+ taos_V_output = subprocess.getoutput("taos -V | grep version")
+
+ print("taos -V output is: %s" % taos_V_output)
+ if version in taos_V_output and version in conn.client_info:
+ version_test_result = True
+ #print("*******Test Result: Version check passed ************")
+
+conn.close()
+if uninstall:
+ print("Start to run rmtaos")
+ leftFile = False
+ print("Platform: ", system)
+
+ if system == "Linux":
+ # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
+ process = subprocess.Popen(['rmtaos'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ # 向子进程发送输入
+ process.stdin.write("y\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ # 关闭子进程的stdin,防止它无限期等待更多输入
+ process.stdin.close()
+ # 等待子进程结束
+ process.wait()
+ # 检查目录清除情况
+ out = subprocess.getoutput("ls /etc/systemd/system/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/bin/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/bin/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/lib/libtaos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/lib64/libtaos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/include/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/taos")
+ #print(out)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files in /usr/local/taos:%s" % out)
+ leftFile = True
+ if not leftFile:
+ print("*******Test Result: uninstall test passed ************")
+
+ elif system == "Darwin":
+ # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
+ process = subprocess.Popen(['sudo', 'rmtaos'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ # 向子进程发送输入
+ process.stdin.write("y\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ # 关闭子进程的stdin,防止它无限期等待更多输入
+ process.stdin.close()
+ # 等待子进程结束
+ process.wait()
+ # 检查目录清除情况
+ out = subprocess.getoutput("ls /usr/local/bin/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/lib/libtaos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/include/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ #out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/")
+ #print(out)
+ #if out:
+ # print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out)
+ # leftFile = True
+ #if not leftFile:
+ # print("*******Test Result: uninstall test passed ************")
+
+ elif system == "Windows":
+ process = subprocess.Popen(['unins000','/silent'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ process.wait()
+ time.sleep(10)
+ out = subprocess.getoutput("ls C:\TDengine")
+ print(out)
+ if len(out.split("\n")) > 3:
+ leftFile = True
+ print("Uninstall left some files: %s" % out)
+
+if taosBenchmark_test_result:
+ print("**********Test Result: taosBenchmark test passed! **********")
+if taos_test_result:
+ print("**********Test Result: taos test passed! **********")
+else:
+ print("!!!!!!!!!!!Test Result: taos test failed! !!!!!!!!!!")
+if version_test_result:
+ print("**********Test Result: version test passed! **********")
+else:
+ print("!!!!!!!!!!!Test Result: version test failed! !!!!!!!!!!")
+if not leftFile:
+ print("**********Test Result: uninstall test passed! **********")
+else:
+ print("!!!!!!!!!!!Test Result: uninstall test failed! !!!!!!!!!!")
+if taosBenchmark_test_result and taos_test_result and version_test_result and not leftFile:
+ sys.exit(0)
+else:
+ sys.exit(1)
+
diff --git a/packaging/smokeTest/smokeTestJenkinsFile b/packaging/smokeTest/smokeTestJenkinsFile
new file mode 100644
index 0000000000..464393d85d
--- /dev/null
+++ b/packaging/smokeTest/smokeTestJenkinsFile
@@ -0,0 +1,380 @@
+def sync_source(branch_name) {
+ sh '''
+ hostname
+ ip addr|grep 192|awk '{print $2}'|sed "s/\\/.*//"
+ echo ''' + branch_name + '''
+ '''
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}
+ set +e
+ git reset --hard
+ git fetch || git fetch
+ git checkout -f '''+branch_name+'''
+ git reset --hard origin/'''+branch_name+'''
+ git log | head -n 20
+ git clean -fxd
+ set -e
+ '''
+ return 1
+}
+def sync_source_win() {
+ bat '''
+ hostname
+ taskkill /f /t /im taosd.exe
+ ipconfig
+ set
+ date /t
+ time /t
+ '''
+ bat '''
+ echo %branch_name%
+ cd %WIN_TDENGINE_ROOT_DIR%
+ git reset --hard
+ git fetch || git fetch
+ git checkout -f ''' + env.BRANCH_NAME + '''
+ git reset --hard origin/''' + env.BRANCH_NAME + '''
+ git branch
+ git restore .
+ git remote prune origin
+ git pull || git pull
+ git log | head -n 20
+ git clean -fxd
+ '''
+ return 1
+}
+pipeline {
+ agent none
+ parameters {
+ choice(
+ name: 'sourcePath',
+ choices: ['nas','web'],
+ description: 'Choice which way to download the installation pacakge;web is Office Web and nas means taos nas server '
+ )
+ choice(
+ name: 'verMode',
+ choices: ['enterprise','community'],
+ description: 'Choice which types of package you want do check '
+ )
+ string (
+ name:'version',
+ defaultValue:'3.3.2.0',
+ description: 'Release version number,eg: 3.0.0.1'
+ )
+ string (
+ name:'baseVersion',
+ defaultValue:'smoking',
+ description: 'Tnas root path. eg:smoking, 3.3'
+ )
+ choice (
+ name:'mode',
+ choices: ['server','client'],
+ description: 'Choose which mode of package you want do run '
+ )
+ choice (
+ name:'smoke_branch',
+ choices: ['test/3.0/smokeTest','test/main/smokeTest','test/3.1/smokeTest'],
+ description: 'Choose which mode of package you want do run '
+ )
+ string (
+ name:'runPlatforms',
+ defaultValue:'server_Linux_x64, server_Linux_arm64, server_Windows_x64, server_Mac_x64',
+ description: 'run package list hotfix usually run: server: server_Linux_x64, server_Linux_arm64 client: client_Linux_x64, client_Linux_arm64 release usually run: enterprise server: server_Linux_x64, server_Linux_arm64, server_Windows_x64 enterprise client: client_Linux_x64, client_Linux_arm64, client_Windows_x64 community server: server_Linux_x64, server_Linux_arm64, server_Mac_x64, server_Mac_arm64(not supported), server_Linux_x64_lite(not supported) community client: client_Linux_x64, client_Linux_arm64, client_Windows_x64, client_Mac_x64, client_Mac_arm64(not supported), client_Linux_x64_lite(not supported)'
+ )
+ }
+ environment{
+ WORK_DIR = "/var/lib/jenkins/workspace"
+ TDINTERNAL_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal'
+ TDENGINE_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal/community'
+ BRANCH_NAME = "${smoke_branch}"
+ }
+ stages {
+ stage ('Start Server for Client Test') {
+ when {
+ beforeAgent true
+ expression { mode == 'client' }
+ }
+ agent{label " ubuntu18 "}
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ withEnv(['JENKINS_NODE_COOKIE=dontkillme']) {
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
+ bash start3NodesServer.sh
+ '''
+ }
+ }
+ }
+ }
+ stage ('Run SmokeTest') {
+ parallel {
+ stage('server_Linux_x64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'server' }
+ expression { runPlatforms.contains('server_Linux_x64') }
+ }
+ }
+ agent{label " ubuntu16 "}
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ mkdir -p /var/www/html/${baseVersion}/${version}/${verMode}/json
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
+ python3 -m pytest test_server.py -v --html=/var/www/html/${baseVersion}/${version}/${verMode}/${mode}_linux_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ cp report.json /var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_x64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=linux_x64"
+ '''
+ }
+ }
+ }
+ stage('server_Linux_arm64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'server' }
+ expression { runPlatforms.contains('server_Linux_arm64') }
+ }
+ }
+ agent{label "worker06_arm64"}
+ steps {
+ timeout(time: 60, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
+ python3 -m pytest test_server.py -v --html=${mode}_linux_arm64_report.html --json-report --json-report-file=report.json --timeout=600 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ scp ${mode}_linux_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
+ scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_arm64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=linux_arm64"
+ '''
+ }
+ }
+ }
+ stage ('server_Mac_x64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'server' }
+ expression { runPlatforms.contains('server_Mac_x64') }
+ }
+ }
+ agent{label " release_Darwin_x64 "}
+ environment{
+ WORK_DIR = "/Users/zwen/jenkins/workspace"
+ TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
+ TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
+ }
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
+ python3 -m pytest -v -k linux --html=${mode}_Mac_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ scp ${mode}_Mac_x64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
+ scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_x64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=Mac_x64"
+ '''
+ }
+ }
+ }
+ stage ('server_Mac_arm64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'server' }
+ expression { runPlatforms.contains('server_Mac_arm64') }
+ }
+ }
+ agent{label " release_Darwin_arm64 "}
+ environment{
+ WORK_DIR = "/Users/zwen/jenkins/workspace"
+ TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
+ TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
+ }
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
+ python3 -m pytest -v -k linux --html=${mode}_Mac_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ scp ${mode}_Mac_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
+ scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_arm64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=Mac_arm64"
+ '''
+ }
+ }
+ }
+ stage('server_Windows_x64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'server' }
+ expression { runPlatforms.contains('server_Windows_x64') }
+ }
+ }
+ agent{label " windows11 "}
+ environment{
+ WIN_WORK_DIR="C:\\workspace"
+ WIN_TDINTERNAL_ROOT_DIR="C:\\workspace\\TDinternal"
+ WIN_TDENGINE_ROOT_DIR="C:\\workspace\\TDinternal\\community"
+ }
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source_win()
+ bat '''
+ cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest
+ call getAndRunInstaller.bat %baseVersion% %version% %verMode% server
+ cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest
+ pip3 install -r pytest_require.txt
+ python3 -m pytest test_server.py -v --html=%mode%_Windows_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=%verMode% --tVersion=%version% --baseVersion=%baseVersion% --sourcePath=%sourcePath%
+ scp %mode%_Windows_x64_report.html root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/
+ scp report.json root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/json/%mode%_Windows_x64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=%version%&tag=%baseVersion%&type=%verMode%&role=server&build=Windows_x64"
+ '''
+ }
+ }
+ }
+ stage('client_Linux_x64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'client' }
+ expression { runPlatforms.contains('client_Linux_x64') }
+ }
+ }
+ agent{label " ubuntu16 "}
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ mkdir -p /var/www/html/${baseVersion}/${version}/${verMode}/json
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
+ python3 -m pytest test_client.py -v --html=/var/www/html/${baseVersion}/${version}/${verMode}/${mode}_linux_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ cp report.json /var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_x64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=linux_x64"
+ '''
+ }
+ }
+ }
+ stage('client_Linux_arm64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'client' }
+ expression { runPlatforms.contains('client_Linux_arm64') }
+ }
+ }
+ agent{label " worker06_arm64 "}
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
+ python3 -m pytest test_client.py -v --html=${mode}_linux_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ scp ${mode}_linux_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
+ scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_arm64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=linux_arm64"
+ '''
+ }
+ }
+ }
+ stage ('client_Mac_x64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'client' }
+ expression { runPlatforms.contains('client_Mac_x64') }
+ }
+ }
+ agent{label " release_Darwin_x64 "}
+ environment{
+ WORK_DIR = "/Users/zwen/jenkins/workspace"
+ TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
+ TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
+ }
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
+ rm -rf /opt/taos/main/TDinternal/debug/* || true
+ python3 -m pytest test_client.py -v --html=${mode}_Mac_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ scp ${mode}_Mac_x64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
+ scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_x64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=Mac_x64"
+ '''
+ }
+ }
+ }
+ stage ('client_Mac_arm64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'client' }
+ expression { runPlatforms.contains('client_Mac_arm64') }
+ }
+ }
+ agent{label " release_Darwin_arm64 "}
+ environment{
+ WORK_DIR = "/Users/zwen/jenkins/workspace"
+ TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
+ TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
+ }
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source("${BRANCH_NAME}")
+ sh '''
+ cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
+ bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
+ rm -rf /opt/taos/main/TDinternal/debug/* || true
+ python3 -m pytest test_client.py -v --html=${mode}_Mac_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
+ scp ${mode}_Mac_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
+ scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_arm64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=Mac_arm64"
+ '''
+ }
+ }
+ }
+ stage('client_Windows_x64') {
+ when {
+ beforeAgent true
+ allOf {
+ expression { mode == 'client' }
+ expression { runPlatforms.contains('client_Windows_x64') }
+ }
+ }
+ agent{label " windows71 "}
+ environment{
+ WIN_WORK_DIR="C:\\workspace"
+ WIN_TDINTERNAL_ROOT_DIR="C:\\workspace\\TDinternal"
+ WIN_TDENGINE_ROOT_DIR="C:\\workspace\\TDinternal\\community"
+ }
+ steps {
+ timeout(time: 30, unit: 'MINUTES'){
+ sync_source_win()
+ bat '''
+ cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest
+ call getAndRunInstaller.bat %baseVersion% %version% %verMode% client
+ pip3 install -r pytest_require.txt
+ python3 -m pytest test_client.py -v --html=%mode%_Windows_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=%verMode% --tVersion=%version% --baseVersion=%baseVersion% --sourcePath=%sourcePath%
+ scp %mode%_Windows_x64_report.html root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/
+ scp report.json root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/json/%mode%_Windows_x64_report.json
+ curl "http://192.168.0.176/api/addSmoke?version=%version%&tag=%baseVersion%&type=%verMode%&role=client&build=Windows_x64"
+ '''
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/packaging/smokeTest/start3NodesServer.sh b/packaging/smokeTest/start3NodesServer.sh
new file mode 100644
index 0000000000..b446a467ef
--- /dev/null
+++ b/packaging/smokeTest/start3NodesServer.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+BUILD_ID=dontKillMe
+
+#******This script setup 3 nodes env for remote client installer test. Only for Linux *********
+
+pwd=`pwd`
+hostname=`hostname`
+if [ -z $JENKINS_HOME ]; then
+ workdir="${pwd}/cluster"
+ echo $workdir
+else
+ workdir="${JENKINS_HOME}/workspace/cluster"
+ echo $workdir
+fi
+
+name="taos"
+if command -v prodb ;then
+ name="prodb"
+fi
+
+# Stop all taosd processes
+for(( i=0; i<3; i++))
+do
+ pid=$(ps -ef | grep ${name}d | grep -v grep | awk '{print $2}')
+ if [ -n "$pid" ]; then
+ ${csudo}kill -9 $pid || :
+ fi
+done
+
+# Init 3 dnodes workdir and config file
+rm -rf ${workdir}
+mkdir ${workdir}
+mkdir ${workdir}/output
+mkdir ${workdir}/dnode1
+mkdir ${workdir}/dnode1/data
+mkdir ${workdir}/dnode1/log
+mkdir ${workdir}/dnode1/cfg
+touch ${workdir}/dnode1/cfg/${name}.cfg
+echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6031\nlogDir ${workdir}/dnode1/log\ndataDir ${workdir}/dnode1/data\n" >> ${workdir}/dnode1/cfg/${name}.cfg
+
+# Start first node
+nohup ${name}d -c ${workdir}/dnode1/cfg/${name}.cfg & > /dev/null
+sleep 5
+
+${name} -P 6031 -s "CREATE DNODE \`${hostname}:6032\`;CREATE DNODE \`${hostname}:6033\`"
+
+mkdir ${workdir}/dnode2
+mkdir ${workdir}/dnode2/data
+mkdir ${workdir}/dnode2/log
+mkdir ${workdir}/dnode2/cfg
+touch ${workdir}/dnode2/cfg/${name}.cfg
+echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6032\nlogDir ${workdir}/dnode2/log\ndataDir ${workdir}/dnode2/data\n" >> ${workdir}/dnode2/cfg/${name}.cfg
+
+nohup ${name}d -c ${workdir}/dnode2/cfg/${name}.cfg & > /dev/null
+sleep 5
+
+mkdir ${workdir}/dnode3
+mkdir ${workdir}/dnode3/data
+mkdir ${workdir}/dnode3/log
+mkdir ${workdir}/dnode3/cfg
+touch ${workdir}/dnode3/cfg/${name}.cfg
+echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6033\nlogDir ${workdir}/dnode3/log\ndataDir ${workdir}/dnode3/data\n" >> ${workdir}/dnode3/cfg/${name}.cfg
+
+nohup ${name}d -c ${workdir}/dnode3/cfg/${name}.cfg & > /dev/null
+sleep 5
+
+${name} -P 6031 -s "CREATE MNODE ON DNODE 2;CREATE MNODE ON DNODE 3;"
\ No newline at end of file
diff --git a/packaging/smokeTest/test_client.py b/packaging/smokeTest/test_client.py
new file mode 100644
index 0000000000..0b1003e370
--- /dev/null
+++ b/packaging/smokeTest/test_client.py
@@ -0,0 +1,137 @@
+import pytest
+import subprocess
+import os
+import sys
+import platform
+import getopt
+import re
+import time
+import taos
+from versionCheckAndUninstallforPytest import UninstallTaos
+
+# python3 smokeTestClient.py -h 192.168.0.22 -P 6031 -v ${version} -u
+
+OEM = ["ProDB"]
+
+
+@pytest.fixture(scope="module")
+def get_config(request):
+ verMode = request.config.getoption("--verMode")
+ taosVersion = request.config.getoption("--tVersion")
+ baseVersion = request.config.getoption("--baseVersion")
+ sourcePath = request.config.getoption("--sourcePath")
+ config = {
+ "verMode": verMode,
+ "taosVersion": taosVersion,
+ "baseVersion": baseVersion,
+ "sourcePath": sourcePath,
+ "system": platform.system(),
+ "arch": platform.machine(),
+ "serverHost": "192.168.0.22",
+ "serverPort": 6031,
+ "databaseName": re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
+ }
+ return config
+
+
+@pytest.fixture(scope="module")
+def setup_module(get_config):
+ config = get_config
+ # install taospy
+ if config["system"] == 'Windows':
+ taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
+ else:
+ taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
+
+ print("taospy version %s " % taospy_version)
+ if taospy_version == "":
+ subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
+ print("install taos python connector")
+ else:
+ subprocess.getoutput("pip3 install taospy")
+
+
+def get_connect(host, port, database=None):
+ conn = taos.connect(host=host,
+ user="root",
+ password="taosdata",
+ database=database,
+ port=port,
+ timezone="Asia/Shanghai") # default your host's timezone
+ return conn
+
+
+def run_cmd(command):
+ print("CMD: %s" % command)
+ result = subprocess.run(command, capture_output=True, text=True, shell=True)
+ print("STDOUT:", result.stdout)
+ print("STDERR:", result.stderr)
+ print("Return Code:", result.returncode)
+ assert result.returncode == 0
+ return result
+
+
+class TestClient:
+ @pytest.mark.all
+ def test_basic(self, get_config, setup_module):
+ config = get_config
+ name = "taos"
+
+ if config["baseVersion"] in OEM:
+ name = config["baseVersion"].lower()
+ if config["baseVersion"] in OEM and config["system"] == 'Windows':
+ cmd = f'{name} -s "create database {config["databaseName"]};" -h {config["serverHost"]} -P {config["serverPort"]}'
+ run_cmd(cmd)
+ cmd = f'{name} -s "CREATE STABLE {config["databaseName"]}.meters (`ts` TIMESTAMP,`current` FLOAT, `phase` FLOAT) TAGS (`groupid` INT, `location` VARCHAR(24));" -h {config["serverHost"]} -P {config["serverPort"]}'
+ run_cmd(cmd)
+ else:
+ cmd = f'{name}Benchmark -y -a 3 -n 100 -t 100 -d {config["databaseName"]} -h {config["serverHost"]} -P {config["serverPort"]} &'
+ run_cmd(cmd)
+ # os.system("taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d" % (databaseName, serverHost, serverPort))
+ time.sleep(5)
+ conn = get_connect(config["serverHost"], config["serverPort"], config["databaseName"])
+ sql = "SELECT count(*) from meters"
+ result: taos.TaosResult = conn.query(sql)
+ data = result.fetch_all()
+ print("SQL: %s" % sql)
+ print("Result: %s" % data)
+ if config["system"] == 'Windows' and config["baseVersion"] in OEM:
+ pass
+ elif data[0][0] != 10000:
+ raise f"{name}Benchmark work not as expected "
+ # drop database of test
+ cmd = f'{name} -s "drop database {config["databaseName"]};" -h {config["serverHost"]} -P {config["serverPort"]}'
+ result = run_cmd(cmd)
+ assert "Drop OK" in result.stdout
+ conn.close()
+
+ @pytest.mark.all
+ def test_version(self, get_config, setup_module):
+ config = get_config
+ conn = get_connect(config["serverHost"], config["serverPort"])
+ server_version = conn.server_info
+ print("server_version: ", server_version)
+ client_version = conn.client_info
+ print("client_version: ", client_version)
+ name = "taos"
+ if config["baseVersion"] in OEM:
+ name = config["baseVersion"].lower()
+ if config["system"] == "Windows":
+ taos_V_output = subprocess.getoutput(f"{name} -V | findstr version")
+ else:
+ taos_V_output = subprocess.getoutput(f"{name} -V | grep version")
+ assert config["taosVersion"] in taos_V_output
+ assert config["taosVersion"] in client_version
+ if config["taosVersion"] not in server_version:
+ print("warning: client version is not same as server version")
+ conn.close()
+
+ @pytest.mark.all
+ def test_uninstall(self, get_config, setup_module):
+ config = get_config
+ name = "taos"
+ if config["baseVersion"] in OEM:
+ name = config["baseVersion"].lower()
+ subprocess.getoutput("rm /usr/local/bin/taos")
+ subprocess.getoutput("pkill taosd")
+ UninstallTaos(config["taosVersion"], config["verMode"], True, name)
diff --git a/packaging/smokeTest/test_server.py b/packaging/smokeTest/test_server.py
new file mode 100644
index 0000000000..04231f122f
--- /dev/null
+++ b/packaging/smokeTest/test_server.py
@@ -0,0 +1,240 @@
+import pytest
+import subprocess
+import os
+from versionCheckAndUninstallforPytest import UninstallTaos
+import platform
+import re
+import time
+import signal
+
+system = platform.system()
+current_path = os.path.abspath(os.path.dirname(__file__))
+if system == 'Windows':
+ with open(r"%s\test_server_windows_case" % current_path) as f:
+ cases = f.read().splitlines()
+else:
+ with open("%s/test_server_unix_case" % current_path) as f:
+ cases = f.read().splitlines()
+
+OEM = ["ProDB"]
+
+
+@pytest.fixture(scope="module")
+def get_config(request):
+ verMode = request.config.getoption("--verMode")
+ taosVersion = request.config.getoption("--tVersion")
+ baseVersion = request.config.getoption("--baseVersion")
+ sourcePath = request.config.getoption("--sourcePath")
+ config = {
+ "verMode": verMode,
+ "taosVersion": taosVersion,
+ "baseVersion": baseVersion,
+ "sourcePath": sourcePath,
+ "system": platform.system(),
+ "arch": platform.machine()
+ }
+ return config
+
+
+@pytest.fixture(scope="module")
+def setup_module(get_config):
+ def run_cmd(command):
+ print("CMD:", command)
+ result = subprocess.run(command, capture_output=True, text=True, shell=True)
+ print("STDOUT:", result.stdout)
+ print("STDERR:", result.stderr)
+ print("Return Code:", result.returncode)
+ assert result.returncode == 0
+ return result
+
+ # setup before module tests
+ config = get_config
+ # bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
+ # t = "tar"
+ # if config["system"] == "Darwin":
+ # t = "pkg"
+ # cmd = "bash getAndRunInstaller.sh -m %s -f server -l false -c x64 -v %s -o %s -s %s -t %s" % (
+ # config["verMode"], config["taosVersion"], config["baseVersion"], config["sourcePath"], t)
+ # run_cmd(cmd)
+ if config["system"] == "Windows":
+ cmd = r"mkdir ..\..\debug\build\bin"
+ else:
+ cmd = "mkdir -p ../../debug/build/bin/"
+ subprocess.getoutput(cmd)
+ if config["system"] == "Linux" or config["system"] == "Darwin" : # add tmq_sim
+ cmd = "cp -rf ../../../debug/build/bin/tmq_sim ../../debug/build/bin/."
+ subprocess.getoutput(cmd)
+ if config["system"] == "Darwin":
+ cmd = "sudo cp -rf /usr/local/bin/taos* ../../debug/build/bin/"
+ elif config["system"] == "Windows":
+ cmd = r"xcopy C:\TDengine\taos*.exe ..\..\debug\build\bin /Y"
+ else:
+ if config["baseVersion"] in OEM:
+ cmd = '''sudo find /usr/bin -name 'prodb*' -exec sh -c 'for file; do cp "$file" "../../debug/build/bin/taos${file##/usr/bin/%s}"; done' sh {} +''' % (
+ config["baseVersion"].lower())
+ else:
+ cmd = "sudo cp /usr/bin/taos* ../../debug/build/bin/"
+ run_cmd(cmd)
+ if config["baseVersion"] in OEM: # mock OEM
+ cmd = "sed -i 's/taos.cfg/%s.cfg/g' ../../tests/pytest/util/dnodes.py" % config["baseVersion"].lower()
+ run_cmd(cmd)
+ cmd = "sed -i 's/taosdlog.0/%sdlog.0/g' ../../tests/pytest/util/dnodes.py" % config["baseVersion"].lower()
+ run_cmd(cmd)
+ cmd = "sed -i 's/taos.cfg/%s.cfg/g' ../../tests/army/frame/server/dnode.py" % config["baseVersion"].lower()
+ run_cmd(cmd)
+ cmd = "sed -i 's/taosdlog.0/%sdlog.0/g' ../../tests/army/frame/server/dnode.py" % config["baseVersion"].lower()
+ run_cmd(cmd)
+ cmd = "ln -s /usr/bin/prodb /usr/local/bin/taos"
+ subprocess.getoutput(cmd)
+
+ # yield
+ #
+ # name = "taos"
+ # if config["baseVersion"] in OEM:
+ # name = config["baseVersion"].lower()
+ # subprocess.getoutput("rm /usr/local/bin/taos")
+ # subprocess.getoutput("pkill taosd")
+ # UninstallTaos(config["taosVersion"], config["verMode"], True, name)
+
+
+# use pytest fixture to exec case
+@pytest.fixture(params=cases)
+def run_command(request):
+ commands = request.param
+ if commands.strip().startswith("#"):
+ pytest.skip("This case has been marked as skipped")
+ d, command = commands.strip().split(",")
+ if system == "Windows":
+ cmd = r"cd %s\..\..\tests\%s && %s" % (current_path, d, command)
+ else:
+ cmd = "cd %s/../../tests/%s&&sudo %s" % (current_path, d, command)
+ print(cmd)
+ result = subprocess.run(cmd, capture_output=True, text=True, shell=True)
+ return {
+ "command": command,
+ "stdout": result.stdout,
+ "stderr": result.stderr,
+ "returncode": result.returncode
+ }
+
+
+class TestServer:
+ @pytest.mark.all
+ def test_taosd_up(self, setup_module):
+ # start process
+ if system == 'Windows':
+ subprocess.getoutput("taskkill /IM taosd.exe /F")
+ cmd = "..\\..\\debug\\build\\bin\\taosd.exe"
+ else:
+ subprocess.getoutput("pkill taosd")
+ cmd = "../../debug/build/bin/taosd"
+ process = subprocess.Popen(
+ [cmd],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ text=True
+ )
+ # monitor output
+ while True:
+ line = process.stdout.readline()
+ if line:
+ print(line.strip())
+ if "succeed to write dnode" in line:
+ time.sleep(5)
+ # 发送终止信号
+ os.kill(process.pid, signal.SIGKILL)
+ # Waiting for the process to be completely killed
+ time.sleep(5)
+ break
+
+ @pytest.mark.all
+ def test_execute_cases(self, setup_module, run_command):
+ # assert the result
+ if run_command['returncode'] != 0:
+ print(f"Running command: {run_command['command']}")
+ print("STDOUT:", run_command['stdout'])
+ print("STDERR:", run_command['stderr'])
+ print("Return Code:", run_command['returncode'])
+ else:
+ print(f"Running command: {run_command['command']}")
+ if len(run_command['stdout']) > 1000:
+ print("STDOUT:", run_command['stdout'][:1000] + "...")
+ else:
+ print("STDOUT:", run_command['stdout'])
+ print("STDERR:", run_command['stderr'])
+ print("Return Code:", run_command['returncode'])
+
+ assert run_command[
+ 'returncode'] == 0, f"Command '{run_command['command']}' failed with return code {run_command['returncode']}"
+
+ @pytest.mark.all
+ @pytest.mark.check_version
+ def test_check_version(self, get_config, setup_module):
+ config = get_config
+ databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
+ # install taospy
+ taospy_version = ""
+ system = config["system"]
+ version = config["taosVersion"]
+ verMode = config["verMode"]
+ if system == 'Windows':
+ taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
+ else:
+ taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
+
+ print("taospy version %s " % taospy_version)
+ if taospy_version == "":
+ subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
+ print("install taos python connector")
+ else:
+ subprocess.getoutput("pip3 install taospy")
+
+ # start taosd server
+ if system == 'Windows':
+ cmd = ["C:\\TDengine\\start-all.bat"]
+ # elif system == 'Linux':
+ # cmd = "systemctl start taosd".split(' ')
+ else:
+ # cmd = "sudo launchctl start com.tdengine.taosd".split(' ')
+ cmd = "start-all.sh"
+ process_out = subprocess.Popen(cmd,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ print(cmd)
+ time.sleep(5)
+
+ import taos
+ conn = taos.connect()
+ check_list = {}
+ check_list["server_version"] = conn.server_info
+ check_list["client_version"] = conn.client_info
+ # Execute sql get version info
+ result: taos.TaosResult = conn.query("SELECT server_version()")
+ check_list["select_server"] = result.fetch_all()[0][0]
+ result: taos.TaosResult = conn.query("SELECT client_version()")
+ check_list["select_client"] = result.fetch_all()[0][0]
+ conn.close()
+
+ binary_files = ["taos", "taosd", "taosadapter", "taoskeeper", "taosBenchmark"]
+ if verMode.lower() == "enterprise":
+ binary_files.append("taosx")
+ if config["baseVersion"] in OEM:
+ binary_files = [i.replace("taos", config["baseVersion"].lower()) for i in binary_files]
+ if system == "Windows":
+ for i in binary_files:
+ check_list[i] = subprocess.getoutput("%s -V | findstr version" % i)
+ else:
+ for i in binary_files:
+ check_list[i] = subprocess.getoutput("%s -V | grep version | awk -F ' ' '{print $3}'" % i)
+ for i in check_list:
+ print("%s version is: %s" % (i, check_list[i]))
+ assert version in check_list[i]
+
+ @pytest.mark.all
+ def test_uninstall(self, get_config, setup_module):
+ config = get_config
+ name = "taos"
+ if config["baseVersion"] in OEM:
+ name = config["baseVersion"].lower()
+ subprocess.getoutput("rm /usr/local/bin/taos")
+ subprocess.getoutput("pkill taosd")
+ UninstallTaos(config["taosVersion"], config["verMode"], True, name)
diff --git a/packaging/smokeTest/test_server_unix_case b/packaging/smokeTest/test_server_unix_case
new file mode 100644
index 0000000000..1bbde10932
--- /dev/null
+++ b/packaging/smokeTest/test_server_unix_case
@@ -0,0 +1,10 @@
+system-test,python3 ./test.py -f 2-query/join.py
+system-test,python3 ./test.py -f 1-insert/insert_column_value.py
+system-test,python3 ./test.py -f 2-query/primary_ts_base_5.py
+system-test,python3 ./test.py -f 2-query/case_when.py
+system-test,python3 ./test.py -f 2-query/partition_limit_interval.py
+system-test,python3 ./test.py -f 2-query/fill.py
+army,python3 ./test.py -f query/query_basic.py -N 3
+system-test,python3 ./test.py -f 7-tmq/basic5.py
+system-test,python3 ./test.py -f 8-stream/stream_basic.py
+system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3
\ No newline at end of file
diff --git a/packaging/smokeTest/test_server_windows_case b/packaging/smokeTest/test_server_windows_case
new file mode 100644
index 0000000000..e64213b1ee
--- /dev/null
+++ b/packaging/smokeTest/test_server_windows_case
@@ -0,0 +1,2 @@
+system-test,python3 .\test.py -f 0-others\taosShell.py
+system-test,python3 .\test.py -f 6-cluster\5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3
\ No newline at end of file
diff --git a/packaging/smokeTest/versionCheckAndUninstall.py b/packaging/smokeTest/versionCheckAndUninstall.py
new file mode 100644
index 0000000000..80dea9a15f
--- /dev/null
+++ b/packaging/smokeTest/versionCheckAndUninstall.py
@@ -0,0 +1,260 @@
+#!/usr/bin/python
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+# install pip
+# pip install src/connector/python/
+
+# -*- coding: utf-8 -*-
+import sys, os
+import re
+import platform
+import getopt
+import subprocess
+# from this import d
+import time
+
+# input for server
+
+opts, args = getopt.gnu_getopt(sys.argv[1:], 'v:m:u', ['version=', 'verMode='])
+serverHost = ""
+serverPort = 0
+version = ""
+uninstall = False
+verMode = ""
+for key, value in opts:
+ if key in ['--help']:
+ print('A collection of test cases written using Python')
+ print('-v test client version')
+ print('-u test uninstall process, will uninstall TDengine')
+ sys.exit(0)
+
+ if key in ['-v']:
+ version = value
+ if key in ['-u']:
+ uninstall = True
+ if key in ['-m']:
+ verMode = value
+if not version:
+ print("No version specified, will not run version check.")
+
+
+system = platform.system()
+arch = platform.machine()
+
+databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
+# install taospy
+taospy_version = ""
+if system == 'Windows':
+ taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
+else:
+ taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
+
+print("taospy version %s " % taospy_version)
+if taospy_version == "":
+ subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
+ print("install taos python connector")
+else:
+ subprocess.getoutput("pip3 install taospy")
+
+# start taosd server
+if system == 'Windows':
+ cmd = ["C:\\TDengine\\start-all.bat"]
+elif system == 'Linux':
+ cmd = "systemctl start taosd".split(' ')
+else:
+ cmd = "sudo launchctl start com.tdengine.taosd".split(' ')
+process_out = subprocess.Popen(cmd,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+print(cmd)
+time.sleep(5)
+
+#get taosc version info
+version_test_result = False
+if version:
+ import taos
+ conn = taos.connect()
+ server_version = conn.server_info
+ print("server_version", server_version)
+ client_version = conn.client_info
+ print("client_version", client_version)
+ # Execute sql get version info
+ result: taos.TaosResult = conn.query("SELECT server_version()")
+ select_server = result.fetch_all()[0][0]
+ print("SELECT server_version():" + select_server)
+ result: taos.TaosResult = conn.query("SELECT client_version()")
+ select_client = result.fetch_all()[0][0]
+ print("SELECT client_version():" + select_client)
+ conn.close()
+
+ taos_V_output = ""
+ taosd_V_output = ""
+ taosadapter_V_output = ""
+ taoskeeper_V_output = ""
+ taosx_V_output = ""
+ taosB_V_output = ""
+ taosxVersion = False
+ if system == "Windows":
+ taos_V_output = subprocess.getoutput("taos -V | findstr version")
+ taosd_V_output = subprocess.getoutput("taosd -V | findstr version")
+ taosadapter_V_output = subprocess.getoutput("taosadapter -V | findstr version")
+ taoskeeper_V_output = subprocess.getoutput("taoskeeper -V | findstr version")
+ taosB_V_output = subprocess.getoutput("taosBenchmark -V | findstr version")
+ if verMode == "Enterprise":
+ taosx_V_output = subprocess.getoutput("taosx -V | findstr version")
+ else:
+ taos_V_output = subprocess.getoutput("taos -V | grep version | awk -F ' ' '{print $3}'")
+ taosd_V_output = subprocess.getoutput("taosd -V | grep version | awk -F ' ' '{print $3}'")
+ taosadapter_V_output = subprocess.getoutput("taosadapter -V | grep version | awk -F ' ' '{print $3}'")
+ taoskeeper_V_output = subprocess.getoutput("taoskeeper -V | grep version | awk -F ' ' '{print $3}'")
+ taosB_V_output = subprocess.getoutput("taosBenchmark -V | grep version | awk -F ' ' '{print $3}'")
+ if verMode == "Enterprise":
+ taosx_V_output = subprocess.getoutput("taosx -V | grep version | awk -F ' ' '{print $3}'")
+
+ print("taos -V output is: %s" % taos_V_output)
+ print("taosd -V output is: %s" % taosd_V_output)
+ print("taosadapter -V output is: %s" % taosadapter_V_output)
+ print("taoskeeper -V output is: %s" % taoskeeper_V_output)
+ print("taosBenchmark -V output is: %s" % taosB_V_output)
+ if verMode == "Enterprise":
+ print("taosx -V output is: %s" % taosx_V_output)
+ taosxVersion = version in taosx_V_output
+ else:
+ taosxVersion = True
+ if (version in client_version
+ and version in server_version
+ and version in select_server
+ and version in select_client
+ and version in taos_V_output
+ and version in taosd_V_output
+ and version in taosadapter_V_output
+ and version in taoskeeper_V_output
+ and version in taosB_V_output
+ and taosxVersion
+ ):
+ version_test_result = True
+leftFile = False
+if uninstall:
+ print("Start to run rmtaos")
+ print("Platform: ", system)
+ # stop taosd server
+ if system == 'Windows':
+ cmd = "C:\\TDengine\\stop_all.bat"
+ elif system == 'Linux':
+ cmd = "systemctl stop taosd"
+ else:
+ cmd = "sudo launchctl stop com.tdengine.taosd"
+ process_out = subprocess.getoutput(cmd)
+ print(cmd)
+ time.sleep(10)
+ if system == "Linux":
+ # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
+ process = subprocess.Popen(['rmtaos'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ # 向子进程发送输入
+ process.stdin.write("y\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ # 关闭子进程的stdin,防止它无限期等待更多输入
+ process.stdin.close()
+ # 等待子进程结束
+ process.wait()
+ # 检查目录清除情况
+ out = subprocess.getoutput("ls /etc/systemd/system/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/bin/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/bin/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/lib/libtaos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/lib64/libtaos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/include/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/taos")
+ #print(out)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files in /usr/local/taos:%s" % out)
+ leftFile = True
+ if not leftFile:
+ print("*******Test Result: uninstall test passed ************")
+
+ elif system == "Darwin":
+ # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
+ process = subprocess.Popen(['sudo', 'rmtaos'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ # 向子进程发送输入
+ process.stdin.write("y\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ # 关闭子进程的stdin,防止它无限期等待更多输入
+ process.stdin.close()
+ # 等待子进程结束
+ process.wait()
+ # 检查目录清除情况
+ out = subprocess.getoutput("ls /usr/local/bin/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/lib/libtaos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/include/taos*")
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ #out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/")
+ #print(out)
+ #if out:
+ # print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out)
+ # leftFile = True
+ #if not leftFile:
+ # print("*******Test Result: uninstall test passed ************")
+
+ elif system == "Windows":
+ process = subprocess.Popen(['unins000','/silent'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ process.wait()
+ time.sleep(10)
+ out = subprocess.getoutput("ls C:\TDengine")
+ print(out)
+ if len(out.split("\n")) > 3:
+ leftFile = True
+ print("Uninstall left some files: %s" % out)
+
+if version_test_result:
+ print("**********Test Result: version test passed! **********")
+else:
+ print("!!!!!!!!!!!Test Result: version test failed! !!!!!!!!!!")
+if not leftFile:
+ print("**********Test Result: uninstall test passed! **********")
+else:
+ print("!!!!!!!!!!!Test Result: uninstall test failed! !!!!!!!!!!")
+if version_test_result and not leftFile:
+ sys.exit(0)
+else:
+ sys.exit(1)
+
diff --git a/packaging/smokeTest/versionCheckAndUninstallforPytest.py b/packaging/smokeTest/versionCheckAndUninstallforPytest.py
new file mode 100644
index 0000000000..5b75219554
--- /dev/null
+++ b/packaging/smokeTest/versionCheckAndUninstallforPytest.py
@@ -0,0 +1,137 @@
+#!/usr/bin/python
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+# install pip
+# pip install src/connector/python/
+
+# -*- coding: utf-8 -*-
+import sys, os
+import re
+import platform
+import getopt
+import subprocess
+# from this import d
+import time
+from lib import run_cmd
+
+
+# input for server
+def UninstallTaos(version, verMode, uninstall, name):
+ if not version:
+ raise "No version specified, will not run version check."
+
+ system = platform.system()
+ arch = platform.machine()
+ leftFile = False
+ if uninstall:
+ print("Start to run rm%s" % name)
+ print("Platform: ", system)
+ # stop taosd server
+ if system == 'Windows':
+ cmd = "C:\\TDengine\\stop_all.bat"
+ else:
+ cmd = "stop_all.sh"
+ process_out = subprocess.getoutput(cmd)
+ print(cmd)
+ time.sleep(5)
+ print("start to rm%s" % name)
+ if system == "Linux":
+ # 启动命令
+ process = subprocess.Popen(['rm%s' % name], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, text=True)
+
+ # 发送交互输入
+ stdout, stderr = process.communicate(
+ input="y\nI confirm that I would like to delete all data, log and configuration files\n")
+
+ # 打印输出(可选)
+ print(stdout)
+ print(stderr)
+ # 检查目录清除情况
+ out = subprocess.getoutput("ls /etc/systemd/system/%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/bin/%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/bin/%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/lib/lib%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/lib64/lib%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/include/%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/%s" % name)
+ # print(out)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files in /usr/local/%s:%s" % (name, out))
+ leftFile = True
+ if not leftFile:
+ print("*******Test Result: uninstall test passed ************")
+
+ elif system == "Darwin":
+ # 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
+ process = subprocess.Popen(['sudo', 'rm%s' % name],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ # 向子进程发送输入
+ process.stdin.write("y\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
+ process.stdin.flush() # 确保输入被发送到子进程
+ # 关闭子进程的stdin,防止它无限期等待更多输入
+ process.stdin.close()
+ # 等待子进程结束
+ process.wait()
+ # 检查目录清除情况
+ out = subprocess.getoutput("ls /usr/local/bin/%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/lib/lib%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ out = subprocess.getoutput("ls /usr/local/include/%s*" % name)
+ if "No such file or directory" not in out:
+ print("Uninstall left some files: %s" % out)
+ leftFile = True
+ # out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/")
+ # print(out)
+ # if out:
+ # print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out)
+ # leftFile = True
+ # if not leftFile:
+ # print("*******Test Result: uninstall test passed ************")
+
+ elif system == "Windows":
+ process = subprocess.Popen(['unins000', '/silent'],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
+ process.wait()
+ time.sleep(10)
+ for file in ["C:\TDengine\\taos.exe", "C:\TDengine\\unins000.exe", "C:\ProDB\prodb.exe",
+ "C:\ProDB\\unins000.exe"]:
+ if os.path.exists(file):
+ leftFile = True
+ if leftFile:
+ raise "uninstall %s fail, please check" % name
+ else:
+ print("**********Test Result: uninstall test passed! **********")
diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh
index 1b8fa2fb70..0874433e94 100755
--- a/packaging/tools/make_install.sh
+++ b/packaging/tools/make_install.sh
@@ -145,7 +145,14 @@ function kill_taosd() {
function install_main_path() {
#create install main dir and all sub dir
- ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}rm -rf ${install_main_dir}/cfg || :
+ ${csudo}rm -rf ${install_main_dir}/bin || :
+ ${csudo}rm -rf ${install_main_dir}/driver || :
+ ${csudo}rm -rf ${install_main_dir}/examples || :
+ ${csudo}rm -rf ${install_main_dir}/include || :
+ ${csudo}rm -rf ${install_main_dir}/share || :
+ ${csudo}rm -rf ${install_main_dir}/log || :
+
${csudo}mkdir -p ${install_main_dir}
${csudo}mkdir -p ${install_main_dir}/cfg
${csudo}mkdir -p ${install_main_dir}/bin
diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt
index 6d5f006517..2113aa7921 100644
--- a/source/client/CMakeLists.txt
+++ b/source/client/CMakeLists.txt
@@ -5,24 +5,24 @@ if(TD_ENTERPRISE)
endif()
if(TD_WINDOWS)
- add_library(taos SHARED ${CLIENT_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/taos.rc.in)
+ add_library(${TAOS_LIB} SHARED ${CLIENT_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/taos.rc.in)
else()
- add_library(taos SHARED ${CLIENT_SRC})
+ add_library(${TAOS_LIB} SHARED ${CLIENT_SRC})
endif()
if(${TD_DARWIN})
- target_compile_options(taos PRIVATE -Wno-error=deprecated-non-prototype)
+ target_compile_options(${TAOS_LIB} PRIVATE -Wno-error=deprecated-non-prototype)
endif()
INCLUDE_DIRECTORIES(jni)
target_include_directories(
- taos
+ ${TAOS_LIB}
PUBLIC "${TD_SOURCE_DIR}/include/client"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
- taos
+ ${TAOS_LIB}
INTERFACE api
PRIVATE os util common transport monitor nodes parser command planner catalog scheduler function qcom geometry
)
@@ -36,32 +36,32 @@ else()
endif()
set_target_properties(
- taos
+ ${TAOS_LIB}
PROPERTIES
CLEAN_DIRECT_OUTPUT
1
)
set_target_properties(
- taos
+ ${TAOS_LIB}
PROPERTIES
VERSION ${TD_VER_NUMBER}
SOVERSION 1
)
-add_library(taos_static STATIC ${CLIENT_SRC})
+add_library(${TAOS_LIB_STATIC} STATIC ${CLIENT_SRC})
if(${TD_DARWIN})
- target_compile_options(taos_static PRIVATE -Wno-error=deprecated-non-prototype)
+ target_compile_options(${TAOS_LIB_STATIC} PRIVATE -Wno-error=deprecated-non-prototype)
endif()
target_include_directories(
- taos_static
+ ${TAOS_LIB_STATIC}
PUBLIC "${TD_SOURCE_DIR}/include/client"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
- taos_static
+ ${TAOS_LIB_STATIC}
INTERFACE api
PRIVATE os util common transport monitor nodes parser command planner catalog scheduler function qcom geometry
)
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 90505ed25a..da56dcf75e 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -47,10 +47,11 @@ enum {
RES_TYPE__TMQ_BATCH_META,
};
-#define SHOW_VARIABLES_RESULT_COLS 3
+#define SHOW_VARIABLES_RESULT_COLS 4
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE)
+#define SHOW_VARIABLES_RESULT_FIELD4_LEN (TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE)
#define TD_RES_QUERY(res) (*(int8_t*)(res) == RES_TYPE__QUERY)
#define TD_RES_TMQ(res) (*(int8_t*)(res) == RES_TYPE__TMQ)
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index c56a627ec7..b0be3a4d3b 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -294,8 +294,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
}
}
- if ((duration >= pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogThreshold * 1000000UL ||
- duration >= pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogThresholdTest * 1000000UL) &&
+ if ((duration >= pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogThreshold * 1000000UL) &&
checkSlowLogExceptDb(pRequest, pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogExceptDb)) {
(void)atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1);
if (pTscObj->pAppInfo->serverCfg.monitorParas.tsSlowLogScope & reqType) {
@@ -983,6 +982,7 @@ void taos_init_imp(void) {
SCatalogCfg cfg = {.maxDBCacheNum = 100, .maxTblCacheNum = 100};
ENV_ERR_RET(catalogInit(&cfg), "failed to init catalog");
ENV_ERR_RET(schedulerInit(), "failed to init scheduler");
+ ENV_ERR_RET(initClientId(), "failed to init clientId");
tscDebug("starting to initialize TAOS driver");
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 8a0b1ddaab..94d06166f2 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -3032,13 +3032,13 @@ static void fetchCallback(void* pResult, void* param, int32_t code) {
if (code != TSDB_CODE_SUCCESS) {
pRequest->code = code;
taosMemoryFreeClear(pResultInfo->pData);
- pRequest->body.fetchFp(((SSyncQueryParam*)pRequest->body.interParam)->userParam, pRequest, 0);
+ pRequest->body.fetchFp(((SSyncQueryParam*)pRequest->body.interParam)->userParam, pRequest, code);
return;
}
if (pRequest->code != TSDB_CODE_SUCCESS) {
taosMemoryFreeClear(pResultInfo->pData);
- pRequest->body.fetchFp(((SSyncQueryParam*)pRequest->body.interParam)->userParam, pRequest, 0);
+ pRequest->body.fetchFp(((SSyncQueryParam*)pRequest->body.interParam)->userParam, pRequest, pRequest->code);
return;
}
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index 4a719373f2..9f6be8e45c 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -1803,7 +1803,7 @@ int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
if (bind->num > 1) {
tscError("invalid bind number %d for %s", bind->num, __FUNCTION__);
- terrno = TSDB_CODE_INVALID_PARA;
+ terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
return terrno;
}
@@ -1819,7 +1819,7 @@ int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
if (bind->num <= 0 || bind->num > INT16_MAX) {
tscError("invalid bind num %d", bind->num);
- terrno = TSDB_CODE_INVALID_PARA;
+ terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
return terrno;
}
@@ -1831,7 +1831,7 @@ int taos_stmt_bind_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind) {
}
if (0 == insert && bind->num > 1) {
tscError("only one row data allowed for query");
- terrno = TSDB_CODE_INVALID_PARA;
+ terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
return terrno;
}
@@ -1859,7 +1859,7 @@ int taos_stmt_bind_single_param_batch(TAOS_STMT *stmt, TAOS_MULTI_BIND *bind, in
}
if (0 == insert && bind->num > 1) {
tscError("only one row data allowed for query");
- terrno = TSDB_CODE_INVALID_PARA;
+ terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
return terrno;
}
@@ -2019,7 +2019,7 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
if (bind->num <= 0 || bind->num > INT16_MAX) {
tscError("invalid bind num %d", bind->num);
- terrno = TSDB_CODE_INVALID_PARA;
+ terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
return terrno;
}
@@ -2027,7 +2027,7 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
(void)stmtIsInsert2(stmt, &insert);
if (0 == insert && bind->num > 1) {
tscError("only one row data allowed for query");
- terrno = TSDB_CODE_INVALID_PARA;
+ terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
return terrno;
}
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index 9a723218ff..e182cd97ee 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -541,6 +541,10 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD3_LEN;
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
+ infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
+ infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD4_LEN;
+ TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
+
int32_t numOfCfg = taosArrayGetSize(pVars);
code = blockDataEnsureCapacity(pBlock, numOfCfg);
TSDB_CHECK_CODE(code, line, END);
@@ -569,6 +573,13 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
TSDB_CHECK_NULL(pColInfo, code, line, END, terrno);
code = colDataSetVal(pColInfo, i, scope, false);
TSDB_CHECK_CODE(code, line, END);
+
+ char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(info, pInfo->info, TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
+ TSDB_CHECK_NULL(pColInfo, code, line, END, terrno);
+ code = colDataSetVal(pColInfo, i, info, false);
+ TSDB_CHECK_CODE(code, line, END);
}
pBlock->info.rows = numOfCfg;
@@ -825,7 +836,7 @@ int32_t processCompactDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
tscError("failed to post semaphore");
}
}
- return code;
+ return code;
}
__async_send_cb_fn_t getMsgRspHandle(int32_t msgType) {
@@ -845,7 +856,7 @@ __async_send_cb_fn_t getMsgRspHandle(int32_t msgType) {
case TDMT_MND_SHOW_VARIABLES:
return processShowVariablesRsp;
case TDMT_MND_COMPACT_DB:
- return processCompactDbRsp;
+ return processCompactDbRsp;
default:
return genericRspCallback;
}
diff --git a/source/client/test/CMakeLists.txt b/source/client/test/CMakeLists.txt
index 054b5af2b9..9393bfc449 100644
--- a/source/client/test/CMakeLists.txt
+++ b/source/client/test/CMakeLists.txt
@@ -8,27 +8,33 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
ADD_EXECUTABLE(clientTest clientTests.cpp)
TARGET_LINK_LIBRARIES(
clientTest
- os util common transport parser catalog scheduler gtest taos_static qcom executor function
+ os util common transport parser catalog scheduler gtest ${TAOS_LIB_STATIC} qcom executor function
)
ADD_EXECUTABLE(tmqTest tmqTest.cpp)
TARGET_LINK_LIBRARIES(
tmqTest
- PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom
+ PUBLIC os util common transport parser catalog scheduler function gtest ${TAOS_LIB_STATIC} qcom
)
ADD_EXECUTABLE(smlTest smlTest.cpp)
TARGET_LINK_LIBRARIES(
smlTest
- PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom geometry
+ PUBLIC os util common transport parser catalog scheduler function gtest ${TAOS_LIB_STATIC} qcom geometry
)
#ADD_EXECUTABLE(clientMonitorTest clientMonitorTests.cpp)
#TARGET_LINK_LIBRARIES(
# clientMonitorTest
-# PUBLIC os util common transport monitor parser catalog scheduler function gtest taos_static qcom executor
+# PUBLIC os util common transport monitor parser catalog scheduler function gtest ${TAOS_LIB_STATIC} qcom executor
#)
+ADD_EXECUTABLE(userOperTest ../../../tests/script/api/passwdTest.c)
+TARGET_LINK_LIBRARIES(
+ userOperTest
+ PUBLIC ${TAOS_LIB}
+)
+
TARGET_INCLUDE_DIRECTORIES(
clientTest
PUBLIC "${TD_SOURCE_DIR}/include/client/"
@@ -69,3 +75,8 @@ add_test(
# NAME clientMonitorTest
# COMMAND clientMonitorTest
# )
+
+add_test(
+ NAME userOperTest
+ COMMAND userOperTest
+)
diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt
index f10eb6a611..39380a0644 100644
--- a/source/common/CMakeLists.txt
+++ b/source/common/CMakeLists.txt
@@ -1,4 +1,7 @@
aux_source_directory(src COMMON_SRC)
+aux_source_directory(src/msg COMMON_MSG_SRC)
+
+LIST(APPEND COMMON_SRC ${COMMON_MSG_SRC})
if(TD_ENTERPRISE)
LIST(APPEND COMMON_SRC ${TD_ENTERPRISE_DIR}/src/plugins/common/src/tglobal.c)
diff --git a/source/libs/stream/src/streamMsg.c b/source/common/src/msg/streamMsg.c
similarity index 75%
rename from source/libs/stream/src/streamMsg.c
rename to source/common/src/msg/streamMsg.c
index 193daa0cc4..c92ab52ac1 100644
--- a/source/libs/stream/src/streamMsg.c
+++ b/source/common/src/msg/streamMsg.c
@@ -15,8 +15,48 @@
#include "streamMsg.h"
#include "os.h"
-#include "tstream.h"
-#include "streamInt.h"
+#include "tcommon.h"
+
+typedef struct STaskId {
+ int64_t streamId;
+ int64_t taskId;
+} STaskId;
+
+typedef struct STaskCkptInfo {
+ int64_t latestId; // saved checkpoint id
+ int64_t latestVer; // saved checkpoint ver
+ int64_t latestTime; // latest checkpoint time
+ int64_t latestSize; // latest checkpoint size
+ int8_t remoteBackup; // latest checkpoint backup done
+ int64_t activeId; // current active checkpoint id
+ int32_t activeTransId; // checkpoint trans id
+ int8_t failed; // denote if the checkpoint is failed or not
+ int8_t consensusChkptId; // required the consensus-checkpointId
+ int64_t consensusTs; //
+} STaskCkptInfo;
+
+typedef struct STaskStatusEntry {
+ STaskId id;
+ int32_t status;
+ int32_t statusLastDuration; // to record the last duration of current status
+ int64_t stage;
+ int32_t nodeId;
+ SVersionRange verRange; // start/end version in WAL, only valid for source task
+ int64_t processedVer; // only valid for source task
+ double inputQUsed; // in MiB
+ double inputRate;
+ double procsThroughput; // duration between one element put into input queue and being processed.
+ double procsTotal; // duration between one element put into input queue and being processed.
+ double outputThroughput; // the size of dispatched result blocks in bytes
+ double outputTotal; // the size of dispatched result blocks in bytes
+ double sinkQuota; // existed quota size for sink task
+ double sinkDataSize; // sink to dst data size
+ int64_t startTime;
+ int64_t startCheckpointId;
+ int64_t startCheckpointVer;
+ int64_t hTaskId;
+ STaskCkptInfo checkpointInfo;
+} STaskStatusEntry;
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamUpstreamEpInfo* pInfo) {
TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pInfo->taskId));
@@ -289,7 +329,7 @@ int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* p
TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->totalLen));
if (taosArrayGetSize(pReq->data) != pReq->blockNum || taosArrayGetSize(pReq->dataLen) != pReq->blockNum) {
- stError("invalid dispatch req msg");
+ uError("invalid dispatch req msg");
TAOS_CHECK_EXIT(TSDB_CODE_INVALID_MSG);
}
@@ -605,173 +645,92 @@ void tCleanupStreamHbMsg(SStreamHbMsg* pMsg) {
pMsg->numOfTasks = -1;
}
-int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
+int32_t tEncodeStreamHbRsp(SEncoder* pEncoder, const SMStreamHbRspMsg* pRsp) {
int32_t code = 0;
int32_t lino;
TAOS_CHECK_EXIT(tStartEncode(pEncoder));
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->ver));
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->id.streamId));
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->id.taskId));
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.trigger));
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->info.taskLevel));
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->outputInfo.type));
- TAOS_CHECK_EXIT(tEncodeI16(pEncoder, pTask->msgInfo.msgType));
-
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->status.taskStatus));
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->status.schedStatus));
-
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.selfChildId));
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->info.nodeId));
- TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pTask->info.epSet));
- TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pTask->info.mnodeEpset));
-
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->chkInfo.checkpointId));
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->chkInfo.checkpointVer));
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->info.fillHistory));
-
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->hTaskInfo.id.streamId));
- int32_t taskId = pTask->hTaskInfo.id.taskId;
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, taskId));
-
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->streamTaskId.streamId));
- taskId = pTask->streamTaskId.taskId;
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, taskId));
-
- TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTask->dataRange.range.minVer));
- TAOS_CHECK_EXIT(tEncodeU64(pEncoder, pTask->dataRange.range.maxVer));
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->dataRange.window.skey));
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->dataRange.window.ekey));
-
- int32_t epSz = taosArrayGetSize(pTask->upstreamInfo.pList);
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, epSz));
- for (int32_t i = 0; i < epSz; i++) {
- SStreamUpstreamEpInfo* pInfo = taosArrayGetP(pTask->upstreamInfo.pList, i);
- TAOS_CHECK_EXIT(tEncodeStreamEpInfo(pEncoder, pInfo));
- }
-
- if (pTask->info.taskLevel != TASK_LEVEL__SINK) {
- TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTask->exec.qmsg));
- }
-
- if (pTask->outputInfo.type == TASK_OUTPUT__TABLE) {
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->outputInfo.tbSink.stbUid));
- TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTask->outputInfo.tbSink.stbFullName));
- TAOS_CHECK_EXIT(tEncodeSSchemaWrapper(pEncoder, pTask->outputInfo.tbSink.pSchemaWrapper));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__SMA) {
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->outputInfo.smaSink.smaId));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__FETCH) {
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->outputInfo.fetchSink.reserved));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) {
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->outputInfo.fixedDispatcher.taskId));
- TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pTask->outputInfo.fixedDispatcher.nodeId));
- TAOS_CHECK_EXIT(tEncodeSEpSet(pEncoder, &pTask->outputInfo.fixedDispatcher.epSet));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- TAOS_CHECK_EXIT(tSerializeSUseDbRspImp(pEncoder, &pTask->outputInfo.shuffleDispatcher.dbInfo));
- TAOS_CHECK_EXIT(tEncodeCStr(pEncoder, pTask->outputInfo.shuffleDispatcher.stbFullName));
- }
- TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pTask->info.delaySchedParam));
- TAOS_CHECK_EXIT(tEncodeI8(pEncoder, pTask->subtableWithoutMd5));
- TAOS_CHECK_EXIT(tEncodeCStrWithLen(pEncoder, pTask->reserve, sizeof(pTask->reserve) - 1));
-
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->msgId));
tEndEncode(pEncoder);
+
_exit:
return code;
}
-int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
- int32_t taskId = 0;
+int32_t tDecodeStreamHbRsp(SDecoder* pDecoder, SMStreamHbRspMsg* pRsp) {
int32_t code = 0;
int32_t lino;
TAOS_CHECK_EXIT(tStartDecode(pDecoder));
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->ver));
- if (pTask->ver <= SSTREAM_TASK_INCOMPATIBLE_VER || pTask->ver > SSTREAM_TASK_VER) {
- TAOS_CHECK_EXIT(TSDB_CODE_INVALID_MSG);
- }
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->msgId));
+ tEndDecode(pDecoder);
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->id.streamId));
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->id.taskId));
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.trigger));
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->info.taskLevel));
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->outputInfo.type));
- TAOS_CHECK_EXIT(tDecodeI16(pDecoder, &pTask->msgInfo.msgType));
+_exit:
+ return code;
+}
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->status.taskStatus));
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->status.schedStatus));
+int32_t tEncodeRetrieveChkptTriggerReq(SEncoder* pEncoder, const SRetrieveChkptTriggerReq* pReq) {
+ int32_t code = 0;
+ int32_t lino;
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.selfChildId));
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->info.nodeId));
- TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pTask->info.epSet));
- TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pTask->info.mnodeEpset));
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->checkpointId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->downstreamNodeId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->downstreamTaskId));
+ tEndEncode(pEncoder);
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->chkInfo.checkpointId));
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->chkInfo.checkpointVer));
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->info.fillHistory));
+_exit:
+ return code;
+}
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->hTaskInfo.id.streamId));
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &taskId));
- pTask->hTaskInfo.id.taskId = taskId;
+int32_t tDecodeRetrieveChkptTriggerReq(SDecoder* pDecoder, SRetrieveChkptTriggerReq* pReq) {
+ int32_t code = 0;
+ int32_t lino;
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->streamTaskId.streamId));
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &taskId));
- pTask->streamTaskId.taskId = taskId;
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->checkpointId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->upstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->downstreamNodeId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->downstreamTaskId));
+ tEndDecode(pDecoder);
- TAOS_CHECK_EXIT(tDecodeU64(pDecoder, (uint64_t*)&pTask->dataRange.range.minVer));
- TAOS_CHECK_EXIT(tDecodeU64(pDecoder, (uint64_t*)&pTask->dataRange.range.maxVer));
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->dataRange.window.skey));
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->dataRange.window.ekey));
+_exit:
+ return code;
+}
- int32_t epSz = -1;
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &epSz) < 0);
+int32_t tEncodeCheckpointTriggerRsp(SEncoder* pEncoder, const SCheckpointTriggerRsp* pRsp) {
+ int32_t code = 0;
+ int32_t lino;
- if ((pTask->upstreamInfo.pList = taosArrayInit(epSz, POINTER_BYTES)) == NULL) {
- TAOS_CHECK_EXIT(terrno);
- }
- for (int32_t i = 0; i < epSz; i++) {
- SStreamUpstreamEpInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamUpstreamEpInfo));
- if (pInfo == NULL) {
- TAOS_CHECK_EXIT(terrno);
- }
- if ((code = tDecodeStreamEpInfo(pDecoder, pInfo)) < 0) {
- taosMemoryFreeClear(pInfo);
- goto _exit;
- }
- if (taosArrayPush(pTask->upstreamInfo.pList, &pInfo) == NULL) {
- TAOS_CHECK_EXIT(terrno);
- }
- }
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->streamId));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pRsp->checkpointId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->upstreamTaskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->transId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pRsp->rspCode));
+ tEndEncode(pEncoder);
- if (pTask->info.taskLevel != TASK_LEVEL__SINK) {
- TAOS_CHECK_EXIT(tDecodeCStrAlloc(pDecoder, &pTask->exec.qmsg));
- }
+_exit:
+ return code;
+}
- if (pTask->outputInfo.type == TASK_OUTPUT__TABLE) {
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->outputInfo.tbSink.stbUid));
- TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTask->outputInfo.tbSink.stbFullName));
- pTask->outputInfo.tbSink.pSchemaWrapper = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
- if (pTask->outputInfo.tbSink.pSchemaWrapper == NULL) {
- TAOS_CHECK_EXIT(terrno);
- }
- TAOS_CHECK_EXIT(tDecodeSSchemaWrapper(pDecoder, pTask->outputInfo.tbSink.pSchemaWrapper));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__SMA) {
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->outputInfo.smaSink.smaId));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__FETCH) {
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->outputInfo.fetchSink.reserved));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__FIXED_DISPATCH) {
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->outputInfo.fixedDispatcher.taskId));
- TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pTask->outputInfo.fixedDispatcher.nodeId));
- TAOS_CHECK_EXIT(tDecodeSEpSet(pDecoder, &pTask->outputInfo.fixedDispatcher.epSet));
- } else if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- TAOS_CHECK_EXIT(tDeserializeSUseDbRspImp(pDecoder, &pTask->outputInfo.shuffleDispatcher.dbInfo));
- TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName));
- }
- TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pTask->info.delaySchedParam));
- if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER) {
- TAOS_CHECK_EXIT(tDecodeI8(pDecoder, &pTask->subtableWithoutMd5));
- }
- TAOS_CHECK_EXIT(tDecodeCStrTo(pDecoder, pTask->reserve));
+int32_t tDecodeCheckpointTriggerRsp(SDecoder* pDecoder, SCheckpointTriggerRsp* pRsp) {
+ int32_t code = 0;
+ int32_t lino;
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->streamId));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pRsp->checkpointId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->upstreamTaskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->transId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pRsp->rspCode));
tEndDecode(pDecoder);
_exit:
@@ -830,11 +789,7 @@ int32_t tEncodeRestoreCheckpointInfo(SEncoder* pEncoder, const SRestoreCheckpoin
tEndEncode(pEncoder);
_exit:
- if (code) {
- return code;
- } else {
- return pEncoder->pos;
- }
+ return code;
}
int32_t tDecodeRestoreCheckpointInfo(SDecoder* pDecoder, SRestoreCheckpointInfo* pReq) {
@@ -853,3 +808,31 @@ int32_t tDecodeRestoreCheckpointInfo(SDecoder* pDecoder, SRestoreCheckpointInfo*
_exit:
return code;
}
+
+int32_t tEncodeStreamTaskRunReq (SEncoder* pEncoder, const SStreamTaskRunReq* pReq) {
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartEncode(pEncoder));
+ TAOS_CHECK_EXIT(tEncodeI64(pEncoder, pReq->streamId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->taskId));
+ TAOS_CHECK_EXIT(tEncodeI32(pEncoder, pReq->reqType));
+ tEndEncode(pEncoder);
+
+_exit:
+ return code;
+}
+
+int32_t tDecodeStreamTaskRunReq(SDecoder* pDecoder, SStreamTaskRunReq* pReq) {
+ int32_t code = 0;
+ int32_t lino;
+
+ TAOS_CHECK_EXIT(tStartDecode(pDecoder));
+ TAOS_CHECK_EXIT(tDecodeI64(pDecoder, &pReq->streamId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->taskId));
+ TAOS_CHECK_EXIT(tDecodeI32(pDecoder, &pReq->reqType));
+ tEndDecode(pDecoder);
+
+_exit:
+ return code;
+}
\ No newline at end of file
diff --git a/source/common/src/tmsg.c b/source/common/src/msg/tmsg.c
similarity index 99%
rename from source/common/src/tmsg.c
rename to source/common/src/msg/tmsg.c
index 989078d20d..ca94fd8f38 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/msg/tmsg.c
@@ -41,7 +41,7 @@
#define TD_MSG_RANGE_CODE_
#include "tmsgdef.h"
-#include "tanal.h"
+#include "tanalytics.h"
#include "tcol.h"
#include "tlog.h"
@@ -77,7 +77,7 @@ static int32_t tSerializeSMonitorParas(SEncoder *encoder, const SMonitorParas *p
TAOS_CHECK_RETURN(tEncodeI32(encoder, pMonitorParas->tsSlowLogScope));
TAOS_CHECK_RETURN(tEncodeI32(encoder, pMonitorParas->tsSlowLogMaxLen));
TAOS_CHECK_RETURN(tEncodeI32(encoder, pMonitorParas->tsSlowLogThreshold));
- TAOS_CHECK_RETURN(tEncodeI32(encoder, pMonitorParas->tsSlowLogThresholdTest));
+ TAOS_CHECK_RETURN(tEncodeI32(encoder, pMonitorParas->tsSlowLogThresholdTest)); //Obsolete
TAOS_CHECK_RETURN(tEncodeCStr(encoder, pMonitorParas->tsSlowLogExceptDb));
return 0;
}
@@ -88,7 +88,7 @@ static int32_t tDeserializeSMonitorParas(SDecoder *decoder, SMonitorParas *pMoni
TAOS_CHECK_RETURN(tDecodeI32(decoder, &pMonitorParas->tsSlowLogScope));
TAOS_CHECK_RETURN(tDecodeI32(decoder, &pMonitorParas->tsSlowLogMaxLen));
TAOS_CHECK_RETURN(tDecodeI32(decoder, &pMonitorParas->tsSlowLogThreshold));
- TAOS_CHECK_RETURN(tDecodeI32(decoder, &pMonitorParas->tsSlowLogThresholdTest));
+ TAOS_CHECK_RETURN(tDecodeI32(decoder, &pMonitorParas->tsSlowLogThresholdTest)); //Obsolete
TAOS_CHECK_RETURN(tDecodeCStrTo(decoder, pMonitorParas->tsSlowLogExceptDb));
return 0;
}
@@ -2255,10 +2255,10 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl
int32_t numOfAlgos = 0;
void *pIter = taosHashIterate(pRsp->hash, NULL);
while (pIter != NULL) {
- SAnalUrl *pUrl = pIter;
+ SAnalyticsUrl *pUrl = pIter;
size_t nameLen = 0;
const char *name = taosHashGetKey(pIter, &nameLen);
- if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_KEY_LEN && pUrl->urlLen > 0) {
+ if (nameLen > 0 && nameLen <= TSDB_ANALYTIC_ALGO_KEY_LEN && pUrl->urlLen > 0) {
numOfAlgos++;
}
pIter = taosHashIterate(pRsp->hash, pIter);
@@ -2270,7 +2270,7 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl
pIter = taosHashIterate(pRsp->hash, NULL);
while (pIter != NULL) {
- SAnalUrl *pUrl = pIter;
+ SAnalyticsUrl *pUrl = pIter;
size_t nameLen = 0;
const char *name = taosHashGetKey(pIter, &nameLen);
if (nameLen > 0 && pUrl->urlLen > 0) {
@@ -2310,11 +2310,12 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
int32_t lino;
tDecoderInit(&decoder, buf, bufLen);
- int32_t numOfAlgos = 0;
- int32_t nameLen;
- int32_t type;
- char name[TSDB_ANAL_ALGO_KEY_LEN];
- SAnalUrl url = {0};
+
+ int32_t numOfAlgos = 0;
+ int32_t nameLen;
+ int32_t type;
+ char name[TSDB_ANALYTIC_ALGO_KEY_LEN];
+ SAnalyticsUrl url = {0};
TAOS_CHECK_EXIT(tStartDecode(&decoder));
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ver));
@@ -2322,7 +2323,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
for (int32_t f = 0; f < numOfAlgos; ++f) {
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &nameLen));
- if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_NAME_LEN) {
+ if (nameLen > 0 && nameLen <= TSDB_ANALYTIC_ALGO_NAME_LEN) {
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, name));
}
@@ -2334,7 +2335,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&url.url, NULL) < 0);
}
- TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalUrl)));
+ TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalyticsUrl)));
}
tEndDecode(&decoder);
@@ -2347,7 +2348,7 @@ _exit:
void tFreeRetrieveAnalAlgoRsp(SRetrieveAnalAlgoRsp *pRsp) {
void *pIter = taosHashIterate(pRsp->hash, NULL);
while (pIter != NULL) {
- SAnalUrl *pUrl = (SAnalUrl *)pIter;
+ SAnalyticsUrl *pUrl = (SAnalyticsUrl *)pIter;
taosMemoryFree(pUrl->url);
pIter = taosHashIterate(pRsp->hash, pIter);
}
@@ -5733,6 +5734,12 @@ int32_t tSerializeSShowVariablesRsp(void *buf, int32_t bufLen, SShowVariablesRsp
SVariablesInfo *pInfo = taosArrayGet(pRsp->variables, i);
TAOS_CHECK_EXIT(tEncodeSVariablesInfo(&encoder, pInfo));
}
+
+ for (int32_t i = 0; i < varNum; ++i) {
+ SVariablesInfo *pInfo = taosArrayGet(pRsp->variables, i);
+ TAOS_CHECK_RETURN(tEncodeCStr(&encoder, pInfo->info));
+ }
+
tEndEncode(&encoder);
_exit:
@@ -5766,6 +5773,13 @@ int32_t tDeserializeSShowVariablesRsp(void *buf, int32_t bufLen, SShowVariablesR
TAOS_CHECK_EXIT(terrno);
}
}
+
+ if (!tDecodeIsEnd(&decoder)) {
+ for (int32_t i = 0; i < varNum; ++i) {
+ SVariablesInfo *pInfo = taosArrayGet(pRsp->variables, i);
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pInfo->info));
+ }
+ }
}
tEndDecode(&decoder);
@@ -8808,6 +8822,7 @@ int32_t tSerializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq) {
TAOS_CHECK_EXIT(tEncodeCStrWithLen(&encoder, pReq->sql, pReq->sqlLen));
TAOS_CHECK_EXIT(tEncodeU32(&encoder, pReq->msgLen));
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (uint8_t *)pReq->msg, pReq->msgLen));
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->clientId));
tEndEncode(&encoder);
@@ -8856,6 +8871,11 @@ int32_t tDeserializeSSubQueryMsg(void *buf, int32_t bufLen, SSubQueryMsg *pReq)
TAOS_CHECK_EXIT(tDecodeCStrAlloc(&decoder, &pReq->sql));
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->msgLen));
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->msg, NULL));
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->clientId));
+ } else {
+ pReq->clientId = 0;
+ }
tEndDecode(&decoder);
@@ -8985,6 +9005,7 @@ int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) {
} else {
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0));
}
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->clientId));
tEndEncode(&encoder);
@@ -9034,6 +9055,11 @@ int32_t tDeserializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq)
}
TAOS_CHECK_EXIT(tDeserializeSOperatorParam(&decoder, pReq->pOpParam));
}
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->clientId));
+ } else {
+ pReq->clientId = 0;
+ }
tEndDecode(&decoder);
@@ -9146,6 +9172,7 @@ int32_t tSerializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq) {
TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->taskId));
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->refId));
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId));
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->clientId));
tEndEncode(&encoder);
@@ -9186,6 +9213,11 @@ int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq)
TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->taskId));
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->refId));
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->execId));
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->clientId));
+ } else {
+ pReq->clientId = 0;
+ }
tEndDecode(&decoder);
@@ -9214,6 +9246,7 @@ int32_t tSerializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pReq
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->refId));
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->execId));
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->type));
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->clientId));
tEndEncode(&encoder);
@@ -9255,6 +9288,11 @@ int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pR
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->refId));
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->execId));
TAOS_CHECK_EXIT(tDecodeI32(&decoder, (int32_t *)&pReq->type));
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->clientId));
+ } else {
+ pReq->clientId = 0;
+ }
tEndDecode(&decoder);
@@ -9444,6 +9482,10 @@ int32_t tSerializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pR
TAOS_CHECK_EXIT(tEncodeI32(&encoder, status->execId));
TAOS_CHECK_EXIT(tEncodeI8(&encoder, status->status));
}
+ for (int32_t i = 0; i < num; ++i) {
+ STaskStatus *status = taosArrayGet(pRsp->taskStatus, i);
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, status->clientId));
+ }
} else {
TAOS_CHECK_EXIT(tEncodeI32(&encoder, 0));
}
@@ -9487,6 +9529,12 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *
TAOS_CHECK_EXIT(terrno);
}
}
+ if (!tDecodeIsEnd(&decoder)) {
+ for (int32_t i = 0; i < num; ++i) {
+ STaskStatus *status = taosArrayGet(pRsp->taskStatus, i);
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &status->clientId));
+ }
+ }
} else {
pRsp->taskStatus = NULL;
}
@@ -9651,6 +9699,7 @@ int32_t tSerializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) {
TAOS_CHECK_EXIT(tEncodeCStr(&encoder, pReq->sql));
TAOS_CHECK_EXIT(tEncodeBinary(&encoder, pReq->msg, pReq->phyLen));
TAOS_CHECK_EXIT(tEncodeI8(&encoder, pReq->source));
+ TAOS_CHECK_EXIT(tEncodeU64(&encoder, pReq->clientId));
tEndEncode(&encoder);
_exit:
@@ -9699,6 +9748,11 @@ int32_t tDeserializeSVDeleteReq(void *buf, int32_t bufLen, SVDeleteReq *pReq) {
if (!tDecodeIsEnd(&decoder)) {
TAOS_CHECK_EXIT(tDecodeI8(&decoder, &pReq->source));
}
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeU64(&decoder, &pReq->clientId));
+ } else {
+ pReq->clientId = 0;
+ }
tEndDecode(&decoder);
_exit:
@@ -10368,6 +10422,7 @@ static int32_t tEncodeSVDropTbReq(SEncoder *pCoder, const SVDropTbReq *pReq) {
TAOS_CHECK_RETURN(tStartEncode(pCoder));
TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pReq->name));
TAOS_CHECK_RETURN(tEncodeU64(pCoder, pReq->suid));
+ TAOS_CHECK_RETURN(tEncodeI64(pCoder, pReq->uid));
TAOS_CHECK_RETURN(tEncodeI8(pCoder, pReq->igNotExists));
tEndEncode(pCoder);
@@ -10378,6 +10433,7 @@ static int32_t tDecodeSVDropTbReq(SDecoder *pCoder, SVDropTbReq *pReq) {
TAOS_CHECK_RETURN(tStartDecode(pCoder));
TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pReq->name));
TAOS_CHECK_RETURN(tDecodeU64(pCoder, &pReq->suid));
+ TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pReq->uid));
TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pReq->igNotExists));
tEndDecode(pCoder);
diff --git a/source/common/src/rsync.c b/source/common/src/rsync.c
index b7352acf25..8b453f7d82 100644
--- a/source/common/src/rsync.c
+++ b/source/common/src/rsync.c
@@ -119,11 +119,21 @@ static int32_t execCommand(char* command) {
}
void stopRsync() {
- int32_t code =
+ int32_t pid = 0;
+ int32_t code = 0;
+ char buf[128] = {0};
+
#ifdef WINDOWS
- system("taskkill /f /im rsync.exe");
+ code = system("taskkill /f /im rsync.exe");
#else
- system("pkill rsync");
+ code = taosGetPIdByName("rsync", &pid);
+ if (code == 0) {
+ int32_t ret = tsnprintf(buf, tListLen(buf), "kill -9 %d", pid);
+ if (ret > 0) {
+ uInfo("kill rsync program pid:%d", pid);
+ code = system(buf);
+ }
+ }
#endif
if (code != 0) {
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index dbf91aac69..bfe82aa7ae 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -327,8 +327,9 @@ static const SSysDbTableSchema configSchema[] = {
static const SSysDbTableSchema variablesSchema[] = {
{.name = "dnode_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
{.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
- {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "value", .bytes = TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "scope", .bytes = TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "info", .bytes = TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysDbTableSchema topicSchema[] = {
@@ -401,7 +402,7 @@ static const SSysDbTableSchema userCompactsDetailSchema[] = {
static const SSysDbTableSchema anodesSchema[] = {
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
- {.name = "url", .bytes = TSDB_ANAL_ANODE_URL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "url", .bytes = TSDB_ANALYTIC_ANODE_URL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
{.name = "update_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
@@ -409,8 +410,8 @@ static const SSysDbTableSchema anodesSchema[] = {
static const SSysDbTableSchema anodesFullSchema[] = {
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
- {.name = "type", .bytes = TSDB_ANAL_ALGO_TYPE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
- {.name = "algo", .bytes = TSDB_ANAL_ALGO_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "type", .bytes = TSDB_ANALYTIC_ALGO_TYPE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "algo", .bytes = TSDB_ANALYTIC_ALGO_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysDbTableSchema tsmaSchema[] = {
@@ -437,6 +438,7 @@ static const SSysDbTableSchema userGrantsLogsSchema[] = {
{.name = "state", .bytes = 1536 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "active", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "machine", .bytes = TSDB_GRANT_LOG_COL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "active_info", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
static const SSysDbTableSchema userMachinesSchema[] = {
diff --git a/source/common/src/tcol.c b/source/common/src/tcol.c
index 923aab12ca..55a4b21208 100644
--- a/source/common/src/tcol.c
+++ b/source/common/src/tcol.c
@@ -81,26 +81,42 @@ const char* getDefaultEncodeStr(uint8_t type) { return columnEncodeStr(getDefaul
uint16_t getDefaultCompress(uint8_t type) {
switch (type) {
case TSDB_DATA_TYPE_NULL:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_BOOL:
+ return TSDB_COLVAL_COMPRESS_ZSTD;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_SMALLINT:
+ return TSDB_COLVAL_COMPRESS_ZLIB;
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_BIGINT:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_FLOAT:
case TSDB_DATA_TYPE_DOUBLE:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY
+ return TSDB_COLVAL_COMPRESS_ZSTD;
case TSDB_DATA_TYPE_TIMESTAMP:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_NCHAR:
+ return TSDB_COLVAL_COMPRESS_ZSTD;
case TSDB_DATA_TYPE_UTINYINT:
case TSDB_DATA_TYPE_USMALLINT:
+ return TSDB_COLVAL_COMPRESS_ZLIB;
case TSDB_DATA_TYPE_UINT:
case TSDB_DATA_TYPE_UBIGINT:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_JSON:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_VARBINARY:
+ return TSDB_COLVAL_COMPRESS_ZSTD;
case TSDB_DATA_TYPE_DECIMAL:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_BLOB:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_MEDIUMBLOB:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_GEOMETRY:
+ return TSDB_COLVAL_COMPRESS_LZ4;
case TSDB_DATA_TYPE_MAX:
return TSDB_COLVAL_COMPRESS_LZ4;
default:
@@ -166,6 +182,7 @@ const char* columnCompressStr(uint16_t type) {
}
uint8_t columnLevelVal(const char* level) {
+ if (level == NULL) return TSDB_COLVAL_LEVEL_NOCHANGE;
uint8_t l = TSDB_COLVAL_LEVEL_MEDIUM;
if (0 == strcmp(level, "h") || 0 == strcmp(level, TSDB_COLUMN_LEVEL_HIGH)) {
l = TSDB_COLVAL_LEVEL_HIGH;
@@ -180,6 +197,7 @@ uint8_t columnLevelVal(const char* level) {
}
uint16_t columnCompressVal(const char* compress) {
+ if (compress == NULL) return TSDB_COLVAL_COMPRESS_NOCHANGE;
uint16_t c = TSDB_COLVAL_COMPRESS_LZ4;
if (0 == strcmp(compress, TSDB_COLUMN_COMPRESS_LZ4)) {
c = TSDB_COLVAL_COMPRESS_LZ4;
@@ -200,6 +218,7 @@ uint16_t columnCompressVal(const char* compress) {
}
uint8_t columnEncodeVal(const char* encode) {
+ if (encode == NULL) return TSDB_COLVAL_ENCODE_NOCHANGE;
uint8_t e = TSDB_COLVAL_ENCODE_SIMPLE8B;
if (0 == strcmp(encode, TSDB_COLUMN_ENCODE_SIMPLE8B)) {
e = TSDB_COLVAL_ENCODE_SIMPLE8B;
@@ -311,6 +330,7 @@ void setColLevel(uint32_t* compress, uint8_t level) {
int32_t setColCompressByOption(uint8_t type, uint8_t encode, uint16_t compressType, uint8_t level, bool check,
uint32_t* compress) {
+ if(compress == NULL) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
if (check && !validColEncode(type, encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
setColEncode(compress, encode);
diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c
index e580ad33bd..a38842735c 100644
--- a/source/common/src/tdataformat.c
+++ b/source/common/src/tdataformat.c
@@ -3036,7 +3036,8 @@ _exit:
return code;
}
-int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen) {
+int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen, initGeosFn igeos,
+ checkWKBGeometryFn cgeos) {
int32_t code = 0;
if (!(pBind->num == 1 && pBind->is_null && *pBind->is_null)) {
@@ -3046,6 +3047,12 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32
}
if (IS_VAR_DATA_TYPE(pColData->type)) { // var-length data type
+ if (pColData->type == TSDB_DATA_TYPE_GEOMETRY) {
+ code = igeos();
+ if (code) {
+ return code;
+ }
+ }
for (int32_t i = 0; i < pBind->num; ++i) {
if (pBind->is_null && pBind->is_null[i]) {
if (pColData->cflag & COL_IS_KEY) {
@@ -3055,9 +3062,12 @@ int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_NULL](pColData, NULL, 0);
if (code) goto _exit;
} else if (pBind->length[i] > buffMaxLen) {
- uError("var data length too big, len:%d, max:%d", pBind->length[i], buffMaxLen);
- return TSDB_CODE_INVALID_PARA;
+ return TSDB_CODE_PAR_VALUE_TOO_LONG;
} else {
+ if (pColData->type == TSDB_DATA_TYPE_GEOMETRY) {
+ code = cgeos((char *)pBind->buffer + pBind->buffer_length * i, (size_t)pBind->length[i]);
+ if (code) goto _exit;
+ }
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](
pColData, (uint8_t *)pBind->buffer + pBind->buffer_length * i, pBind->length[i]);
}
@@ -3108,7 +3118,8 @@ _exit:
return code;
}
-int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int32_t buffMaxLen) {
+int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int32_t buffMaxLen, initGeosFn igeos,
+ checkWKBGeometryFn cgeos) {
int32_t code = 0;
if (!(pBind->num == 1 && pBind->is_null && *pBind->is_null)) {
@@ -3118,6 +3129,13 @@ int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int3
}
if (IS_VAR_DATA_TYPE(pColData->type)) { // var-length data type
+ if (pColData->type == TSDB_DATA_TYPE_GEOMETRY) {
+ code = igeos();
+ if (code) {
+ return code;
+ }
+ }
+
uint8_t *buf = pBind->buffer;
for (int32_t i = 0; i < pBind->num; ++i) {
if (pBind->is_null && pBind->is_null[i]) {
@@ -3133,9 +3151,12 @@ int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int3
if (code) goto _exit;
}
} else if (pBind->length[i] > buffMaxLen) {
- uError("var data length too big, len:%d, max:%d", pBind->length[i], buffMaxLen);
- return TSDB_CODE_INVALID_PARA;
+ return TSDB_CODE_PAR_VALUE_TOO_LONG;
} else {
+ if (pColData->type == TSDB_DATA_TYPE_GEOMETRY) {
+ code = cgeos(buf, pBind->length[i]);
+ if (code) goto _exit;
+ }
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, buf, pBind->length[i]);
buf += pBind->length[i];
}
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 54e948b4b4..0ebc84b1cd 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -67,7 +67,6 @@ int32_t tsNumOfRpcSessions = 30000;
int32_t tsShareConnLimit = 10;
int32_t tsReadTimeout = 900;
int32_t tsTimeToGetAvailableConn = 500000;
-int32_t tsKeepAliveIdle = 60;
int32_t tsNumOfCommitThreads = 2;
int32_t tsNumOfTaskQueueThreads = 16;
@@ -193,7 +192,6 @@ int32_t tsMaxRetryWaitTime = 10000;
bool tsUseAdapter = false;
int32_t tsMetaCacheMaxSize = -1; // MB
int32_t tsSlowLogThreshold = 10; // seconds
-int32_t tsSlowLogThresholdTest = INT32_MAX; // seconds
char tsSlowLogExceptDb[TSDB_DB_NAME_LEN] = ""; // seconds
int32_t tsSlowLogScope = SLOW_LOG_TYPE_QUERY;
char *tsSlowLogScopeString = "query";
@@ -227,6 +225,8 @@ float tsSelectivityRatio = 1.0;
int32_t tsTagFilterResCacheSize = 1024 * 10;
char tsTagFilterCache = 0;
+int32_t tsBypassFlag = 0;
+
// the maximum allowed query buffer size during query processing for each data node.
// -1 no limit (default)
// 0 no query allowed, queries are disabled
@@ -528,6 +528,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
}
int32_t taosAddClientLogCfg(SConfig *pCfg) {
+<<<<<<< HEAD
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "configDir", configDir, CFG_SCOPE_BOTH, CFG_DYN_NONE, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "scriptDir", configDir, CFG_SCOPE_BOTH, CFG_DYN_NONE, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddDir(pCfg, "logDir", tsLogDir, CFG_SCOPE_BOTH, CFG_DYN_BOTH_LAZY, CFG_CATEGORY_LOCAL));
@@ -553,6 +554,8 @@ int32_t taosAddClientLogCfg(SConfig *pCfg) {
cfgAddInt32(pCfg, "qDebugFlag", qDebugFlag, 0, 255, CFG_SCOPE_BOTH, CFG_DYN_BOTH, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "cDebugFlag", cDebugFlag, 0, 255, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tqClientDebugFlag", tqClientDebugFlag, 0, 255, CFG_SCOPE_CLIENT, CFG_DYN_SERVER,
+ CFG_CATEGORY_LOCAL));
TAOS_RETURN(TSDB_CODE_SUCCESS);
}
@@ -645,12 +648,18 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
cfgAddBool(pCfg, "smlDot2Underline", tsSmlDot2Underline, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "maxShellConns", tsMaxShellConns, 10, 50000000, CFG_SCOPE_CLIENT,
CFG_DYN_BOTH_LAZY, CFG_CATEGORY_GLOBAL));
+
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "minSlidingTime", tsMinSlidingTime, 1, 1000000, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT,
+ CFG_CATEGORY_LOCAL));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "minIntervalTime", tsMinIntervalTime, 1, 1000000, CFG_SCOPE_CLIENT,
+ CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "maxInsertBatchRows", tsMaxInsertBatchRows, 1, INT32_MAX, CFG_SCOPE_CLIENT,
CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL) != 0);
- TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, CFG_SCOPE_BOTH,
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, CFG_SCOPE_SERVER,
CFG_DYN_BOTH_LAZY, CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "useAdapter", tsUseAdapter, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(
+<<<<<<< HEAD
cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, CFG_SCOPE_BOTH, CFG_DYN_BOTH, CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX,
CFG_SCOPE_CLIENT, CFG_DYN_NONE, CFG_CATEGORY_LOCAL));
@@ -664,6 +673,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "safetyCheckLevel", tsSafetyCheckLevel, 0, 5, CFG_SCOPE_BOTH, CFG_DYN_BOTH,
CFG_CATEGORY_GLOBAL));
+ TAOS_CHECK_RETURN(
+ cfgAddInt32(pCfg, "bypassFlag", tsBypassFlag, 0, INT32_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH, CFG_CATEGORY_GLOBAL));
tsNumOfRpcThreads = tsNumOfCores / 2;
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, CFG_SCOPE_BOTH, CFG_DYN_BOTH,
@@ -684,11 +695,6 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 10000000);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "timeToGetAvailableConn", tsTimeToGetAvailableConn, 20, 1000000, CFG_SCOPE_BOTH,
CFG_DYN_BOTH, CFG_CATEGORY_GLOBAL));
-
- tsKeepAliveIdle = TRANGE(tsKeepAliveIdle, 1, 72000);
- TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "keepAliveIdle", tsKeepAliveIdle, 1, 7200000, CFG_SCOPE_BOTH, CFG_DYN_BOTH_LAZY,
- CFG_CATEGORY_GLOBAL));
-
tsNumOfTaskQueueThreads = tsNumOfCores * 2;
tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 16);
@@ -696,7 +702,6 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
CFG_DYN_CLIENT_LAZY, CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(
cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH_LAZY, CFG_CATEGORY_GLOBAL));
-
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "multiResultFunctionStarReturnTags", tsMultiResultFunctionStarReturnTags,
CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "countAlwaysReturnValue", tsCountAlwaysReturnValue, 0, 1, CFG_SCOPE_BOTH,
@@ -793,6 +798,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "statusInterval", tsStatusInterval, 1, 30, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "minSlidingTime", tsMinSlidingTime, 1, 1000000, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "minIntervalTime", tsMinIntervalTime, 1, 1000000, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "maxShellConns", tsMaxShellConns, 10, 50000000, CFG_SCOPE_SERVER, CFG_DYN_NONE, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryBufferSize", tsQueryBufferSize, -1, 500000000000, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY, CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryRspPolicy", tsQueryRspPolicy, 0, 1, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
@@ -809,9 +815,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfSnodeSharedThreads", tsNumOfSnodeStreamThreads, 2, 1024, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfSnodeUniqueThreads", tsNumOfSnodeWriteThreads, 2, 1024, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
-
- TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "rpcQueueMemoryAllowed", tsQueueMemoryAllowed, TSDB_MAX_MSG_SIZE * 10L, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
-
+ TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "rpcQueueMemoryAllowed", tsQueueMemoryAllowed, TSDB_MAX_MSG_SIZE * 10L, INT64_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "syncElectInterval", tsElectInterval, 10, 1000 * 60 * 24 * 2, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "syncHeartbeatInterval", tsHeartbeatInterval, 10, 1000 * 60 * 24 * 2, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "syncHeartbeatTimeout", tsHeartbeatTimeout, 10, 1000 * 60 * 24 * 2, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
@@ -829,7 +833,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "monitor", tsEnableMonitor, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 86400, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
- TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "slowLogThresholdTest", tsSlowLogThresholdTest, 0, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "slowLogThreshold", tsSlowLogThreshold, 1, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "slowLogMaxLen", tsSlowLogMaxLen, 1, 16384, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddString(pCfg, "slowLogScope", tsSlowLogScopeString, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
@@ -847,15 +850,20 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "auditCreateTable", tsEnableAuditCreateTable, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "auditInterval", tsAuditInterval, 500, 200000, CFG_SCOPE_SERVER, CFG_DYN_SERVER,CFG_CATEGORY_GLOBAL));
- TAOS_CHECK_RETURN(cfgAddBool(pCfg, "telemetryReporting", tsEnableTelem, CFG_SCOPE_BOTH, CFG_DYN_ENT_SERVER,CFG_CATEGORY_GLOBAL));
- TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "telemetryInterval", tsTelemInterval, 1, 200000, CFG_SCOPE_BOTH, CFG_DYN_BOTH,CFG_CATEGORY_GLOBAL));
- TAOS_CHECK_RETURN(cfgAddString(pCfg, "telemetryServer", tsTelemServer, CFG_SCOPE_BOTH, CFG_DYN_BOTH,CFG_CATEGORY_GLOBAL));
- TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "telemetryPort", tsTelemPort, 1, 65056, CFG_SCOPE_BOTH, CFG_DYN_NONE,CFG_CATEGORY_LOCAL));
+ TAOS_CHECK_RETURN(cfgAddBool(pCfg, "telemetryReporting", tsEnableTelem, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER,CFG_CATEGORY_GLOBAL));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "telemetryInterval", tsTelemInterval, 1, 200000, CFG_SCOPE_SERVER, CFG_DYN_BOTH,CFG_CATEGORY_GLOBAL));
+ TAOS_CHECK_RETURN(cfgAddString(pCfg, "telemetryServer", tsTelemServer, CFG_SCOPE_SERVER, CFG_DYN_BOTH,CFG_CATEGORY_GLOBAL));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "telemetryPort", tsTelemPort, 1, 65056, CFG_SCOPE_SERVER, CFG_DYN_NONE,CFG_CATEGORY_LOCAL));
- TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "rsyncPort", tsRsyncPort, 1, 65535, CFG_SCOPE_BOTH, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "rsyncPort", tsRsyncPort, 1, 65535, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddString(pCfg, "snodeAddress", tsSnodeAddress, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
TAOS_CHECK_RETURN(cfgAddString(pCfg, "checkpointBackupDir", tsCheckpointBackupDir, CFG_SCOPE_SERVER, CFG_DYN_SERVER_LAZY,CFG_CATEGORY_LOCAL));
+ TAOS_CHECK_RETURN(cfgAddBool(pCfg, "telemetryReporting", tsEnableTelem, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "telemetryInterval", tsTelemInterval, 1, 200000, CFG_SCOPE_SERVER, CFG_DYN_NONE));
+ TAOS_CHECK_RETURN(cfgAddString(pCfg, "telemetryServer", tsTelemServer, CFG_SCOPE_SERVER, CFG_DYN_BOTH));
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "telemetryPort", tsTelemPort, 1, 65056, CFG_SCOPE_SERVER, CFG_DYN_NONE));
+
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tmqMaxTopicNum", tmqMaxTopicNum, 1, 10000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER,CFG_CATEGORY_GLOBAL));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tmqRowSize", tmqRowSize, 1, 1000000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER,CFG_CATEGORY_GLOBAL));
@@ -1361,9 +1369,6 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "timeToGetAvailableConn");
tsTimeToGetAvailableConn = pItem->i32;
- TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "keepAliveIdle");
- tsKeepAliveIdle = pItem->i32;
-
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "experimental");
tsExperimental = pItem->bval;
@@ -1378,6 +1383,10 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "safetyCheckLevel");
tsSafetyCheckLevel = pItem->i32;
+
+ TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "bypassFlag");
+ tsBypassFlag = pItem->i32;
+
TAOS_RETURN(TSDB_CODE_SUCCESS);
}
@@ -1513,9 +1522,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "slowLogExceptDb");
tstrncpy(tsSlowLogExceptDb, pItem->str, TSDB_DB_NAME_LEN);
- TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "slowLogThresholdTest");
- tsSlowLogThresholdTest = pItem->i32;
-
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "slowLogThreshold");
tsSlowLogThreshold = pItem->i32;
@@ -2249,6 +2255,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
{"countAlwaysReturnValue", &tsCountAlwaysReturnValue},
{"uptimeInterval", &tsUptimeInterval},
{"slowLogThresholdTest", &tsSlowLogThresholdTest},
+
{"slowLogMaxLen", &tsSlowLogMaxLen},
{"slowLogScope", &tsSlowLogScope},
{"slowLogExceptDb", &tsSlowLogExceptDb},
@@ -2314,6 +2321,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
{"supportVnodes", &tsNumOfSupportVnodes},
{"experimental", &tsExperimental},
{"maxTsmaNum", &tsMaxTsmaNum},
+
{"maxShellConns", &tsMaxShellConns},
{"numOfRpcSessions", &tsNumOfRpcSessions},
{"numOfRpcThreads", &tsNumOfRpcThreads},
@@ -2321,7 +2329,8 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
{"shellActivityTimer", &tsShellActivityTimer},
{"timeToGetAvailableConn", &tsTimeToGetAvailableConn},
{"tsReadTimeout", &tsReadTimeout},
- {"safetyCheckLevel", &tsSafetyCheckLevel}};
+ {"safetyCheckLevel", &tsSafetyCheckLevel},
+ {"bypassFlag", &tsBypassFlag}};
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
code = taosCfgSetOption(options, tListLen(options), pItem, false);
@@ -2554,7 +2563,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
{"crashReporting", &tsEnableCrashReport},
{"enableQueryHb", &tsEnableQueryHb},
{"keepColumnName", &tsKeepColumnName},
- {"keepAliveIdle", &tsKeepAliveIdle},
{"logKeepDays", &tsLogKeepDays},
{"maxInsertBatchRows", &tsMaxInsertBatchRows},
{"maxRetryWaitTime", &tsMaxRetryWaitTime},
@@ -2577,7 +2585,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
{"multiResultFunctionStarReturnTags", &tsMultiResultFunctionStarReturnTags},
{"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay},
{"tsmaDataDeleteMark", &tsmaDataDeleteMark},
- {"safetyCheckLevel", &tsSafetyCheckLevel}};
+ {"safetyCheckLevel", &tsSafetyCheckLevel},
+ {"bypassFlag", &tsBypassFlag}};
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
code = taosCfgSetOption(options, tListLen(options), pItem, false);
diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c
index 4df458c2bb..8988fab56a 100644
--- a/source/common/src/tmisce.c
+++ b/source/common/src/tmisce.c
@@ -267,7 +267,14 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
int8_t locked = 0;
- TAOS_CHECK_GOTO(blockDataEnsureCapacity(pBlock, cfgGetSize(pConf)), NULL, _exit);
+ size_t exSize = 0;
+ size_t index = 0;
+ SConfigItem* pDataDirItem = cfgGetItem(pConf, "dataDir");
+ if (pDataDirItem) {
+ exSize = TMAX(taosArrayGetSize(pDataDirItem->array), 1) - 1;
+ }
+
+ TAOS_CHECK_GOTO(blockDataEnsureCapacity(pBlock, cfgGetSize(pConf) + exSize), NULL, _exit);
TAOS_CHECK_GOTO(cfgCreateIter(pConf, &pIter), NULL, _exit);
@@ -275,6 +282,7 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
locked = 1;
while ((pItem = cfgNextIter(pIter)) != NULL) {
+_start:
col = startCol;
// GRANT_CFG_SKIP;
@@ -289,9 +297,18 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, name, false), NULL, _exit);
- char value[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0};
+ char value[TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE] = {0};
int32_t valueLen = 0;
- TAOS_CHECK_GOTO(cfgDumpItemValue(pItem, &value[VARSTR_HEADER_SIZE], TSDB_CONFIG_VALUE_LEN, &valueLen), NULL, _exit);
+ SDiskCfg* pDiskCfg = NULL;
+ if (strcasecmp(pItem->name, "dataDir") == 0 && exSize > 0) {
+ char* buf = &value[VARSTR_HEADER_SIZE];
+ pDiskCfg = taosArrayGet(pItem->array, index);
+ valueLen = tsnprintf(buf, TSDB_CONFIG_PATH_LEN, "%s", pDiskCfg->dir);
+ index++;
+ } else {
+ TAOS_CHECK_GOTO(cfgDumpItemValue(pItem, &value[VARSTR_HEADER_SIZE], TSDB_CONFIG_PATH_LEN, &valueLen), NULL,
+ _exit);
+ }
varDataSetLen(value, valueLen);
pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
@@ -313,8 +330,28 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) {
}
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit);
+ char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
+ if (strcasecmp(pItem->name, "dataDir") == 0 && pDiskCfg) {
+ char* buf = &info[VARSTR_HEADER_SIZE];
+ valueLen = tsnprintf(buf, TSDB_CONFIG_INFO_LEN, "level %d primary %d disabled %" PRIi8, pDiskCfg->level,
+ pDiskCfg->primary, pDiskCfg->disable);
+ } else {
+ valueLen = 0;
+ }
+ varDataSetLen(info, valueLen);
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
+ if (pColInfo == NULL) {
+ code = terrno;
+ TAOS_CHECK_GOTO(code, NULL, _exit);
+ }
+ TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, info, false), NULL, _exit);
+
numOfRows++;
- }
+ if (index > 0 && index <= exSize) {
+ goto _start;
+ }
+}
pBlock->info.rows = numOfRows;
_exit:
if (locked) cfgUnLock(pConf);
diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c
index 75624593d9..ecdb3de9a2 100644
--- a/source/common/src/ttime.c
+++ b/source/common/src/ttime.c
@@ -30,7 +30,7 @@ static int64_t m_deltaUtc = 0;
void deltaToUtcInitOnce() {
struct tm tm = {0};
- if (taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm) != 0) {
+ if (taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm) == NULL) {
uError("failed to parse time string");
}
m_deltaUtc = (int64_t)taosMktime(&tm);
diff --git a/source/common/test/CMakeLists.txt b/source/common/test/CMakeLists.txt
index 2fe3ef652d..bb12612273 100644
--- a/source/common/test/CMakeLists.txt
+++ b/source/common/test/CMakeLists.txt
@@ -46,7 +46,7 @@ if (${TD_LINUX})
target_sources(tmsgTest
PRIVATE
"tmsgTest.cpp"
- "../src/tmsg.c"
+ "../src/msg/tmsg.c"
)
target_include_directories(tmsgTest PUBLIC "${TD_SOURCE_DIR}/include/common/")
target_link_libraries(tmsgTest PUBLIC os util gtest gtest_main)
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
index 8eda3c807a..ccb81eb034 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
@@ -18,7 +18,7 @@
#include "dmInt.h"
#include "monitor.h"
#include "systable.h"
-#include "tanal.h"
+#include "tanalytics.h"
#include "tchecksum.h"
#include "tutil.h"
@@ -196,7 +196,6 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
req.clusterCfg.monitorParas.tsSlowLogScope = tsSlowLogScope;
req.clusterCfg.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen;
req.clusterCfg.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold;
- req.clusterCfg.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest;
tstrncpy(req.clusterCfg.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN);
char timestr[32] = "1970-01-01 00:00:00.00";
if (taosParseTime(timestr, &req.clusterCfg.checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0) != 0) {
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c
index 1b6fabad00..b58c1a216d 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "dmInt.h"
#include "libs/function/tudf.h"
-#include "tanal.h"
+#include "tanalytics.h"
static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
int32_t code = 0;
@@ -89,7 +89,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
dError("failed to start udfd since %s", tstrerror(code));
}
- if ((code = taosAnalInit()) != 0) {
+ if ((code = taosAnalyticsInit()) != 0) {
dError("failed to init analysis env since %s", tstrerror(code));
}
diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c
index 8c33c5bb4b..1e882fc656 100644
--- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c
+++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c
@@ -36,14 +36,15 @@ static void smProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
dTrace("msg:%p, get from snode-write queue", pMsg);
int32_t code = sndProcessWriteMsg(pMgmt->pSnode, pMsg, NULL);
- if (code < 0) {
- dGError("snd, msg:%p failed to process write since %s", pMsg, tstrerror(code));
- if (pMsg->info.handle != NULL) {
- tmsgSendRsp(pMsg);
- }
- } else {
- smSendRsp(pMsg, 0);
- }
+ // if (code < 0) {
+ // dGError("snd, msg:%p failed to process write since %s", pMsg, tstrerror(code));
+ // if (pMsg->info.handle != NULL) {
+ // tmsgSendRsp(pMsg);
+ // }
+ // } else {
+ // smSendRsp(pMsg, 0);
+ // }
+ smSendRsp(pMsg, code);
dTrace("msg:%p, is freed", pMsg);
rpcFreeCont(pMsg->pCont);
diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
index 989adf84ac..7842077d88 100644
--- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
@@ -37,7 +37,9 @@ typedef struct SVnodeMgmt {
SSingleWorker mgmtMultiWorker;
SHashObj *hash;
SHashObj *closedHash;
+ SHashObj *creatingHash;
TdThreadRwlock lock;
+ TdThreadMutex mutex;
SVnodesStat state;
STfs *pTfs;
TdThread thread;
@@ -96,6 +98,7 @@ SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict);
void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode);
int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl);
void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal, bool keepClosed);
+void vmRemoveFromCreatingHash(SVnodeMgmt *pMgmt, int32_t vgId);
// vmHandle.c
SArray *vmGetMsgHandles();
@@ -113,6 +116,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt);
int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes);
int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes);
+int32_t vmGetAllVnodeListFromHashWithCreating(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes);
// vmWorker.c
int32_t vmStartWorker(SVnodeMgmt *pMgmt);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c
index 7566b69c02..b4453ad6fc 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c
@@ -67,6 +67,54 @@ int32_t vmGetAllVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnod
return 0;
}
+int32_t vmGetAllVnodeListFromHashWithCreating(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) {
+ (void)taosThreadRwlockRdlock(&pMgmt->lock);
+
+ int32_t num = 0;
+ int32_t size = taosHashGetSize(pMgmt->hash);
+ int32_t creatingSize = taosHashGetSize(pMgmt->creatingHash);
+ size += creatingSize;
+ SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *));
+ if (pVnodes == NULL) {
+ (void)taosThreadRwlockUnlock(&pMgmt->lock);
+ return terrno;
+ }
+
+ void *pIter = taosHashIterate(pMgmt->hash, NULL);
+ while (pIter) {
+ SVnodeObj **ppVnode = pIter;
+ SVnodeObj *pVnode = *ppVnode;
+ if (pVnode && num < size) {
+ int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
+ dTrace("vgId:%d,acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
+ pVnodes[num++] = (*ppVnode);
+ pIter = taosHashIterate(pMgmt->hash, pIter);
+ } else {
+ taosHashCancelIterate(pMgmt->hash, pIter);
+ }
+ }
+
+ pIter = taosHashIterate(pMgmt->creatingHash, NULL);
+ while (pIter) {
+ SVnodeObj **ppVnode = pIter;
+ SVnodeObj *pVnode = *ppVnode;
+ if (pVnode && num < size) {
+ int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1);
+ dTrace("vgId:%d, acquire vnode, vnode:%p, ref:%d", pVnode->vgId, pVnode, refCount);
+ pVnodes[num++] = (*ppVnode);
+ pIter = taosHashIterate(pMgmt->creatingHash, pIter);
+ } else {
+ taosHashCancelIterate(pMgmt->creatingHash, pIter);
+ }
+ }
+ (void)taosThreadRwlockUnlock(&pMgmt->lock);
+
+ *numOfVnodes = num;
+ *ppVnodes = pVnodes;
+
+ return 0;
+}
+
int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeObj ***ppVnodes) {
(void)taosThreadRwlockRdlock(&pMgmt->lock);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index 006f44b349..90b3f0025d 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -381,6 +381,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
if (vnodeCreate(path, &vnodeCfg, diskPrimary, pMgmt->pTfs) < 0) {
dError("vgId:%d, failed to create vnode since %s", req.vgId, terrstr());
vmReleaseVnode(pMgmt, pVnode);
+ vmRemoveFromCreatingHash(pMgmt, req.vgId);
(void)tFreeSCreateVnodeReq(&req);
code = terrno != 0 ? terrno : -1;
return code;
@@ -422,6 +423,8 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
_OVER:
+ vmRemoveFromCreatingHash(pMgmt, req.vgId);
+
if (code != 0) {
int32_t r = 0;
r = taosThreadRwlockWrlock(&pMgmt->lock);
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
index 682c179270..17a99c1806 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#include "vmInt.h"
#include "libs/function/tudf.h"
+#include "osMemory.h"
#include "tfs.h"
#include "vnd.h"
@@ -62,10 +63,20 @@ int32_t vmAllocPrimaryDisk(SVnodeMgmt *pMgmt, int32_t vgId) {
int32_t numOfVnodes = 0;
SVnodeObj **ppVnodes = NULL;
- code = vmGetVnodeListFromHash(pMgmt, &numOfVnodes, &ppVnodes);
+ code = taosThreadMutexLock(&pMgmt->mutex);
if (code != 0) {
return code;
}
+
+ code = vmGetAllVnodeListFromHashWithCreating(pMgmt, &numOfVnodes, &ppVnodes);
+ if (code != 0) {
+ int32_t r = taosThreadMutexUnlock(&pMgmt->mutex);
+ if (r != 0) {
+ dError("vgId:%d, failed to unlock mutex since %s", vgId, tstrerror(r));
+ }
+ return code;
+ }
+
for (int32_t v = 0; v < numOfVnodes; v++) {
SVnodeObj *pVnode = ppVnodes[v];
disks[pVnode->diskPrimary] += 1;
@@ -81,6 +92,51 @@ int32_t vmAllocPrimaryDisk(SVnodeMgmt *pMgmt, int32_t vgId) {
}
}
+ SVnodeObj *pCreatingVnode = taosMemoryCalloc(1, sizeof(SVnodeObj));
+ if (pCreatingVnode == NULL) {
+ code = -1;
+ if (terrno != 0) code = terrno;
+ dError("failed to alloc vnode since %s", tstrerror(code));
+ int32_t r = taosThreadMutexUnlock(&pMgmt->mutex);
+ if (r != 0) {
+ dError("vgId:%d, failed to unlock mutex since %s", vgId, tstrerror(r));
+ }
+ goto _OVER;
+ }
+ (void)memset(pCreatingVnode, 0, sizeof(SVnodeObj));
+
+ pCreatingVnode->vgId = vgId;
+ pCreatingVnode->diskPrimary = diskId;
+
+ code = taosThreadRwlockWrlock(&pMgmt->lock);
+ if (code != 0) {
+ int32_t r = taosThreadMutexUnlock(&pMgmt->mutex);
+ if (r != 0) {
+ dError("vgId:%d, failed to unlock mutex since %s", vgId, tstrerror(r));
+ }
+ taosMemoryFree(pCreatingVnode);
+ goto _OVER;
+ }
+
+ dTrace("vgId:%d, put vnode into creating hash, pCreatingVnode:%p", vgId, pCreatingVnode);
+ code = taosHashPut(pMgmt->creatingHash, &vgId, sizeof(int32_t), &pCreatingVnode, sizeof(SVnodeObj *));
+ if (code != 0) {
+ dError("vgId:%d, failed to put vnode to creatingHash", vgId);
+ taosMemoryFree(pCreatingVnode);
+ }
+
+ int32_t r = taosThreadRwlockUnlock(&pMgmt->lock);
+ if (r != 0) {
+ dError("vgId:%d, failed to unlock since %s", vgId, tstrerror(r));
+ }
+
+ code = taosThreadMutexUnlock(&pMgmt->mutex);
+ if (code != 0) {
+ goto _OVER;
+ }
+
+_OVER:
+
for (int32_t i = 0; i < numOfVnodes; ++i) {
if (ppVnodes == NULL || ppVnodes[i] == NULL) continue;
vmReleaseVnode(pMgmt, ppVnodes[i]);
@@ -89,8 +145,13 @@ int32_t vmAllocPrimaryDisk(SVnodeMgmt *pMgmt, int32_t vgId) {
taosMemoryFree(ppVnodes);
}
- dInfo("vgId:%d, alloc disk:%d of level 0. ndisk:%d, vnodes: %d", vgId, diskId, ndisk, numOfVnodes);
- return diskId;
+ if (code != 0) {
+ dError("vgId:%d, failed to alloc disk since %s", vgId, tstrerror(code));
+ return code;
+ } else {
+ dInfo("vgId:%d, alloc disk:%d of level 0. ndisk:%d, vnodes: %d", vgId, diskId, ndisk, numOfVnodes);
+ return diskId;
+ }
}
SVnodeObj *vmAcquireVnodeImpl(SVnodeMgmt *pMgmt, int32_t vgId, bool strict) {
@@ -216,12 +277,12 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal,
}
if (keepClosed) {
SVnodeObj *pClosedVnode = taosMemoryCalloc(1, sizeof(SVnodeObj));
- (void)memset(pClosedVnode, 0, sizeof(SVnodeObj));
- if (pVnode == NULL) {
- dError("vgId:%d, failed to alloc vnode since %s", pVnode->vgId, terrstr());
+ if (pClosedVnode == NULL) {
+ dError("failed to alloc vnode since %s", terrstr());
(void)taosThreadRwlockUnlock(&pMgmt->lock);
return;
}
+ (void)memset(pClosedVnode, 0, sizeof(SVnodeObj));
pClosedVnode->vgId = pVnode->vgId;
pClosedVnode->dropped = pVnode->dropped;
@@ -427,11 +488,18 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
pMgmt->closedHash =
taosHashInit(TSDB_MIN_VNODES, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
- if (pMgmt->hash == NULL) {
+ if (pMgmt->closedHash == NULL) {
dError("failed to init vnode closed hash since %s", terrstr());
return TSDB_CODE_OUT_OF_MEMORY;
}
+ pMgmt->creatingHash =
+ taosHashInit(TSDB_MIN_VNODES, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
+ if (pMgmt->creatingHash == NULL) {
+ dError("failed to init vnode creatingHash hash since %s", terrstr());
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
SWrapperCfg *pCfgs = NULL;
int32_t numOfVnodes = 0;
if (vmGetVnodeListFromFile(pMgmt, &pCfgs, &numOfVnodes) != 0) {
@@ -509,6 +577,32 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
return 0;
}
+void vmRemoveFromCreatingHash(SVnodeMgmt *pMgmt, int32_t vgId) {
+ SVnodeObj *pOld = NULL;
+
+ (void)taosThreadRwlockWrlock(&pMgmt->lock);
+ int32_t r = taosHashGetDup(pMgmt->creatingHash, &vgId, sizeof(int32_t), (void *)&pOld);
+ if (r != 0) {
+ dError("vgId:%d, failed to get vnode from creating Hash", vgId);
+ }
+ dTrace("vgId:%d, remove from creating Hash", vgId);
+ r = taosHashRemove(pMgmt->creatingHash, &vgId, sizeof(int32_t));
+ if (r != 0) {
+ dError("vgId:%d, failed to remove vnode from hash", vgId);
+ }
+ (void)taosThreadRwlockUnlock(&pMgmt->lock);
+
+ if (pOld) {
+ dTrace("vgId:%d, free vnode pOld:%p", vgId, &pOld);
+ vmFreeVnodeObj(&pOld);
+ }
+
+_OVER:
+ if (r != 0) {
+ dError("vgId:%d, failed to remove vnode from creatingHash since %s", vgId, tstrerror(r));
+ }
+}
+
static void *vmCloseVnodeInThread(void *param) {
SVnodeThread *pThread = param;
SVnodeMgmt *pMgmt = pThread->pMgmt;
@@ -614,6 +708,18 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) {
pMgmt->closedHash = NULL;
}
+ pIter = taosHashIterate(pMgmt->creatingHash, NULL);
+ while (pIter) {
+ SVnodeObj **ppVnode = pIter;
+ vmFreeVnodeObj(ppVnode);
+ pIter = taosHashIterate(pMgmt->creatingHash, pIter);
+ }
+
+ if (pMgmt->creatingHash != NULL) {
+ taosHashCleanup(pMgmt->creatingHash);
+ pMgmt->creatingHash = NULL;
+ }
+
dInfo("total vnodes:%d are all closed", numOfVnodes);
}
@@ -622,6 +728,7 @@ static void vmCleanup(SVnodeMgmt *pMgmt) {
vmStopWorker(pMgmt);
vnodeCleanup();
(void)taosThreadRwlockDestroy(&pMgmt->lock);
+ (void)taosThreadMutexDestroy(&pMgmt->mutex);
(void)taosThreadMutexDestroy(&pMgmt->fileLock);
taosMemoryFree(pMgmt);
}
@@ -714,6 +821,12 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
goto _OVER;
}
+ code = taosThreadMutexInit(&pMgmt->mutex, NULL);
+ if (code != 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _OVER;
+ }
+
code = taosThreadMutexInit(&pMgmt->fileLock, NULL);
if (code != 0) {
code = TAOS_SYSTEM_ERROR(errno);
diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
index 694cc52d64..6d4ebe424a 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
@@ -21,7 +21,7 @@
#include "tgrant.h"
#include "tcompare.h"
#include "tcs.h"
-#include "tanal.h"
+#include "tanalytics.h"
// clang-format on
#define DM_INIT_AUDIT() \
@@ -209,7 +209,7 @@ void dmCleanup() {
dError("failed to close udfc");
}
udfStopUdfd();
- taosAnalCleanup();
+ taosAnalyticsCleanup();
taosStopCacheRefreshWorker();
(void)dmDiskClose();
DestroyRegexCache();
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index 5a276de251..5f396a520a 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "dmMgmt.h"
#include "qworker.h"
-#include "tanal.h"
+#include "tanalytics.h"
#include "tversion.h"
static inline void dmSendRsp(SRpcMsg *pMsg) {
@@ -214,8 +214,6 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
} else if ((pRpc->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pRpc->code == TSDB_CODE_RPC_BROKEN_LINK) &&
(!IsReq(pRpc)) && (pRpc->pCont == NULL)) {
dGError("msg:%p, type:%s pCont is NULL, err: %s", pRpc, TMSG_INFO(pRpc->msgType), tstrerror(pRpc->code));
- code = pRpc->code;
- goto _OVER;
}
if (pHandle->defaultNtype == NODE_END) {
diff --git a/source/dnode/mgmt/node_util/CMakeLists.txt b/source/dnode/mgmt/node_util/CMakeLists.txt
index d882d784de..320da45065 100644
--- a/source/dnode/mgmt/node_util/CMakeLists.txt
+++ b/source/dnode/mgmt/node_util/CMakeLists.txt
@@ -6,5 +6,5 @@ target_include_directories(
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
- node_util cjson mnode vnode qnode snode wal sync taos_static tfs monitor monitorfw
+ node_util cjson mnode vnode qnode snode wal sync ${TAOS_LIB_STATIC} tfs monitor monitorfw
)
\ No newline at end of file
diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt
index 8a390948ae..ad36d8c8ae 100644
--- a/source/dnode/mnode/impl/CMakeLists.txt
+++ b/source/dnode/mnode/impl/CMakeLists.txt
@@ -18,7 +18,7 @@ if(TD_ENTERPRISE)
endif()
if(${BUILD_WITH_ANALYSIS})
- add_definitions(-DUSE_ANAL)
+ add_definitions(-DUSE_ANALYTICS)
endif()
endif()
diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h
index c9155f536c..b519d8509a 100644
--- a/source/dnode/mnode/impl/inc/mndStream.h
+++ b/source/dnode/mnode/impl/inc/mndStream.h
@@ -56,6 +56,7 @@ typedef struct SStreamTransMgmt {
typedef struct SStreamTaskResetMsg {
int64_t streamId;
int32_t transId;
+ int64_t checkpointId;
} SStreamTaskResetMsg;
typedef struct SChkptReportInfo {
@@ -142,9 +143,9 @@ int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pSt
int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray *pList);
-int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
+int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream, int64_t chkptId);
int32_t mndStreamSetUpdateChkptAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream);
-int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream);
+int32_t mndCreateStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream, int64_t chkptId);
int32_t mndStreamSetChkptIdAction(SMnode *pMnode, STrans *pTrans, SStreamTask* pTask, int64_t checkpointId, int64_t ts);
int32_t mndStreamSetRestartAction(SMnode* pMnode, STrans *pTrans, SStreamObj* pStream);
int32_t mndStreamSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, int64_t checkpointId,
diff --git a/source/dnode/mnode/impl/src/mndAnode.c b/source/dnode/mnode/impl/src/mndAnode.c
index 17e3e84c81..c64208600a 100644
--- a/source/dnode/mnode/impl/src/mndAnode.c
+++ b/source/dnode/mnode/impl/src/mndAnode.c
@@ -21,10 +21,10 @@
#include "mndShow.h"
#include "mndTrans.h"
#include "mndUser.h"
-#include "tanal.h"
+#include "tanalytics.h"
#include "tjson.h"
-#ifdef USE_ANAL
+#ifdef USE_ANALYTICS
#define TSDB_ANODE_VER_NUMBER 1
#define TSDB_ANODE_RESERVE_SIZE 64
@@ -309,7 +309,7 @@ static int32_t mndCreateAnode(SMnode *pMnode, SRpcMsg *pReq, SMCreateAnodeReq *p
anodeObj.updateTime = anodeObj.createdTime;
anodeObj.version = 0;
anodeObj.urlLen = pCreate->urlLen;
- if (anodeObj.urlLen > TSDB_ANAL_ANODE_URL_LEN) {
+ if (anodeObj.urlLen > TSDB_ANALYTIC_ANODE_URL_LEN) {
code = TSDB_CODE_MND_ANODE_TOO_LONG_URL;
goto _OVER;
}
@@ -491,23 +491,24 @@ static int32_t mndSetDropAnodeRedoLogs(STrans *pTrans, SAnodeObj *pObj) {
int32_t code = 0;
SSdbRaw *pRedoRaw = mndAnodeActionEncode(pObj);
if (pRedoRaw == NULL) {
- code = TSDB_CODE_MND_RETURN_VALUE_NULL;
- if (terrno != 0) code = terrno;
- TAOS_RETURN(code);
+ code = terrno;
+ return code;
}
+
TAOS_CHECK_RETURN(mndTransAppendRedolog(pTrans, pRedoRaw));
TAOS_CHECK_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING));
- TAOS_RETURN(code);
+
+ return code;
}
static int32_t mndSetDropAnodeCommitLogs(STrans *pTrans, SAnodeObj *pObj) {
int32_t code = 0;
SSdbRaw *pCommitRaw = mndAnodeActionEncode(pObj);
if (pCommitRaw == NULL) {
- code = TSDB_CODE_MND_RETURN_VALUE_NULL;
- if (terrno != 0) code = terrno;
- TAOS_RETURN(code);
+ code = terrno;
+ return code;
}
+
TAOS_CHECK_RETURN(mndTransAppendCommitlog(pTrans, pCommitRaw));
TAOS_CHECK_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED));
TAOS_RETURN(code);
@@ -521,25 +522,25 @@ static int32_t mndSetDropAnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SAnode
}
static int32_t mndDropAnode(SMnode *pMnode, SRpcMsg *pReq, SAnodeObj *pObj) {
- int32_t code = -1;
+ int32_t code = 0;
+ int32_t lino = 0;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-anode");
- if (pTrans == NULL) {
- code = TSDB_CODE_MND_RETURN_VALUE_NULL;
- if (terrno != 0) code = terrno;
- goto _OVER;
- }
+ TSDB_CHECK_NULL(pTrans, code, lino, _OVER, terrno);
+
mndTransSetSerial(pTrans);
+ mInfo("trans:%d, to drop anode:%d", pTrans->id, pObj->id);
- mInfo("trans:%d, used to drop anode:%d", pTrans->id, pObj->id);
- TAOS_CHECK_GOTO(mndSetDropAnodeInfoToTrans(pMnode, pTrans, pObj, false), NULL, _OVER);
- TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
+ code = mndSetDropAnodeInfoToTrans(pMnode, pTrans, pObj, false);
+ mndReleaseAnode(pMnode, pObj);
- code = 0;
+ TSDB_CHECK_CODE(code, lino, _OVER);
+
+ code = mndTransPrepare(pMnode, pTrans);
_OVER:
mndTransDrop(pTrans);
- TAOS_RETURN(code);
+ return code;
}
static int32_t mndProcessDropAnodeReq(SRpcMsg *pReq) {
@@ -560,20 +561,20 @@ static int32_t mndProcessDropAnodeReq(SRpcMsg *pReq) {
pObj = mndAcquireAnode(pMnode, dropReq.anodeId);
if (pObj == NULL) {
- code = TSDB_CODE_MND_RETURN_VALUE_NULL;
- if (terrno != 0) code = terrno;
+ code = terrno;
goto _OVER;
}
code = mndDropAnode(pMnode, pReq, pObj);
- if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
+ if (code == 0) {
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
+ }
_OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
mError("anode:%d, failed to drop since %s", dropReq.anodeId, tstrerror(code));
}
- mndReleaseAnode(pMnode, pObj);
tFreeSMDropAnodeReq(&dropReq);
TAOS_RETURN(code);
}
@@ -584,7 +585,7 @@ static int32_t mndRetrieveAnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
int32_t numOfRows = 0;
int32_t cols = 0;
SAnodeObj *pObj = NULL;
- char buf[TSDB_ANAL_ANODE_URL_LEN + VARSTR_HEADER_SIZE];
+ char buf[TSDB_ANALYTIC_ANODE_URL_LEN + VARSTR_HEADER_SIZE];
char status[64];
int32_t code = 0;
@@ -642,7 +643,7 @@ static int32_t mndRetrieveAnodesFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
int32_t numOfRows = 0;
int32_t cols = 0;
SAnodeObj *pObj = NULL;
- char buf[TSDB_ANAL_ALGO_NAME_LEN + VARSTR_HEADER_SIZE];
+ char buf[TSDB_ANALYTIC_ALGO_NAME_LEN + VARSTR_HEADER_SIZE];
int32_t code = 0;
while (numOfRows < rows) {
@@ -693,7 +694,7 @@ static int32_t mndDecodeAlgoList(SJson *pJson, SAnodeObj *pObj) {
int32_t code = 0;
int32_t protocol = 0;
double tmp = 0;
- char buf[TSDB_ANAL_ALGO_NAME_LEN + 1] = {0};
+ char buf[TSDB_ANALYTIC_ALGO_NAME_LEN + 1] = {0};
code = tjsonGetDoubleValue(pJson, "protocol", &tmp);
if (code < 0) return TSDB_CODE_INVALID_JSON_FORMAT;
@@ -753,10 +754,10 @@ static int32_t mndDecodeAlgoList(SJson *pJson, SAnodeObj *pObj) {
}
static int32_t mndGetAnodeAlgoList(const char *url, SAnodeObj *pObj) {
- char anodeUrl[TSDB_ANAL_ANODE_URL_LEN + 1] = {0};
- snprintf(anodeUrl, TSDB_ANAL_ANODE_URL_LEN, "%s/%s", url, "list");
+ char anodeUrl[TSDB_ANALYTIC_ANODE_URL_LEN + 1] = {0};
+ snprintf(anodeUrl, TSDB_ANALYTIC_ANODE_URL_LEN, "%s/%s", url, "list");
- SJson *pJson = taosAnalSendReqRetJson(anodeUrl, ANAL_HTTP_TYPE_GET, NULL);
+ SJson *pJson = taosAnalSendReqRetJson(anodeUrl, ANALYTICS_HTTP_TYPE_GET, NULL);
if (pJson == NULL) return terrno;
int32_t code = mndDecodeAlgoList(pJson, pObj);
@@ -769,10 +770,10 @@ static int32_t mndGetAnodeStatus(SAnodeObj *pObj, char *status, int32_t statusLe
int32_t code = 0;
int32_t protocol = 0;
double tmp = 0;
- char anodeUrl[TSDB_ANAL_ANODE_URL_LEN + 1] = {0};
- snprintf(anodeUrl, TSDB_ANAL_ANODE_URL_LEN, "%s/%s", pObj->url, "status");
+ char anodeUrl[TSDB_ANALYTIC_ANODE_URL_LEN + 1] = {0};
+ snprintf(anodeUrl, TSDB_ANALYTIC_ANODE_URL_LEN, "%s/%s", pObj->url, "status");
- SJson *pJson = taosAnalSendReqRetJson(anodeUrl, ANAL_HTTP_TYPE_GET, NULL);
+ SJson *pJson = taosAnalSendReqRetJson(anodeUrl, ANALYTICS_HTTP_TYPE_GET, NULL);
if (pJson == NULL) return terrno;
code = tjsonGetDoubleValue(pJson, "protocol", &tmp);
@@ -806,9 +807,9 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
SSdb *pSdb = pMnode->pSdb;
int32_t code = -1;
SAnodeObj *pObj = NULL;
- SAnalUrl url;
+ SAnalyticsUrl url;
int32_t nameLen;
- char name[TSDB_ANAL_ALGO_KEY_LEN];
+ char name[TSDB_ANALYTIC_ALGO_KEY_LEN];
SRetrieveAnalAlgoReq req = {0};
SRetrieveAnalAlgoRsp rsp = {0};
@@ -838,7 +839,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
SAnodeAlgo *algo = taosArrayGet(algos, a);
nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", url.type, algo->name);
- SAnalUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen);
+ SAnalyticsUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen);
if (pOldUrl == NULL || (pOldUrl != NULL && pOldUrl->anode < url.anode)) {
if (pOldUrl != NULL) {
taosMemoryFreeClear(pOldUrl->url);
@@ -847,15 +848,15 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
goto _OVER;
}
}
- url.url = taosMemoryMalloc(TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN + 1);
+ url.url = taosMemoryMalloc(TSDB_ANALYTIC_ANODE_URL_LEN + TSDB_ANALYTIC_ALGO_TYPE_LEN + 1);
if (url.url == NULL) {
sdbRelease(pSdb, pAnode);
goto _OVER;
}
- url.urlLen = 1 + tsnprintf(url.url, TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN, "%s/%s", pAnode->url,
+ url.urlLen = 1 + tsnprintf(url.url, TSDB_ANALYTIC_ANODE_URL_LEN + TSDB_ANALYTIC_ALGO_TYPE_LEN, "%s/%s", pAnode->url,
taosAnalAlgoUrlStr(url.type));
- if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalUrl)) != 0) {
+ if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalyticsUrl)) != 0) {
taosMemoryFree(url.url);
sdbRelease(pSdb, pAnode);
goto _OVER;
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index fced2886ba..862af15ff3 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -477,7 +477,6 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, SDnodeObj *pDnode, const S
CHECK_MONITOR_PARA(tsEnableMonitor, DND_REASON_STATUS_MONITOR_SWITCH_NOT_MATCH);
CHECK_MONITOR_PARA(tsMonitorInterval, DND_REASON_STATUS_MONITOR_INTERVAL_NOT_MATCH);
CHECK_MONITOR_PARA(tsSlowLogThreshold, DND_REASON_STATUS_MONITOR_SLOW_LOG_THRESHOLD_NOT_MATCH);
- CHECK_MONITOR_PARA(tsSlowLogThresholdTest, DND_REASON_STATUS_MONITOR_NOT_MATCH);
CHECK_MONITOR_PARA(tsSlowLogMaxLen, DND_REASON_STATUS_MONITOR_SLOW_LOG_SQL_MAX_LEN_NOT_MATCH);
CHECK_MONITOR_PARA(tsSlowLogScope, DND_REASON_STATUS_MONITOR_SLOW_LOG_SCOPE_NOT_MATCH);
@@ -1100,6 +1099,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
(void)strcpy(info.name, "statusInterval");
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsStatusInterval);
(void)strcpy(info.scope, "server");
+ // fill info.info
if (taosArrayPush(rsp.variables, &info) == NULL) {
code = terrno;
goto _OVER;
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index 0ceb020ceb..de330bc977 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -54,7 +54,7 @@ static inline int32_t mndAcquireRpc(SMnode *pMnode) {
if (pMnode->stopped) {
code = TSDB_CODE_APP_IS_STOPPING;
} else if (!mndIsLeader(pMnode)) {
- code = -1;
+ code = 1;
} else {
#if 1
(void)atomic_add_fetch_32(&pMnode->rpcRef, 1);
@@ -1009,8 +1009,12 @@ int64_t mndGenerateUid(const char *name, int32_t len) {
int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo,
SMonStbInfo *pStbInfo, SMonGrantInfo *pGrantInfo) {
- int32_t code = 0;
- TAOS_CHECK_RETURN(mndAcquireRpc(pMnode));
+ int32_t code = mndAcquireRpc(pMnode);
+ if (code < 0) {
+ TAOS_RETURN(code);
+ } else if (code == 1) {
+ TAOS_RETURN(TSDB_CODE_SUCCESS);
+ }
SSdb *pSdb = pMnode->pSdb;
int64_t ms = taosGetTimestampMs();
diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c
index 21aba8df10..fd02367f6d 100644
--- a/source/dnode/mnode/impl/src/mndProfile.c
+++ b/source/dnode/mnode/impl/src/mndProfile.c
@@ -304,7 +304,6 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
connectRsp.monitorParas.tsSlowLogScope = tsSlowLogScope;
connectRsp.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen;
connectRsp.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold;
- connectRsp.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest;
connectRsp.enableAuditDelete = tsEnableAuditDelete;
tstrncpy(connectRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN);
connectRsp.whiteListVer = pUser->ipWhiteListVer;
@@ -706,7 +705,6 @@ static int32_t mndProcessHeartBeatReq(SRpcMsg *pReq) {
batchRsp.monitorParas.tsEnableMonitor = tsEnableMonitor;
batchRsp.monitorParas.tsMonitorInterval = tsMonitorInterval;
batchRsp.monitorParas.tsSlowLogThreshold = tsSlowLogThreshold;
- batchRsp.monitorParas.tsSlowLogThresholdTest = tsSlowLogThresholdTest;
tstrncpy(batchRsp.monitorParas.tsSlowLogExceptDb, tsSlowLogExceptDb, TSDB_DB_NAME_LEN);
batchRsp.monitorParas.tsSlowLogMaxLen = tsSlowLogMaxLen;
batchRsp.monitorParas.tsSlowLogScope = tsSlowLogScope;
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index 3725d3a3fc..eb6c326d1e 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -4063,8 +4063,8 @@ static int32_t mndProcessDropStbReqFromMNode(SRpcMsg *pReq) {
}
typedef struct SVDropTbVgReqs {
- SVDropTbBatchReq req;
- SVgroupInfo info;
+ SArray *pBatchReqs;
+ SVgroupInfo info;
} SVDropTbVgReqs;
typedef struct SMDropTbDbInfo {
@@ -4086,45 +4086,21 @@ typedef struct SMDropTbTsmaInfos {
} SMDropTbTsmaInfos;
typedef struct SMndDropTbsWithTsmaCtx {
- SHashObj *pTsmaMap; //