diff --git a/Jenkinsfile b/Jenkinsfile
index 491e70742825fb9d655ca76321085a133c4aea63..9d131d0ca500ef248740b5ce31fd92ce197b32f8 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -57,7 +57,7 @@ def pre_test(){
cd ${WKC}
git checkout 2.0
'''
- }
+ }
else{
sh '''
cd ${WKC}
@@ -67,6 +67,7 @@ def pre_test(){
}
sh'''
cd ${WKC}
+ git remote prune origin
[ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
@@ -88,28 +89,28 @@ def pre_test(){
cd ${WK}
git checkout 2.0
'''
- }
+ }
else{
sh '''
cd ${WK}
git checkout develop
'''
- }
+ }
}
sh '''
cd ${WK}
- git pull >/dev/null
-
+ git pull >/dev/null
+
export TZ=Asia/Harbin
date
git clean -dfx
mkdir debug
cd debug
- cmake .. -DBUILD_HTTP=false > /dev/null
+ cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true > /dev/null
make > /dev/null
make install > /dev/null
cd ${WKC}/tests
- pip3 install ${WKC}/src/connector/python/
+ pip3 install ${WKC}/src/connector/python/
'''
return 1
}
@@ -131,7 +132,7 @@ def pre_test_noinstall(){
cd ${WKC}
git checkout 2.0
'''
- }
+ }
else{
sh '''
cd ${WKC}
@@ -141,6 +142,7 @@ def pre_test_noinstall(){
}
sh'''
cd ${WKC}
+ git remote prune origin
[ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
@@ -162,24 +164,24 @@ def pre_test_noinstall(){
cd ${WK}
git checkout 2.0
'''
- }
+ }
else{
sh '''
cd ${WK}
git checkout develop
'''
- }
+ }
}
sh '''
cd ${WK}
- git pull >/dev/null
-
+ git pull >/dev/null
+
export TZ=Asia/Harbin
date
git clean -dfx
mkdir debug
cd debug
- cmake .. -DBUILD_HTTP=false > /dev/null
+ cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=false > /dev/null
make
'''
return 1
@@ -202,7 +204,7 @@ def pre_test_mac(){
cd ${WKC}
git checkout 2.0
'''
- }
+ }
else{
sh '''
cd ${WKC}
@@ -212,6 +214,7 @@ def pre_test_mac(){
}
sh'''
cd ${WKC}
+ git remote prune origin
[ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
@@ -233,24 +236,24 @@ def pre_test_mac(){
cd ${WK}
git checkout 2.0
'''
- }
+ }
else{
sh '''
cd ${WK}
git checkout develop
'''
- }
+ }
}
sh '''
cd ${WK}
- git pull >/dev/null
-
+ git pull >/dev/null
+
export TZ=Asia/Harbin
date
git clean -dfx
mkdir debug
cd debug
- cmake .. > /dev/null
+ cmake .. -DBUILD_TOOLS=false > /dev/null
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=on
cmake --build .
@@ -265,7 +268,7 @@ def pre_test_win(){
cd C:\\workspace\\TDinternal
rd /s /Q C:\\workspace\\TDinternal\\debug
cd C:\\workspace\\TDinternal\\community
- git reset --hard HEAD~10
+ git reset --hard HEAD~10
'''
script {
if (env.CHANGE_TARGET == 'master') {
@@ -279,7 +282,7 @@ def pre_test_win(){
cd C:\\workspace\\TDinternal\\community
git checkout 2.0
'''
- }
+ }
else{
bat '''
cd C:\\workspace\\TDinternal\\community
@@ -289,7 +292,8 @@ def pre_test_win(){
}
bat'''
cd C:\\workspace\\TDinternal\\community
- git pull
+ git remote prune origin
+ git pull
git fetch origin +refs/pull/%CHANGE_ID%/merge
git checkout -qf FETCH_HEAD
git clean -dfx
@@ -309,36 +313,36 @@ def pre_test_win(){
cd C:\\workspace\\TDinternal
git checkout 2.0
'''
- }
+ }
else{
bat '''
cd C:\\workspace\\TDinternal
git checkout develop
'''
- }
+ }
}
bat '''
cd C:\\workspace\\TDinternal
- git pull
+ git pull
date
git clean -dfx
mkdir debug
cd debug
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64
- cmake ../ -G "NMake Makefiles"
+ cmake ../ -G "NMake Makefiles"
set CL=/MP nmake nmake || exit 8
nmake install || exit 8
xcopy /e/y/i/f C:\\workspace\\TDinternal\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 || exit 8
cd C:\\workspace\\TDinternal\\community\\src\\connector\\python
python -m pip install .
-
+
'''
return 1
}
pipeline {
agent none
- options { skipDefaultCheckout() }
+ options { skipDefaultCheckout() }
environment{
WK = '/var/lib/jenkins/workspace/TDinternal'
WKC= '/var/lib/jenkins/workspace/TDinternal/community'
@@ -346,7 +350,7 @@ pipeline {
stages {
stage('pre_build'){
agent{label 'master'}
- options { skipDefaultCheckout() }
+ options { skipDefaultCheckout() }
when {
changeRequest()
}
@@ -371,32 +375,32 @@ pipeline {
// sh '''
// git checkout 2.0
// '''
- // }
+ // }
// else{
// sh '''
// git checkout develop
// '''
- // }
+ // }
// }
// sh'''
// git fetch origin +refs/pull/${CHANGE_ID}/merge
// git checkout -qf FETCH_HEAD
- // '''
+ // '''
- // script{
- // skipbuild='2'
+ // script{
+ // skipbuild='2'
// skipbuild=sh(script: "git log -2 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' && echo 1 || echo 2", returnStdout:true)
// println skipbuild
// }
// sh'''
// rm -rf ${WORKSPACE}.tes
// '''
- // }
+ // }
}
}
stage('Parallel test stage') {
//only build pr
- options { skipDefaultCheckout() }
+ options { skipDefaultCheckout() }
when {
allOf{
changeRequest()
@@ -415,13 +419,11 @@ pipeline {
./test-all.sh p1
date'''
}
-
}
}
stage('python_2_s5') {
agent{label " slave5 || slave15 "}
steps {
-
pre_test()
timeout(time: 55, unit: 'MINUTES'){
sh '''
@@ -434,8 +436,8 @@ pipeline {
}
stage('python_3_s6') {
agent{label " slave6 || slave16 "}
- steps {
- timeout(time: 55, unit: 'MINUTES'){
+ steps {
+ timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
date
@@ -447,8 +449,8 @@ pipeline {
}
stage('test_b1_s2') {
agent{label " slave2 || slave12 "}
- steps {
- timeout(time: 55, unit: 'MINUTES'){
+ steps {
+ timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
rm -rf /var/lib/taos/*
@@ -476,6 +478,9 @@ pipeline {
'''
sh '''
+ cd ${WKC}/src/connector/nodejs
+ npm install
+ npm run test
cd ${WKC}/tests/examples/nodejs
npm install td2.0-connector > /dev/null 2>&1
node nodejsChecker.js host=localhost
@@ -486,6 +491,15 @@ pipeline {
'''
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh '''
+ cd ${WKC}/src/connector/C#
+ dotnet test
+ dotnet run --project src/test/Cases/Cases.csproj
+
+ cd ${WKC}/tests/examples/C#
+ dotnet run --project C#checker/C#checker.csproj
+ dotnet run --project TDengineTest/TDengineTest.csproj
+ dotnet run --project schemaless/schemaless.csproj
+
cd ${WKC}/tests/examples/C#/taosdemo
dotnet build -c Release
tree | true
@@ -505,7 +519,7 @@ pipeline {
}
stage('test_crash_gen_s3') {
agent{label " slave3 || slave13 "}
-
+
steps {
pre_test()
timeout(time: 60, unit: 'MINUTES'){
@@ -535,7 +549,7 @@ pipeline {
./test-all.sh b2fq
date
'''
- }
+ }
}
}
stage('test_valgrind_s4') {
@@ -549,8 +563,8 @@ pipeline {
./valgrind-test.sh 2>&1 > mem-error-out.log
./handle_val_log.sh
'''
- }
- timeout(time: 55, unit: 'MINUTES'){
+ }
+ timeout(time: 55, unit: 'MINUTES'){
sh '''
date
cd ${WKC}/tests
@@ -566,8 +580,8 @@ pipeline {
}
stage('test_b4_s7') {
agent{label " slave7 || slave17 "}
- steps {
- timeout(time: 105, unit: 'MINUTES'){
+ steps {
+ timeout(time: 105, unit: 'MINUTES'){
pre_test()
sh '''
date
@@ -580,14 +594,13 @@ pipeline {
// ./test-all.sh full jdbc
// cd ${WKC}/tests
// ./test-all.sh full unit
-
}
}
}
stage('test_b5_s8') {
agent{label " slave8 || slave18 "}
- steps {
- timeout(time: 55, unit: 'MINUTES'){
+ steps {
+ timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
date
@@ -599,8 +612,8 @@ pipeline {
}
stage('test_b6_s9') {
agent{label " slave9 || slave19 "}
- steps {
- timeout(time: 55, unit: 'MINUTES'){
+ steps {
+ timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
cd ${WKC}/tests
@@ -611,14 +624,13 @@ pipeline {
cd ${WKC}/tests
./test-all.sh b6fq
date'''
-
}
}
}
stage('test_b7_s10') {
agent{label " slave10 || slave20 "}
- steps {
- timeout(time: 55, unit: 'MINUTES'){
+ steps {
+ timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
cd ${WKC}/tests
@@ -628,68 +640,68 @@ pipeline {
date
cd ${WKC}/tests
./test-all.sh b7fq
- date'''
+ date'''
}
}
- }
+ }
stage('arm64centos7') {
agent{label " arm64centos7 "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('arm64centos8') {
agent{label " arm64centos8 "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('arm32bionic') {
agent{label " arm32bionic "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('arm64bionic') {
agent{label " arm64bionic "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('arm64focal') {
agent{label " arm64focal "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('centos7') {
agent{label " centos7 "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('ubuntu:trusty') {
agent{label " trusty "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('ubuntu:xenial') {
agent{label " xenial "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('ubuntu:bionic') {
agent{label " bionic "}
- steps {
- pre_test_noinstall()
+ steps {
+ pre_test_noinstall()
}
}
stage('Mac_build') {
agent{label " catalina "}
- steps {
- pre_test_mac()
+ steps {
+ pre_test_mac()
}
}
@@ -697,7 +709,7 @@ pipeline {
agent{label " wintest "}
steps {
pre_test()
- script{
+ script{
while(win_stop == 0){
sleep(1)
}
@@ -707,7 +719,6 @@ pipeline {
stage('test'){
agent{label "win"}
steps{
-
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
pre_test_win()
timeout(time: 20, unit: 'MINUTES'){
@@ -716,18 +727,16 @@ pipeline {
.\\test-all.bat wintest
'''
}
- }
+ }
script{
win_stop=1
}
}
}
-
-
}
}
}
- post {
+ post {
success {
emailext (
subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
@@ -754,7 +763,6 @@ pipeline {
提交信息:${env.CHANGE_TITLE}
构建地址:${BUILD_URL}
构建日志:${BUILD_URL}console
-
@@ -792,7 +800,6 @@ pipeline {
提交信息:${env.CHANGE_TITLE}
构建地址:${BUILD_URL}
构建日志:${BUILD_URL}console
-
@@ -804,5 +811,5 @@ pipeline {
from: "support@taosdata.com"
)
}
- }
+ }
}
diff --git a/README.md b/README.md
index 6cf09e1589946cdb752eba2f3e3135af1699fe3c..31973af6c7baa6fbbe78dcedda52c40a942752b9 100644
--- a/README.md
+++ b/README.md
@@ -59,6 +59,9 @@ sudo apt-get install -y maven
```
#### Install build dependencies for taos-tools
+We provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. From TDengine 2.4.0.0, taosBenchmark and taosdump were not released together with TDengine.
+By default, TDengine compiling does not include taos-tools. You can use 'cmake .. -DBUILD_TOOLS=true' to make them be compiled with TDengine.
+
To build the [taos-tools](https://github.com/taosdata/taos-tools) on Ubuntu/Debian, the following packages need to be installed.
```bash
sudo apt install libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config
@@ -142,7 +145,7 @@ mkdir debug && cd debug
cmake .. && cmake --build .
```
-Note TDengine 2.3.x.0 and later use a component named 'taosAdapter' to play http daemon role by default instead of the http daemon embedded in the early version of TDengine. The taosAdapter is programmed by go language. If you pull TDengine source code to the latest from an existing codebase, please execute 'git submodule update --init --recursive' to pull taosAdapter source code. Please install go language 1.14 or above for compiling taosAdapter. If you meet difficulties regarding 'go mod', especially you are from China, you can use a proxy to solve the problem.
+Note TDengine 2.3.x.0 and later use a component named 'taosAdapter' to play http daemon role by default instead of the http daemon embedded in the early version of TDengine. The taosAdapter is programmed by go language. If you pull TDengine source code to the latest from an existing codebase, please execute 'git submodule update --init --recursive' to pull taosAdapter source code. Please install go language version 1.14 or above for compiling taosAdapter. If you meet difficulties regarding 'go mod', especially you are from China, you can use a proxy to solve the problem.
```
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
diff --git a/cmake/define.inc b/cmake/define.inc
index 07df84a7f4df5d27020716b4d9986a578b839595..6877ee7257cab244c6cc2872e44fa899a798c856 100755
--- a/cmake/define.inc
+++ b/cmake/define.inc
@@ -168,7 +168,7 @@ IF ("${BUILD_TOOLS}" STREQUAL "")
ELSEIF (TD_ARM_64)
SET(BUILD_TOOLS "false")
ELSE ()
- SET(BUILD_TOOLS "true")
+ SET(BUILD_TOOLS "false")
ENDIF ()
ELSEIF (TD_DARWIN)
SET(BUILD_TOOLS "false")
diff --git a/deps/jemalloc b/deps/jemalloc
index ea6b3e973b477b8061e0076bb257dbd7f3faa756..9015e129bd7de389afa4196495451669700904d0 160000
--- a/deps/jemalloc
+++ b/deps/jemalloc
@@ -1 +1 @@
-Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756
+Subproject commit 9015e129bd7de389afa4196495451669700904d0
diff --git a/documentation20/cn/00.index/docs.md b/documentation20/cn/00.index/docs.md
index d94a58eebb129e84137a8c55b1ca07be37ec15af..da990323cebd81feb089c354395af3ee90ee599a 100644
--- a/documentation20/cn/00.index/docs.md
+++ b/documentation20/cn/00.index/docs.md
@@ -83,9 +83,10 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
* [Windows客户端](https://www.taosdata.com/blog/2019/07/26/514.html):自行编译windows客户端,Windows环境的各种连接器都需要它
* [Rust Connector](/connector/rust): Rust语言下通过libtaos客户端或RESTful接口,连接TDengine服务器。
-## [TDengine 组件与工具](/tools/adapter)
+## [TDengine 组件与工具](/cn/documentation/)
-* [taosAdapter用户手册](/tools/adapter)
+* [taosAdapter 用户手册](/tools/adapter)
+* [TDinsight 用户手册](/tools/insight)
## [与其他工具的连接](/connections)
diff --git a/documentation20/cn/02.getting-started/02.taosdemo/docs.md b/documentation20/cn/02.getting-started/02.taosdemo/docs.md
index 98e9ef79eb2a179109d4f7fef51573a9c9a4807d..c01c2efb514c22883bbc9a8bd07a974ba37d3019 100644
--- a/documentation20/cn/02.getting-started/02.taosdemo/docs.md
+++ b/documentation20/cn/02.getting-started/02.taosdemo/docs.md
@@ -364,7 +364,7 @@ taosdemo 不仅仅可以进行数据写入,也可以执行查询和订阅功
}
```
以下为 JSON 文件中和查询相关的特有参数含义:
-
+```
"query_times": 每种查询类型的查询次数
"query_mode": 查询数据接口,"taosc":调用TDengine的c接口;“resetful”:使用restfule接口。可选项。缺省是“taosc”。
"specified_table_query": { 指定表的查询
@@ -379,7 +379,7 @@ taosdemo 不仅仅可以进行数据写入,也可以执行查询和订阅功
"threads": 并发执行sqls的线程数,可选项,缺省是1。每个线程负责一部分子表,执行所有的sqls。
"sql": "select count(*) from xxxx"。查询超级表内所有子表的查询语句,其中表名必须写成 “xxxx”,实例会自动替换成子表名。
"result": 查询结果写入的文件名。可选项,缺省是空,表示查询结果不写入文件。
-
+```
以下为一个典型订阅 JSON 示例文件内容:
```
@@ -422,13 +422,13 @@ taosdemo 不仅仅可以进行数据写入,也可以执行查询和订阅功
}
```
以下为订阅功能相关的特有参数含义:
-
+```
"interval": 执行订阅的间隔,单位是秒。可选项,缺省是0。
"restart": 订阅重启。"yes":如果订阅已经存在,重新开始,"no": 继续之前的订阅。(请注意执行用户需要对 dataDir 目录有读写权限)
"keepProgress": 保留订阅信息进度。yes表示保留订阅信息,no表示不保留。该值为yes,restart为no时,才能继续之前的订阅。
"resubAfterConsume": 配合 keepProgress 使用,在订阅消费了相应次数后调用 unsubscribe 取消订阅并再次订阅。
"result": 查询结果写入的文件名。可选项,缺省是空,表示查询结果不写入文件。 注意:每条sql语句后的保存结果的文件不能重名,且生成结果文件时,文件名会附加线程号。
-
+```
结语
--
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。TDengine 由于数据库内核中创新的数据存储和查询引擎设计,展现出远超同类产品的高效性能。并且由于支持 SQL 语法和多种编程语言的连接器(目前支持 Java, Python, Go, C#, NodeJS, Rust 等),易用性极强,学习成本为零。为了便于运维需求,我们还提供数据迁移和监控功能等相关生态工具软件。
@@ -440,6 +440,7 @@ TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维
附录 - 完整 taosdemo 参数介绍
--
taosdemo支持两种配置参数的模式,一种是命令行参数,一种是使用 JSON 格式的配置文件。
+
一、命令行参数
-f:指定taosdemo所需参数的meta文件。当使用该参数时,其他所有命令行参数都失效。可选项,缺省是NULL。目前仅支持不含 BOM(byte-order mark)的标准 UTF-8 编码文件。
@@ -508,8 +509,9 @@ taosdemo支持两种配置参数的模式,一种是命令行参数,一种是
二、JSON 格式的配置文件中所有参数说明
taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个taosdemo实例不能同时支持三种功能,一个 taosdemo 实例只能支持其中的一种功能,通过配置文件来指定进行哪种功能的测试。
-1、插入功能测试的 JSON 配置文件
+1、插入功能测试的 JSON 配置文件
+```
{
"filetype": "insert",
"cfgdir": "/etc/taos",
@@ -571,6 +573,7 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
}]
}]
}
+```
"filetype": 本taosdemo实例进行哪种功能测试。"insert"表示数据插入功能。必选项。
@@ -600,7 +603,7 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
"databases": [{
-"dbinfo": { "name": 数据库名称。必选项。
+"dbinfo": {"name": 数据库名称。必选项。
"drop": 如果数据库已经存在,”yes“:删除后重建;”no“:不删除,直接使用。可选项,缺省是”no“。drop = yes 会使其他子表创建相关条目无效。
@@ -695,8 +698,9 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
"count":该类型的连续列个数,可选项,缺省是1。
}]
-2、查询功能测试的 JSON 配置文件
+2、查询功能测试的 JSON 配置文件
+```
{
"filetype": "query",
"cfgdir": "/etc/taos",
@@ -734,7 +738,7 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
]
}
}
-
+```
"filetype": 本taosdemo实例进行哪种功能测试。"query"表示数据查询功能。必选项。
@@ -784,8 +788,9 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
注意:每条sql语句后的保存结果的文件不能重名,且生成结果文件时,文件名会附加线程号。
查询结果显示:如果查询线程结束一次查询距开始执行时间超过30秒打印一次查询次数、用时和QPS。所有查询结束时,汇总打印总的查询次数和QPS。
-3、订阅功能测试的 JSON 配置文件
+3、订阅功能测试的 JSON 配置文件
+```
{
"filetype":"subscribe",
"cfgdir": "/etc/taos",
@@ -822,7 +827,8 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
"result": "./subscribe_res1.txt"
}]
}
- }
+}
+```
"filetype": 本taosdemo实例进行哪种功能测试。"subscribe"表示数据查询功能。必选项。**
@@ -878,4 +884,4 @@ taosdemo支持3种功能的测试,包括插入、查询、订阅。但一个ta
"sql": " select count(*) from xxxx "。查询语句,其中表名必须写成 “xxxx”,实例会自动替换成子表名。
- "result": 查询结果写入的文件名。可选项,缺省是空,表示查询结果不写入文件。 注意:每条sql语句后的保存结果的文件不能重名,且生成结果文件时,文件名会附加线程号。
+"result": 查询结果写入的文件名。可选项,缺省是空,表示查询结果不写入文件。 注意:每条sql语句后的保存结果的文件不能重名,且生成结果文件时,文件名会附加线程号。
diff --git a/documentation20/cn/02.getting-started/docs.md b/documentation20/cn/02.getting-started/docs.md
index 5f887df914ef06d40f3b3b8bf6ef8dfe18fe6ecf..f38522b5c257fdb3f72e833e72f14f4c9acdefb0 100644
--- a/documentation20/cn/02.getting-started/docs.md
+++ b/documentation20/cn/02.getting-started/docs.md
@@ -30,7 +30,7 @@ wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add -
echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-stable stable main" | sudo tee /etc/apt/sources.list.d/tdengine-stable.list
[ beta 版安装包仓库为可选安装项 ] echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-beta beta main" | sudo tee /etc/apt/sources.list.d/tdengine-beta.list
sudo apt-get update
-apt-get policy tdengine
+apt-cache policy tdengine
sudo apt-get install tdengine
```
diff --git a/documentation20/cn/05.insert/docs.md b/documentation20/cn/05.insert/docs.md
index 243d8509f069e5073cc15ee69438ff6e2cc28e3d..d32a23e9a187e662cf00e2fbe4864472a859b3e0 100644
--- a/documentation20/cn/05.insert/docs.md
+++ b/documentation20/cn/05.insert/docs.md
@@ -319,118 +319,9 @@ taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相
## 使用 Bailongma 2.0 接入 Telegraf 数据写入
-*注意:TDengine 新版本(2.3.0.0+)提供新版本 Bailongma ,命名为 taosAdapter ,提供更简便的 Telegraf 数据写入以及其他更强大的功能,Bailongma v2 即之前版本将逐步不再维护。
+**注意:**
+TDengine 新版本(2.3.0.0+)提供新版本 Bailongma ,命名为 taosAdapter ,提供更简便的 Telegraf 数据写入以及其他更强大的功能,Bailongma v2 及之前版本将逐步不再维护。
-[Telegraf](https://www.influxdata.com/time-series-platform/telegraf/)是一流行的IT运维数据采集开源工具,TDengine提供一个小工具[Bailongma](https://github.com/taosdata/Bailongma),只需在Telegraf做简单配置,无需任何代码,就可将Telegraf采集的数据直接写入TDengine,并按规则在TDengine自动创建库和相关表项。博文[用Docker容器快速搭建一个Devops监控Demo](https://www.taosdata.com/blog/2020/02/03/1189.html)即是采用bailongma将Prometheus和Telegraf的数据写入TDengine中的示例,可以参考。
-
-### 从源代码编译 blm_telegraf
-
-用户需要从github下载[Bailongma](https://github.com/taosdata/Bailongma)的源码,使用Golang语言编译器编译生成可执行文件。在开始编译前,需要准备好以下条件:
-
-- Linux操作系统的服务器
-- 安装好Golang,1.10版本以上
-- 对应的TDengine版本。因为用到了TDengine的客户端动态链接库,因此需要安装好和服务端相同版本的TDengine程序;比如服务端版本是TDengine 2.0.0, 则在Bailongma所在的Linux服务器(可以与TDengine在同一台服务器,或者不同服务器)
-
-Bailongma项目中有一个文件夹blm_telegraf,存放了Telegraf的写入API程序。编译过程如下:
-
-```bash
-cd blm_telegraf
-go build
-```
-
-一切正常的情况下,就会在对应的目录下生成一个blm_telegraf的可执行程序。
-
-### 安装 Telegraf
-
-目前TDengine支持Telegraf 1.7.4以上的版本。用户可以根据当前的操作系统,到Telegraf官网下载安装包,并执行安装。下载地址如下:https://portal.influxdata.com/downloads 。
-
-### 配置 Telegraf
-
-修改Telegraf配置文件/etc/telegraf/telegraf.conf中与TDengine有关的配置项。
-
-在output plugins部分,增加[[outputs.http]]配置项:
-
-- url:Bailongma API服务提供的URL,参考下面的启动示例章节
-- data_format:"json"
-- json_timestamp_units:"1ms"
-
-在agent部分:
-
-- hostname: 区分不同采集设备的机器名称,需确保其唯一性。
-- metric_batch_size: 100,允许Telegraf每批次写入记录最大数量,增大其数量可以降低Telegraf的请求发送频率。
-
-关于如何使用Telegraf采集数据以及更多有关使用Telegraf的信息,请参考Telegraf官方的[文档](https://docs.influxdata.com/telegraf/v1.11/)。
-
-### 启动 blm_telegraf 程序
-
-blm_telegraf程序有以下选项,在启动blm_telegraf程序时可以通过设定这些选项来设定blm_telegraf的配置。
-
-```bash
---host
-TDengine服务端的IP地址,缺省值为空。
-
---batch-size
-blm_telegraf会将收到的telegraf的数据拼装成TDengine的写入请求,这个参数控制一次发给TDengine的写入请求中携带的数据条数。
-
---dbname
-设置在TDengine中创建的数据库名称,blm_telegraf会自动在TDengine中创建一个以dbname为名称的数据库,缺省值是prometheus。
-
---dbuser
-设置访问TDengine的用户名,缺省值是'root'。
-
---dbpassword
-设置访问TDengine的密码,缺省值是'taosdata'。
-
---port
-blm_telegraf对telegraf提供服务的端口号。
-```
-
-### 启动示例
-
-通过以下命令启动一个blm_telegraf的API服务:
-```bash
-./blm_telegraf -host 127.0.0.1 -port 8089
-```
-
-假设blm_telegraf所在服务器的IP地址为"10.1.2.3",则在telegraf的配置文件中, 在output plugins部分,增加[[outputs.http]]配置项:
-
-```yaml
-url = "http://10.1.2.3:8089/telegraf"
-```
-
-### 查询 telegraf 写入数据
-
-telegraf产生的数据格式如下:
-```json
-{
- "fields": {
- "usage_guest": 0,
- "usage_guest_nice": 0,
- "usage_idle": 89.7897897897898,
- "usage_iowait": 0,
- "usage_irq": 0,
- "usage_nice": 0,
- "usage_softirq": 0,
- "usage_steal": 0,
- "usage_system": 5.405405405405405,
- "usage_user": 4.804804804804805
- },
-
- "name": "cpu",
- "tags": {
- "cpu": "cpu2",
- "host": "bogon"
- },
- "timestamp": 1576464360
-}
-```
-
-其中,name字段为telegraf采集的时序数据的名称,tags字段为该时序数据的标签。blm_telegraf会以时序数据的名称在TDengine中自动创建一个超级表,并将tags字段中的标签转换成TDengine的tag值,timestamp作为时间戳,fields字段中的值作为该时序数据的值。因此在TDengine的客户端中,可以通过以下指令查到这个数据是否成功写入。
-
-```mysql
-use telegraf;
-select * from cpu;
-```
## EMQ Broker 直接写入
diff --git a/documentation20/cn/08.connector/docs.md b/documentation20/cn/08.connector/docs.md
index 9203c2cc9e24a8aaa424bb9e2ee64bd23310cc99..7806de6093b422b40938b701d85c1512b32945ec 100644
--- a/documentation20/cn/08.connector/docs.md
+++ b/documentation20/cn/08.connector/docs.md
@@ -208,6 +208,8 @@ C/C++的API类似于MySQL的C API。应用程序使用时,需要包含TDengine
返回值为空表示失败。应用程序需要保存返回的参数,以便后续API调用。
+ **提示:** 同一进程可以根据不同的host/port 连接多个taosd 集群
+
- `char *taos_get_server_info(TAOS *taos)`
获取服务端版本信息。
diff --git a/documentation20/cn/11.administrator/docs.md b/documentation20/cn/11.administrator/docs.md
index 8ce6732efec4da35683913e8f73082f98f88f89d..7b7b2262d470f5226eef780a9971894a65663579 100644
--- a/documentation20/cn/11.administrator/docs.md
+++ b/documentation20/cn/11.administrator/docs.md
@@ -223,7 +223,6 @@ taosd -C
| 105 | compressColData | | **S** | bytes | 客户端与服务器之间进行消息通讯过程中,对服务器端查询结果进行列压缩的阈值。 | 0: 对所有查询结果均进行压缩 >0: 查询结果中任意列大小超过该值的消息才进行压缩 -1: 不压缩 | -1 | 2.3.0.0 版本新增。 |
| 106 | tsdbMetaCompactRatio | | **C** | | tsdb meta文件中冗余数据超过多少阈值,开启meta文件的压缩功能 | 0:不开启,[1-100]:冗余数据比例 | 0 | |
| 107 | rpcForceTcp | | **SC**| | 强制使用TCP传输 | 0: 不开启 1: 开启 | 0 | 在网络比较差的环境中,建议开启。2.0版本新增。|
-| 107 | rpcForceTcp | | **SC** | | 强制使用TCP传输。 | 0: 不开启 1: 开启 | 0 | 在网络比较差的环境中,建议开启。2.0 版本新增。 |
**注意:**对于端口,TDengine会使用从serverPort起13个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030到6042共13个端口,而且必须TCP和UDP都打开。(详细的端口情况请参见 [TDengine 2.0 端口说明](https://www.taosdata.com/cn/documentation/faq#port))
diff --git a/documentation20/en/00.index/docs.md b/documentation20/en/00.index/docs.md
index 28905c340a99223e480603ca3ba6151772bada47..ff494a2bd6f3dd63dc9926e3200c1f6214ca9ae1 100644
--- a/documentation20/en/00.index/docs.md
+++ b/documentation20/en/00.index/docs.md
@@ -79,9 +79,10 @@ TDengine is a highly efficient platform to store, query, and analyze time-series
- [Windows Client](https://www.taosdata.com/blog/2019/07/26/514.html): compile your own Windows client, which is required by various connectors on the Windows environment
- [Rust Connector](/connector/rust): A taosc/RESTful API based TDengine client for Rust
-## [Components and Tools](/tools/adapter)
+## [Components and Tools](/cn/documentation/)
-* [taosAdapter](/tools/adapter)
+* [taosAdapter User Manual](/tools/adapter)
+* [TDinsight User Manual](/tools/insight)
## [Connections with Other Tools](/connections)
diff --git a/documentation20/en/02.getting-started/02.taosdemo/docs.md b/documentation20/en/02.getting-started/02.taosdemo/docs.md
index 750983c85e8ebcd896587df98af83ce20b23ac28..c872d2971ef3cce250592df0534af5369c4682dd 100644
--- a/documentation20/en/02.getting-started/02.taosdemo/docs.md
+++ b/documentation20/en/02.getting-started/02.taosdemo/docs.md
@@ -374,7 +374,7 @@ The following is the content of a typical query JSON example file.
}
```
The following parameters are specific to the query in the JSON file.
-
+```
"query_times": the number of queries per query type
"query_mode": query data interface, "tosc": call TDengine's c interface; "resetful": use restfule interface. Options are available. Default is "taosc".
"specified_table_query": { query for the specified table
@@ -389,7 +389,7 @@ The following parameters are specific to the query in the JSON file.
"threads": the number of threads to execute sqls concurrently, optional, default is 1. Each thread is responsible for a part of sub-tables and executes all sqls.
"sql": "select count(*) from xxxx". Query statement for all sub-tables in the super table, where the table name must be written as "xxxx" and the instance will be replaced with the sub-table name automatically.
"result": the name of the file to which the query result is written. Optional, the default is null, which means the query results are not written to a file.
-
+```
The following is a typical subscription JSON example file content.
```
@@ -432,13 +432,13 @@ The following is a typical subscription JSON example file content.
}
```
The following are the meanings of the parameters specific to the subscription function.
-
+```
"interval": interval for executing subscriptions, in seconds. Optional, default is 0.
"restart": subscription restart." yes": restart the subscription if it already exists, "no": continue the previous subscription. (Please note that the executing user needs to have read/write access to the dataDir directory)
"keepProgress": keep the progress of the subscription information. yes means keep the subscription information, no means don't keep it. The value is yes and restart is no to continue the previous subscriptions.
"resubAfterConsume": Used in conjunction with keepProgress to call unsubscribe after the subscription has been consumed the appropriate number of times and to subscribe again.
"result": the name of the file to which the query result is written. Optional, default is null, means the query result will not be written to the file. Note: The file to save the result after each sql statement cannot be renamed, and the file name will be appended with the thread number when generating the result file.
-
+```
Conclusion
--
TDengine is a big data platform designed and optimized for IoT, Telematics, Industrial Internet, DevOps, etc. TDengine shows a high performance that far exceeds similar products due to the innovative data storage and query engine design in the database kernel. And withSQL syntax support and connectors for multiple programming languages (currently Java, Python, Go, C#, NodeJS, Rust, etc. are supported), it is extremely easy to use and has zero learning cost. To facilitate the operation and maintenance needs, we also provide data migration and monitoring functions and other related ecological tools and software.
diff --git a/documentation20/en/05.insert/docs.md b/documentation20/en/05.insert/docs.md
index 7abecfda380b1219a6c5d407d48e7876eecd55ea..aa8ea7dde45959347bbc8f51da012fa864e5bf46 100644
--- a/documentation20/en/05.insert/docs.md
+++ b/documentation20/en/05.insert/docs.md
@@ -1,6 +1,6 @@
# Efficient Data Writing
-TDengine supports multiple ways to write data, including SQL, Prometheus, Telegraf, EMQ MQTT Broker, HiveMQ Broker, CSV file, etc. Kafka, OPC and other interfaces will be provided in the future. Data can be inserted in one single record or in batches, data from one or multiple data collection points can be inserted at the same time. TDengine supports multi-thread insertion, out-of-order data insertion, and also historical data insertion.
+TDengine supports multiple ways to write data, including SQL, Prometheus, Telegraf, collectd, StatsD, EMQ MQTT Broker, HiveMQ Broker, CSV file, etc. Kafka, OPC and other interfaces will be provided in the future. Data can be inserted in one single record or in batches, data from one or multiple data collection points can be inserted at the same time. TDengine supports multi-thread insertion, out-of-order data insertion, and also historical data insertion.
## Data Writing via SQL
@@ -141,141 +141,84 @@ use prometheus;
select * from apiserver_request_latencies_bucket;
```
+## Data Writing via Telegraf and taosAdapter
+Please refer to [Official document](https://portal.influxdata.com/downloads/) for Telegraf installation.
+TDengine version 2.3.0.0+ includes a stand-alone application taosAdapter in charge of receive data insertion from Telegraf.
-## Data Writing via Telegraf
-
-[Telegraf](https://www.influxdata.com/time-series-platform/telegraf/) is a popular open source tool for IT operation data collection. TDengine provides a simple tool [Bailongma](https://github.com/taosdata/Bailongma), which only needs to be simply configured in Telegraf without any code, and can directly write the data collected by Telegraf into TDengine, then automatically create databases and related table entries in TDengine according to rules. Blog post [Use Docker Container to Quickly Build a Devops Monitoring Demo](https://www.taosdata.com/blog/2020/02/03/1189.html), which is an example of using bailongma to write Prometheus and Telegraf data into TDengine.
-
-### Compile blm_telegraf From Source Code
-
-Users need to download the source code of [Bailongma](https://github.com/taosdata/Bailongma) from github, then compile and generate an executable file using Golang language compiler. Before you start compiling, you need to complete following prepares:
-
-- A server running Linux OS
-- Golang version 1.10 and higher installed
-- An appropriated TDengine version. Because the client dynamic link library of TDengine is used, it is necessary to install the same version of TDengine as the server-side; for example, if the server version is TDengine 2.0. 0, ensure install the same version on the linux server where bailongma is located (can be on the same server as TDengine, or on a different server)
-
-Bailongma project has a folder, blm_telegraf, which holds the Telegraf writing API. The compiling process is as follows:
-
-```bash
-cd blm_telegraf
-
-go build
+Configuration:
+Please add following words in /etc/telegraf/telegraf.conf. Fill 'database name' with the database name you want to store in the TDengine for Telegraf data. Please fill the values in TDengine server/cluster host, username and password fields.
+```
+[[outputs.http]]
+ url = "http://:6041/influxdb/v1/write?db="
+ method = "POST"
+ timeout = "5s"
+ username = ""
+ password = ""
+ data_format = "influx"
+ influx_max_line_bytes = 250
```
-If everything goes well, an executable of blm_telegraf will be generated in the corresponding directory.
-
-### Install Telegraf
-
-At the moment, TDengine supports Telegraf version 1.7. 4 and above. Users can download the installation package on Telegraf's website according to your current operating system. The download address is as follows: https://portal.influxdata.com/downloads
-
-### Configure Telegraf
-
-Modify the TDengine-related configurations in the Telegraf configuration file /etc/telegraf/telegraf.conf.
-
-In the output plugins section, add the [[outputs.http]] configuration:
-
-- url: The URL provided by bailongma API service, please refer to the example section below
-- data_format: "json"
-- json_timestamp_units: "1ms"
-
-In agent section:
-
-- hostname: The machine name that distinguishes different collection devices, and it is necessary to ensure its uniqueness
-- metric_batch_size: 100, which is the max number of records per batch written by Telegraf allowed. Increasing the number can reduce the request sending frequency of Telegraf.
-
-For information on how to use Telegraf to collect data and more about using Telegraf, please refer to the official [document](https://docs.influxdata.com/telegraf/v1.11/) of Telegraf.
-
-### Launch blm_telegraf
-
-blm_telegraf has following options, which can be set to tune configurations of blm_telegraf when launching.
-
-```sh
---host
-
-The ip address of TDengine server, default is null
-
---batch-size
-
-blm_prometheus assembles the received telegraf data into a TDengine writing request. This parameter controls the number of data pieces carried in a writing request sent to TDengine at a time.
-
---dbname
-
-Set a name for the database created in TDengine, blm_telegraf will automatically create a database named dbname in TDengine, and the default value is prometheus.
-
---dbuser
+Then restart telegraf:
+```
+sudo systemctl start telegraf
+```
+Now you can query the metrics data of Telegraf from TDengine.
-Set the user name to access TDengine, the default value is 'root '
+Please find taosAdapter configuration and usage from `taosadapter --help` output.
---dbpassword
+## collectd 直接写入(通过 taosAdapter)
+Please refer to [official document](https://collectd.org/download.shtml) for collectd installation.
-Set the password to access TDengine, the default value is'taosdata '
+TDengine version 2.3.0.0+ includes a stand-alone application taosAdapter in charge of receive data insertion from collectd.
---port
-
-The port number blm_telegraf used to serve Telegraf.
+Configuration:
+Please add following words in /etc/collectd/collectd.conf. Please fill the value 'host' and 'port' with what the TDengine and taosAdapter using.
```
+LoadPlugin network
+
+ Server "" ""
+
+```
+Then restart collectd
+```
+sudo systemctl start collectd
+```
+Please find taosAdapter configuration and usage from `taosadapter --help` output.
+## StatsD 直接写入(通过 taosAdapter)
+Please refer to [official document](https://github.com/statsd/statsd) for StatsD installation.
+TDengine version 2.3.0.0+ includes a stand-alone application taosAdapter in charge of receive data insertion from StatsD.
-### Example
-
-Launch an API service for blm_telegraf with the following command
-
-```bash
-./blm_telegraf -host 127.0.0.1 -port 8089
+Please add following words in the config.js file. Please fill the value to 'host' and 'port' with what the TDengine and taosAdapter using.
```
-
-Assuming that the IP address of the server where blm_telegraf located is "10.1.2. 3", the URL shall be added to the configuration file of telegraf as:
-
-```yaml
-url = "http://10.1.2.3:8089/telegraf"
+add "./backends/repeater" to backends section.
+add { host:'', port: } to repeater section.
```
-### Query written data of telegraf
-
-The format of generated data by telegraf is as follows:
-
-```json
+Example file:
+```
{
- "fields": {
- "usage_guest": 0,
- "usage_guest_nice": 0,
- "usage_idle": 89.7897897897898,
- "usage_iowait": 0,
- "usage_irq": 0,
- "usage_nice": 0,
- "usage_softirq": 0,
- "usage_steal": 0,
- "usage_system": 5.405405405405405,
- "usage_user": 4.804804804804805
- },
-
- "name": "cpu",
- "tags": {
- "cpu": "cpu2",
- "host": "bogon"
- },
- "timestamp": 1576464360
+port: 8125
+, backends: ["./backends/repeater"]
+, repeater: [{ host: '127.0.0.1', port: 6044}]
}
```
-Where the name field is the name of the time-series data collected by telegraf, and the tag field is the tag of the time-series data. blm_telegraf automatically creates a STable in TDengine with the name of the time series data, and converts the tag field into the tag value of TDengine, with Timestamp as the timestamp and fields values as the value of the time-series data. Therefore, in the client of TDEngine, you can check whether this data was successfully written through the following instruction.
+Please find taosAdapter configuration and usage from `taosadapter --help` output.
-```mysql
-use telegraf;
-select * from cpu;
-```
+## Insert data via Bailongma 2.0 and Telegraf
+
+**Notice:**
+TDengine 2.3.0.0+ provides taosAdapter to support Telegraf data writing. Bailongma v2 will be abandoned and no more maintained.
-MQTT is a popular data transmission protocol in the IoT. TDengine can easily access the data received by MQTT Broker and write it to TDengine.
## Data Writing via EMQ Broker
[EMQ](https://github.com/emqx/emqx) is an open source MQTT Broker software, with no need of coding, only to use "rules" in EMQ Dashboard for simple configuration, and MQTT data can be directly written into TDengine. EMQ X supports storing data to the TDengine by sending it to a Web service, and also provides a native TDengine driver on Enterprise Edition for direct data store. Please refer to [EMQ official documents](https://docs.emqx.io/broker/latest/cn/rule/rule-example.html#%E4%BF%9D%E5%AD%98%E6%95%B0%E6%8D%AE%E5%88%B0-tdengine) for more details.
-
-
## Data Writing via HiveMQ Broker
-[HiveMQ](https://www.hivemq.com/) is an MQTT agent that provides Free Personal and Enterprise Edition versions. It is mainly used for enterprises, emerging machine-to-machine(M2M) communication and internal transmission to meet scalability, easy management and security features. HiveMQ provides an open source plug-in development kit. You can store data to TDengine via HiveMQ extension-TDengine. Refer to the [HiveMQ extension-TDengine documentation](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md) for more details.
\ No newline at end of file
+[HiveMQ](https://www.hivemq.com/) is an MQTT agent that provides Free Personal and Enterprise Edition versions. It is mainly used for enterprises, emerging machine-to-machine(M2M) communication and internal transmission to meet scalability, easy management and security features. HiveMQ provides an open source plug-in development kit. You can store data to TDengine via HiveMQ extension-TDengine. Refer to the [HiveMQ extension-TDengine documentation](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md) for more details.
diff --git a/documentation20/en/08.connector/docs.md b/documentation20/en/08.connector/docs.md
index 2a67c65c16ea11873e65c87fb6d059ac82dfc9ec..b3b4dedabbbc55f554541710c4e0d8abd8e5c892 100644
--- a/documentation20/en/08.connector/docs.md
+++ b/documentation20/en/08.connector/docs.md
@@ -200,6 +200,8 @@ Create a database connection and initialize the connection context. The paramete
* port: Port number
A null return value indicates a failure. The application needs to save the returned parameters for subsequent API calls.
+Note: The same process can connect to multiple taosd processes based on ip/port
+
- `char *taos_get_server_info(TAOS *taos)`
diff --git a/packaging/check_package.sh b/packaging/check_package.sh
index e625f90912825f30ba279ecf6dbe59ff7dade97f..81abff57a586d116ead0137f96697ece04250d6b 100755
--- a/packaging/check_package.sh
+++ b/packaging/check_package.sh
@@ -50,7 +50,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
# ============================= get input parameters =================================================
@@ -85,7 +85,7 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
diff --git a/packaging/deb/DEBIAN/postinst b/packaging/deb/DEBIAN/postinst
index 556e757c2bfced34c43283c0de39baaacb95003f..2638f096250b8fa52277573f14a6f0f07b335b32 100644
--- a/packaging/deb/DEBIAN/postinst
+++ b/packaging/deb/DEBIAN/postinst
@@ -5,9 +5,9 @@ insmetaPath="/usr/local/taos/script"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
-${csudo} chmod -R 744 ${insmetaPath}
+${csudo}chmod -R 744 ${insmetaPath}
cd ${insmetaPath}
-${csudo} ./post.sh
+${csudo}./post.sh
diff --git a/packaging/deb/DEBIAN/preinst b/packaging/deb/DEBIAN/preinst
index 4b8b72e9abd9e12d9f669cf5658be2468ebab40b..5217a8229571bf993c6c3df8f82beb1ed67c3e96 100644
--- a/packaging/deb/DEBIAN/preinst
+++ b/packaging/deb/DEBIAN/preinst
@@ -2,19 +2,19 @@
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
# Stop the service if running
if pidof taosd &> /dev/null; then
if pidof systemd &> /dev/null; then
- ${csudo} systemctl stop taosd || :
+ ${csudo}systemctl stop taosd || :
elif $(which service &> /dev/null); then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
fi
echo "Stop taosd service success!"
@@ -25,16 +25,16 @@ fi
cfg_install_dir="/etc/taos"
install_main_dir="/usr/local/taos"
if [ -f "${install_main_dir}/taos.cfg" ]; then
- ${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
+ ${csudo}rm -f ${install_main_dir}/cfg/taos.cfg || :
fi
if [ -f "${install_main_dir}/taosadapter.toml" ]; then
- ${csudo} rm -f ${install_main_dir}/cfg/taosadapter.toml || :
+ ${csudo}rm -f ${install_main_dir}/cfg/taosadapter.toml || :
fi
if [ -f "${install_main_dir}/taosadapter.service" ]; then
- ${csudo} rm -f ${install_main_dir}/cfg/taosadapter.service || :
+ ${csudo}rm -f ${install_main_dir}/cfg/taosadapter.service || :
fi
# there can not libtaos.so*, otherwise ln -s error
-${csudo} rm -f ${install_main_dir}/driver/libtaos* || :
+${csudo}rm -f ${install_main_dir}/driver/libtaos* || :
diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm
index b6979cf26435e4c4b0d19f5c93bb92cda988b3bf..c01db74701f99e52cc45b589d8fe7b07c4c8afe1 100644
--- a/packaging/deb/DEBIAN/prerm
+++ b/packaging/deb/DEBIAN/prerm
@@ -4,15 +4,15 @@ insmetaPath="/usr/local/taos/script"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
-${csudo} chmod -R 744 ${insmetaPath} || :
+${csudo}chmod -R 744 ${insmetaPath} || :
#cd ${insmetaPath}
-#${csudo} ./preun.sh
+#${csudo}./preun.sh
if [ -f ${insmetaPath}/preun.sh ]; then
cd ${insmetaPath}
- ${csudo} ./preun.sh
+ ${csudo}./preun.sh
else
bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib"
@@ -23,20 +23,20 @@ else
cfg_link_dir="/usr/local/taos/cfg"
# Remove all links
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosd || :
- ${csudo} rm -f ${bin_link_dir}/taosadapter || :
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
- ${csudo} rm -f ${cfg_link_dir}/* || :
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosd || :
+ ${csudo}rm -f ${bin_link_dir}/taosadapter || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${log_link_dir} || :
- ${csudo} rm -f ${data_link_dir} || :
+ ${csudo}rm -f ${log_link_dir} || :
+ ${csudo}rm -f ${data_link_dir} || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
fi
diff --git a/packaging/release.sh b/packaging/release.sh
index ca8715f68430fc08b86f008936ddfc9409ae58a8..fd2266792ebf9ed419ef3dee1ee6e146e4e9534f 100755
--- a/packaging/release.sh
+++ b/packaging/release.sh
@@ -113,7 +113,7 @@ fi
csudo=""
#if command -v sudo > /dev/null; then
-# csudo="sudo"
+# csudo="sudo "
#fi
function is_valid_version() {
@@ -183,11 +183,11 @@ cd ${curr_dir}
# 2. cmake executable file
compile_dir="${top_dir}/debug"
if [ -d ${compile_dir} ]; then
- ${csudo} rm -rf ${compile_dir}
+ ${csudo}rm -rf ${compile_dir}
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${compile_dir}
+ ${csudo}mkdir -p ${compile_dir}
else
mkdir -p ${compile_dir}
fi
@@ -496,9 +496,9 @@ fi
if [[ "$allocator" == "jemalloc" ]]; then
# jemalloc need compile first, so disable parallel build
- make -j 8 && ${csudo} make install
+ make -j 8 && ${csudo}make install
else
- make -j 8 && ${csudo} make install
+ make -j 8 && ${csudo}make install
fi
cd ${curr_dir}
@@ -512,11 +512,11 @@ if [ "$osType" != "Darwin" ]; then
echo "====do deb package for the ubuntu system===="
output_dir="${top_dir}/debs"
if [ -d ${output_dir} ]; then
- ${csudo} rm -rf ${output_dir}
+ ${csudo}rm -rf ${output_dir}
fi
- ${csudo} mkdir -p ${output_dir}
+ ${csudo}mkdir -p ${output_dir}
cd ${script_dir}/deb
- ${csudo} ./makedeb.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType}
+ ${csudo}./makedeb.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType}
if [[ "$pagMode" == "full" ]]; then
if [ -d ${top_dir}/src/kit/taos-tools/packaging/deb ]; then
@@ -524,7 +524,7 @@ if [ "$osType" != "Darwin" ]; then
[ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
taos_tools_ver=$(git describe --tags|sed -e 's/ver-//g'|awk -F '-' '{print $1}')
- ${csudo} ./make-taos-tools-deb.sh ${top_dir} \
+ ${csudo}./make-taos-tools-deb.sh ${top_dir} \
${compile_dir} ${output_dir} ${taos_tools_ver} ${cpuType} ${osType} ${verMode} ${verType}
fi
fi
@@ -537,11 +537,11 @@ if [ "$osType" != "Darwin" ]; then
echo "====do rpm package for the centos system===="
output_dir="${top_dir}/rpms"
if [ -d ${output_dir} ]; then
- ${csudo} rm -rf ${output_dir}
+ ${csudo}rm -rf ${output_dir}
fi
- ${csudo} mkdir -p ${output_dir}
+ ${csudo}mkdir -p ${output_dir}
cd ${script_dir}/rpm
- ${csudo} ./makerpm.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType}
+ ${csudo}./makerpm.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType}
if [[ "$pagMode" == "full" ]]; then
if [ -d ${top_dir}/src/kit/taos-tools/packaging/rpm ]; then
@@ -549,7 +549,7 @@ if [ "$osType" != "Darwin" ]; then
[ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
taos_tools_ver=$(git describe --tags|sed -e 's/ver-//g'|awk -F '-' '{print $1}'|sed -e 's/-/_/g')
- ${csudo} ./make-taos-tools-rpm.sh ${top_dir} \
+ ${csudo}./make-taos-tools-rpm.sh ${top_dir} \
${compile_dir} ${output_dir} ${taos_tools_ver} ${cpuType} ${osType} ${verMode} ${verType}
fi
fi
@@ -562,29 +562,29 @@ if [ "$osType" != "Darwin" ]; then
cd ${script_dir}/tools
if [[ "$dbName" == "taos" ]]; then
- ${csudo} ./makepkg.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${verNumberComp}
- ${csudo} ./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
- ${csudo} ./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makepkg.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${verNumberComp}
+ ${csudo}./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
elif [[ "$dbName" == "tq" ]]; then
- ${csudo} ./makepkg_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
- ${csudo} ./makeclient_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
- ${csudo} ./makearbi_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makepkg_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
+ ${csudo}./makeclient_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
+ ${csudo}./makearbi_tq.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
elif [[ "$dbName" == "pro" ]]; then
- ${csudo} ./makepkg_pro.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
- ${csudo} ./makeclient_pro.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
- ${csudo} ./makearbi_pro.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makepkg_pro.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
+ ${csudo}./makeclient_pro.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
+ ${csudo}./makearbi_pro.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
elif [[ "$dbName" == "kh" ]]; then
- ${csudo} ./makepkg_kh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
- ${csudo} ./makeclient_kh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
- ${csudo} ./makearbi_kh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makepkg_kh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
+ ${csudo}./makeclient_kh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
+ ${csudo}./makearbi_kh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
elif [[ "$dbName" == "jh" ]]; then
- ${csudo} ./makepkg_jh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
- ${csudo} ./makeclient_jh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
- ${csudo} ./makearbi_jh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makepkg_jh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
+ ${csudo}./makeclient_jh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
+ ${csudo}./makearbi_jh.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
else
- ${csudo} ./makepkg_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
- ${csudo} ./makeclient_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
- ${csudo} ./makearbi_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
+ ${csudo}./makepkg_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} ${verNumberComp}
+ ${csudo}./makeclient_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
+ ${csudo}./makearbi_power.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
fi
else
# only make client for Darwin
diff --git a/packaging/rpm/makerpm.sh b/packaging/rpm/makerpm.sh
index b4cf3d1450619f6a43a5303afa45f71c4402c2e7..4ac67ec754ce230f9a777570c42a9300c757978d 100755
--- a/packaging/rpm/makerpm.sh
+++ b/packaging/rpm/makerpm.sh
@@ -28,7 +28,7 @@ echo "spec_file: ${spec_file}"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function cp_rpm_package() {
@@ -49,17 +49,17 @@ function cp_rpm_package() {
}
if [ -d ${pkg_dir} ]; then
- ${csudo} rm -rf ${pkg_dir}
+ ${csudo}rm -rf ${pkg_dir}
fi
-${csudo} mkdir -p ${pkg_dir}
+${csudo}mkdir -p ${pkg_dir}
cd ${pkg_dir}
-${csudo} mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
+${csudo}mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
-${csudo} rpmbuild --define="_version ${tdengine_ver}" --define="_topdir ${pkg_dir}" --define="_compiledir ${compile_dir}" -bb ${spec_file}
+${csudo}rpmbuild --define="_version ${tdengine_ver}" --define="_topdir ${pkg_dir}" --define="_compiledir ${compile_dir}" -bb ${spec_file}
# copy rpm package to output_dir, and modify package name, then clean temp dir
-#${csudo} cp -rf RPMS/* ${output_dir}
+#${csudo}cp -rf RPMS/* ${output_dir}
cp_rpm_package ${pkg_dir}/RPMS
@@ -84,4 +84,4 @@ fi
mv ${output_dir}/TDengine-${tdengine_ver}.rpm ${output_dir}/${rpmname}
cd ..
-${csudo} rm -rf ${pkg_dir}
+${csudo}rm -rf ${pkg_dir}
diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec
index e1a8a9f9f6aee3ebe7fbcdacd579235cde7165e8..3a8153ff2bf791d0660cd81c2081af829a79e751 100644
--- a/packaging/rpm/tdengine.spec
+++ b/packaging/rpm/tdengine.spec
@@ -128,19 +128,19 @@ fi
%pre
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
# Stop the service if running
if pidof taosd &> /dev/null; then
if pidof systemd &> /dev/null; then
- ${csudo} systemctl stop taosd || :
+ ${csudo}systemctl stop taosd || :
elif $(which service &> /dev/null); then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
fi
echo "Stop taosd service success!"
@@ -148,40 +148,40 @@ if pidof taosd &> /dev/null; then
fi
# if taos.cfg already exist, remove it
if [ -f %{cfg_install_dir}/taos.cfg ]; then
- ${csudo} rm -f %{cfg_install_dir}/cfg/taos.cfg || :
+ ${csudo}rm -f %{cfg_install_dir}/cfg/taos.cfg || :
fi
# if taosadapter.toml already exist, remove it
if [ -f %{cfg_install_dir}/taosadapter.toml ]; then
- ${csudo} rm -f %{cfg_install_dir}/cfg/taosadapter.toml || :
+ ${csudo}rm -f %{cfg_install_dir}/cfg/taosadapter.toml || :
fi
# there can not libtaos.so*, otherwise ln -s error
-${csudo} rm -f %{homepath}/driver/libtaos* || :
+${csudo}rm -f %{homepath}/driver/libtaos* || :
#Scripts executed after installation
%post
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
cd %{homepath}/script
-${csudo} ./post.sh
+${csudo}./post.sh
# Scripts executed before uninstall
%preun
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
# only remove package to call preun.sh, not but update(2)
if [ $1 -eq 0 ];then
#cd %{homepath}/script
- #${csudo} ./preun.sh
+ #${csudo}./preun.sh
if [ -f %{homepath}/script/preun.sh ]; then
cd %{homepath}/script
- ${csudo} ./preun.sh
+ ${csudo}./preun.sh
else
bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib"
@@ -192,21 +192,21 @@ if [ $1 -eq 0 ];then
cfg_link_dir="/usr/local/taos/cfg"
# Remove all links
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosd || :
- ${csudo} rm -f ${bin_link_dir}/taosadapter || :
- ${csudo} rm -f ${cfg_link_dir}/* || :
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
-
- ${csudo} rm -f ${log_link_dir} || :
- ${csudo} rm -f ${data_link_dir} || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosd || :
+ ${csudo}rm -f ${bin_link_dir}/taosadapter || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+
+ ${csudo}rm -f ${log_link_dir} || :
+ ${csudo}rm -f ${data_link_dir} || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
fi
fi
@@ -218,9 +218,9 @@ fi
%clean
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
-${csudo} rm -rf %{buildroot}
+${csudo}rm -rf %{buildroot}
#Specify the files to be packaged
%files
diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh
index 6d007c0dd1527c281b09bf1f3623eab873b235d6..511b3003e857ca410e0f91bf4af4d268a32adace 100755
--- a/packaging/tools/install.sh
+++ b/packaging/tools/install.sh
@@ -50,7 +50,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -157,103 +157,103 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
if [ "$verMode" == "cluster" ]; then
- ${csudo} mkdir -p ${nginx_dir}
+ ${csudo}mkdir -p ${nginx_dir}
fi
if [[ -e ${script_dir}/email ]]; then
- ${csudo} cp ${script_dir}/email ${install_main_dir}/ ||:
+ ${csudo}cp ${script_dir}/email ${install_main_dir}/ ||:
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosd || :
- ${csudo} rm -f ${bin_link_dir}/taosadapter || :
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
- ${csudo} rm -f ${bin_link_dir}/taosdump || :
- ${csudo} rm -f ${bin_link_dir}/rmtaos || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
-
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosd || :
+ ${csudo}rm -f ${bin_link_dir}/taosadapter || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${bin_link_dir}/taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmtaos || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
+
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
- [ -x ${install_main_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || :
- [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo} ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || :
- [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
- [ -x ${install_main_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
- [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/taos ] && ${csudo}ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
+ [ -x ${install_main_dir}/bin/taosd ] && ${csudo}ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || :
+ [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || :
+ [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
+ [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
+ [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
if [ "$verMode" == "cluster" ]; then
- ${csudo} cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo} chmod 0555 ${nginx_dir}/*
- ${csudo} mkdir -p ${nginx_dir}/logs
- ${csudo} chmod 777 ${nginx_dir}/sbin/nginx
+ ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/*
+ ${csudo}mkdir -p ${nginx_dir}/logs
+ ${csudo}chmod 777 ${nginx_dir}/sbin/nginx
fi
}
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
#if [ "$verMode" == "cluster" ]; then
# # Compatible with version 1.5
- # ${csudo} mkdir -p ${v15_java_app_dir}
- # ${csudo} ln -s ${install_main_dir}/connector/taos-jdbcdriver-1.0.2-dist.jar ${v15_java_app_dir}/JDBCDriver-1.0.2-dist.jar
- # ${csudo} chmod 777 ${v15_java_app_dir} || :
+ # ${csudo}mkdir -p ${v15_java_app_dir}
+ # ${csudo}ln -s ${install_main_dir}/connector/taos-jdbcdriver-1.0.2-dist.jar ${v15_java_app_dir}/JDBCDriver-1.0.2-dist.jar
+ # ${csudo}chmod 777 ${v15_java_app_dir} || :
#fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_avro() {
if [ "$osType" != "Darwin" ]; then
avro_dir=${script_dir}/avro
if [ -f "${avro_dir}/lib/libavro.so.23.0.0" ] && [ -d /usr/local/$1 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/$1
- ${csudo} /usr/bin/install -c -m 755 ${avro_dir}/lib/libavro.so.23.0.0 /usr/local/$1
- ${csudo} ln -sf /usr/local/$1/libavro.so.23.0.0 /usr/local/$1/libavro.so.23
- ${csudo} ln -sf /usr/local/$1/libavro.so.23 /usr/local/$1/libavro.so
+ ${csudo}/usr/bin/install -c -d /usr/local/$1
+ ${csudo}/usr/bin/install -c -m 755 ${avro_dir}/lib/libavro.so.23.0.0 /usr/local/$1
+ ${csudo}ln -sf /usr/local/$1/libavro.so.23.0.0 /usr/local/$1/libavro.so.23
+ ${csudo}ln -sf /usr/local/$1/libavro.so.23 /usr/local/$1/libavro.so
- ${csudo} /usr/bin/install -c -d /usr/local/$1
+ ${csudo}/usr/bin/install -c -d /usr/local/$1
[ -f ${avro_dir}/lib/libavro.a ] &&
- ${csudo} /usr/bin/install -c -m 755 ${avro_dir}/lib/libavro.a /usr/local/$1
+ ${csudo}/usr/bin/install -c -m 755 ${avro_dir}/lib/libavro.a /usr/local/$1
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/$1" | ${csudo} tee /etc/ld.so.conf.d/libavro.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/libavro.conf"
- ${csudo} ldconfig
+ echo "/usr/local/$1" | ${csudo}tee /etc/ld.so.conf.d/libavro.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/libavro.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -265,49 +265,49 @@ function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -315,11 +315,11 @@ function install_jemalloc() {
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function add_newHostname_to_hosts() {
@@ -335,7 +335,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -349,7 +349,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -362,15 +362,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -405,7 +405,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
serverFqdn=$localFqdn
echo
return
@@ -427,7 +427,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
serverFqdn=$localFqdn
break
fi
@@ -475,32 +475,32 @@ function local_fqdn_check() {
function install_taosadapter_config() {
if [ ! -f "${cfg_install_dir}/taosadapter.toml" ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/taosadapter.toml ] && ${csudo} cp ${script_dir}/cfg/taosadapter.toml ${cfg_install_dir}
- [ -f ${cfg_install_dir}/taosadapter.toml ] && ${csudo} chmod 644 ${cfg_install_dir}/taosadapter.toml
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/taosadapter.toml ] && ${csudo}cp ${script_dir}/cfg/taosadapter.toml ${cfg_install_dir}
+ [ -f ${cfg_install_dir}/taosadapter.toml ] && ${csudo}chmod 644 ${cfg_install_dir}/taosadapter.toml
fi
[ -f ${script_dir}/cfg/taosadapter.toml ] &&
- ${csudo} cp -f ${script_dir}/cfg/taosadapter.toml ${cfg_install_dir}/taosadapter.toml.new
+ ${csudo}cp -f ${script_dir}/cfg/taosadapter.toml ${cfg_install_dir}/taosadapter.toml.new
[ -f ${cfg_install_dir}/taosadapter.toml ] &&
- ${csudo} ln -s ${cfg_install_dir}/taosadapter.toml ${install_main_dir}/cfg/taosadapter.toml
+ ${csudo}ln -s ${cfg_install_dir}/taosadapter.toml ${install_main_dir}/cfg/taosadapter.toml
[ ! -z $1 ] && return 0 || : # only install client
}
function install_config() {
- #${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
+ #${csudo}rm -f ${install_main_dir}/cfg/taos.cfg || :
if [ ! -f "${cfg_install_dir}/taos.cfg" ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo} cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo}cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/taos.cfg ${cfg_install_dir}/taos.cfg.new
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/taos.cfg ${cfg_install_dir}/taos.cfg.new
+ ${csudo}ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
[ ! -z $1 ] && return 0 || : # only install client
@@ -530,7 +530,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -553,7 +553,7 @@ function install_config() {
#if [[ "$emailAddr" =~ $EMAIL_PATTERN ]]; then
# Write the email address to temp file
email_file="${install_main_dir}/email"
- ${csudo} bash -c "echo $emailAddr > ${email_file}"
+ ${csudo}bash -c "echo $emailAddr > ${email_file}"
break
#else
# read -p "Please enter the correct email address: " emailAddr
@@ -566,69 +566,69 @@ function install_config() {
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/ ${install_main_dir}/
+ ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
function clean_service_on_sysvinit() {
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof taosd &> /dev/null; then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
fi
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/taosd ]; then
- ${csudo} chkconfig --del taosd || :
+ ${csudo}chkconfig --del taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/taosd ]; then
- ${csudo} insserv -r taosd || :
+ ${csudo}insserv -r taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/taosd ]; then
- ${csudo} update-rc.d -f taosd remove || :
+ ${csudo}update-rc.d -f taosd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/taosd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/taosd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -639,33 +639,33 @@ function install_service_on_sysvinit() {
# Install taosd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/taosd.deb ${install_main_dir}/init.d/taosd
- ${csudo} cp ${script_dir}/init.d/taosd.deb ${service_config_dir}/taosd && ${csudo} chmod a+x ${service_config_dir}/taosd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/taosd.deb ${install_main_dir}/init.d/taosd
+ ${csudo}cp ${script_dir}/init.d/taosd.deb ${service_config_dir}/taosd && ${csudo}chmod a+x ${service_config_dir}/taosd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/taosd.rpm ${install_main_dir}/init.d/taosd
- ${csudo} cp ${script_dir}/init.d/taosd.rpm ${service_config_dir}/taosd && ${csudo} chmod a+x ${service_config_dir}/taosd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/taosd.rpm ${install_main_dir}/init.d/taosd
+ ${csudo}cp ${script_dir}/init.d/taosd.rpm ${service_config_dir}/taosd && ${csudo}chmod a+x ${service_config_dir}/taosd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add taosd || :
- ${csudo} chkconfig --level 2345 taosd on || :
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add taosd || :
+ ${csudo}chkconfig --level 2345 taosd on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv taosd || :
- ${csudo} insserv -d taosd || :
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv taosd || :
+ ${csudo}insserv -d taosd || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d taosd defaults || :
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d taosd defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -673,27 +673,27 @@ function clean_service_on_systemd() {
taosd_service_config="${service_config_dir}/taosd.service"
if systemctl is-active --quiet taosd; then
echo "TDengine is running, stopping it..."
- ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop taosd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable taosd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${taosd_service_config}
+ ${csudo}systemctl disable taosd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${taosd_service_config}
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
if systemctl is-active --quiet nginxd; then
echo "Nginx for TDengine is running, stopping it..."
- ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop nginxd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
}
@@ -703,106 +703,106 @@ function install_service_on_systemd() {
clean_service_on_systemd
[ -f ${script_dir}/cfg/taosd.service ] &&\
- ${csudo} cp ${script_dir}/cfg/taosd.service \
+ ${csudo}cp ${script_dir}/cfg/taosd.service \
${service_config_dir}/ || :
- ${csudo} systemctl daemon-reload
+ ${csudo}systemctl daemon-reload
#taosd_service_config="${service_config_dir}/taosd.service"
- #${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}"
- #${csudo} bash -c "echo >> ${taosd_service_config}"
- #${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'Restart=always' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}"
- ##${csudo} bash -c "echo 'StartLimitIntervalSec=60s' >> ${taosd_service_config}"
- #${csudo} bash -c "echo >> ${taosd_service_config}"
- #${csudo} bash -c "echo '[Install]' >> ${taosd_service_config}"
- #${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}"
- ${csudo} systemctl enable taosd
+ #${csudo}bash -c "echo '[Unit]' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo >> ${taosd_service_config}"
+ #${csudo}bash -c "echo '[Service]' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'Type=simple' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'Restart=always' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}"
+ ##${csudo}bash -c "echo 'StartLimitIntervalSec=60s' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo >> ${taosd_service_config}"
+ #${csudo}bash -c "echo '[Install]' >> ${taosd_service_config}"
+ #${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}"
+ ${csudo}systemctl enable taosd
[ -f ${script_dir}/cfg/tarbitratord.service ] &&\
- ${csudo} cp ${script_dir}/cfg/tarbitratord.service \
+ ${csudo}cp ${script_dir}/cfg/tarbitratord.service \
${service_config_dir}/ || :
- ${csudo} systemctl daemon-reload
+ ${csudo}systemctl daemon-reload
#tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- #${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- #${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- #${csudo} systemctl enable tarbitratord
+ #${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ #${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ #${csudo}systemctl enable tarbitratord
if [ "$verMode" == "cluster" ]; then
[ -f ${script_dir}/cfg/nginxd.service ] &&\
- ${csudo} cp ${script_dir}/cfg/nginxd.service \
+ ${csudo}cp ${script_dir}/cfg/nginxd.service \
${service_config_dir}/ || :
- ${csudo} systemctl daemon-reload
+ ${csudo}systemctl daemon-reload
#nginx_service_config="${service_config_dir}/nginxd.service"
- #${csudo} bash -c "echo '[Unit]' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'Description=Nginx For TDengine Service' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
- #${csudo} bash -c "echo >> ${nginx_service_config}"
- #${csudo} bash -c "echo '[Service]' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'Type=forking' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'Restart=always' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
- #${csudo} bash -c "echo >> ${nginx_service_config}"
- #${csudo} bash -c "echo '[Install]' >> ${nginx_service_config}"
- #${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
- if ! ${csudo} systemctl enable nginxd &> /dev/null; then
- ${csudo} systemctl daemon-reexec
- ${csudo} systemctl enable nginxd
+ #${csudo}bash -c "echo '[Unit]' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'Description=Nginx For TDengine Service' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo >> ${nginx_service_config}"
+ #${csudo}bash -c "echo '[Service]' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'Type=forking' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'Restart=always' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo >> ${nginx_service_config}"
+ #${csudo}bash -c "echo '[Install]' >> ${nginx_service_config}"
+ #${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
+ if ! ${csudo}systemctl enable nginxd &> /dev/null; then
+ ${csudo}systemctl daemon-reexec
+ ${csudo}systemctl enable nginxd
fi
- ${csudo} systemctl start nginxd
+ ${csudo}systemctl start nginxd
fi
}
function install_taosadapter_service() {
if ((${service_mod}==0)); then
[ -f ${script_dir}/cfg/taosadapter.service ] &&\
- ${csudo} cp ${script_dir}/cfg/taosadapter.service \
+ ${csudo}cp ${script_dir}/cfg/taosadapter.service \
${service_config_dir}/ || :
- ${csudo} systemctl daemon-reload
+ ${csudo}systemctl daemon-reload
fi
}
@@ -896,9 +896,9 @@ function update_TDengine() {
# Stop the service if running
if pidof taosd &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop taosd || :
+ ${csudo}systemctl stop taosd || :
elif ((${service_mod}==1)); then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
else
kill_process taosd
fi
@@ -908,9 +908,9 @@ function update_TDengine() {
if [ "$verMode" == "cluster" ]; then
if pidof nginx &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop nginxd || :
+ ${csudo}systemctl stop nginxd || :
elif ((${service_mod}==1)); then
- ${csudo} service nginxd stop || :
+ ${csudo}service nginxd stop || :
else
kill_process nginx
fi
@@ -952,11 +952,13 @@ function update_TDengine() {
#echo -e "\033[44;32;1mTDengine is updated successfully!${NC}"
echo
echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
+ echo -e "${GREEN_DARK}To configure Taos Adapter (if has) ${NC}: edit /etc/taos/taosadapter.toml"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}service taosd start${NC}"
else
+ echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}"
echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}"
fi
@@ -1037,11 +1039,13 @@ function install_TDengine() {
#echo -e "\033[44;32;1mTDengine is installed successfully!${NC}"
echo
echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
+ echo -e "${GREEN_DARK}To configure taosadapter (if has) ${NC}: edit /etc/taos/taosadapter.toml"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}service taosd start${NC}"
else
+ echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}"
echo -e "${GREEN_DARK}To start TDengine ${NC}: taosd${NC}"
fi
diff --git a/packaging/tools/install_arbi.sh b/packaging/tools/install_arbi.sh
index 33896a08b3f653dbddc1ad480ddab3bf73a513ef..a582e0322aa025a69690a4041afd2fa24cc20a62 100755
--- a/packaging/tools/install_arbi.sh
+++ b/packaging/tools/install_arbi.sh
@@ -29,7 +29,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -91,85 +91,85 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/bin
- #${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ #${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/rmtarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/remove_arbi.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_arbi.sh ${bin_link_dir}/rmtarbitrator || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/remove_arbi.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi.sh ${bin_link_dir}/rmtarbitrator || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -178,30 +178,30 @@ function install_jemalloc() {
function clean_service_on_sysvinit() {
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -212,24 +212,24 @@ function install_service_on_sysvinit() {
# Install taosd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -237,11 +237,11 @@ function clean_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
# taos:2345:respawn:/etc/init.d/tarbitratord start
@@ -251,27 +251,27 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- ${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ ${csudo}systemctl enable tarbitratord
}
function install_service() {
@@ -291,9 +291,9 @@ function update_TDengine() {
# Stop the service if running
if pidof tarbitrator &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tarbitratord || :
+ ${csudo}systemctl stop tarbitratord || :
elif ((${service_mod}==1)); then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
else
kill_tarbitrator
fi
@@ -309,9 +309,9 @@ function update_TDengine() {
echo
#echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi
@@ -332,9 +332,9 @@ function install_TDengine() {
echo
#echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi
diff --git a/packaging/tools/install_arbi_jh.sh b/packaging/tools/install_arbi_jh.sh
index 2403f8fbd79abf4324577fe3dca3a8e0eac8ed01..3b0d050c2c1c395b197ed040ce20c86f512cad2b 100755
--- a/packaging/tools/install_arbi_jh.sh
+++ b/packaging/tools/install_arbi_jh.sh
@@ -29,7 +29,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -91,60 +91,60 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/bin
- #${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ #${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/rmtarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/remove_arbi_jh.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_arbi_jh.sh ${bin_link_dir}/rmtarbitrator || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/remove_arbi_jh.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi_jh.sh ${bin_link_dir}/rmtarbitrator || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -154,21 +154,21 @@ function install_service_on_sysvinit() {
# Install server service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -176,11 +176,11 @@ function clean_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function install_service_on_systemd() {
@@ -188,27 +188,27 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=jh_iot arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- ${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=jh_iot arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ ${csudo}systemctl enable tarbitratord
}
function install_service() {
@@ -227,9 +227,9 @@ function update() {
# Stop the service if running
if pidof tarbitrator &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tarbitratord || :
+ ${csudo}systemctl stop tarbitratord || :
elif ((${service_mod}==1)); then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
else
kill_tarbitrator
fi
@@ -243,9 +243,9 @@ function update() {
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi
@@ -263,9 +263,9 @@ function install() {
install_service
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi
diff --git a/packaging/tools/install_arbi_kh.sh b/packaging/tools/install_arbi_kh.sh
index 9a2542936d935b70b762702f0f2f6ff92b51a4f3..3c95639d181b6796128315fc9afb8bfa586c6dc3 100755
--- a/packaging/tools/install_arbi_kh.sh
+++ b/packaging/tools/install_arbi_kh.sh
@@ -29,7 +29,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -91,60 +91,60 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/bin
- #${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ #${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/rmtarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/remove_arbi_kh.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_arbi_kh.sh ${bin_link_dir}/rmtarbitrator || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/remove_arbi_kh.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi_kh.sh ${bin_link_dir}/rmtarbitrator || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -154,21 +154,21 @@ function install_service_on_sysvinit() {
# Install khserver service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -176,11 +176,11 @@ function clean_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function install_service_on_systemd() {
@@ -188,27 +188,27 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=KingHistorian arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- ${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=KingHistorian arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ ${csudo}systemctl enable tarbitratord
}
function install_service() {
@@ -227,9 +227,9 @@ function update() {
# Stop the service if running
if pidof tarbitrator &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tarbitratord || :
+ ${csudo}systemctl stop tarbitratord || :
elif ((${service_mod}==1)); then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
else
kill_tarbitrator
fi
@@ -243,9 +243,9 @@ function update() {
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi
@@ -263,9 +263,9 @@ function install() {
install_service
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi
diff --git a/packaging/tools/install_arbi_power.sh b/packaging/tools/install_arbi_power.sh
index 755684d1bdb1ea02781518e9a78ccf1d881fb271..94f1b7fc538874d8c03aa1ecffce4bee528e8c0c 100755
--- a/packaging/tools/install_arbi_power.sh
+++ b/packaging/tools/install_arbi_power.sh
@@ -29,7 +29,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -91,77 +91,77 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/bin
- #${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ #${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/rmtarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/remove_arbi_power.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_arbi_power.sh ${bin_link_dir}/rmtarbitrator || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/remove_arbi_power.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi_power.sh ${bin_link_dir}/rmtarbitrator || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -169,36 +169,36 @@ function install_jemalloc() {
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -209,24 +209,24 @@ function install_service_on_sysvinit() {
# Install powerd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
#restart_config_str="power:2345:respawn:${service_config_dir}/powerd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -234,11 +234,11 @@ function clean_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
# power:2345:respawn:/etc/init.d/tarbitratord start
@@ -248,27 +248,27 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=PowerDB arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- ${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=PowerDB arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ ${csudo}systemctl enable tarbitratord
}
function install_service() {
@@ -287,9 +287,9 @@ function update_PowerDB() {
# Stop the service if running
if pidof tarbitrator &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tarbitratord || :
+ ${csudo}systemctl stop tarbitratord || :
elif ((${service_mod}==1)); then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
else
kill_tarbitrator
fi
@@ -304,9 +304,9 @@ function update_PowerDB() {
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi
@@ -326,9 +326,9 @@ function install_PowerDB() {
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi
diff --git a/packaging/tools/install_arbi_pro.sh b/packaging/tools/install_arbi_pro.sh
index 3e80ad8215e3ec709c17a6a46e34f5bd6cf7ac6c..5c5fa485b8852ea87fdbd58cc76a6b4b6b4377de 100755
--- a/packaging/tools/install_arbi_pro.sh
+++ b/packaging/tools/install_arbi_pro.sh
@@ -29,7 +29,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -91,61 +91,61 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/bin
- #${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ #${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/rmtarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/remove_arbi_prodb.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_arbi_prodb.sh ${bin_link_dir}/rmtarbitrator || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/remove_arbi_prodb.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi_prodb.sh ${bin_link_dir}/rmtarbitrator || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -156,21 +156,21 @@ function install_service_on_sysvinit() {
# Install prodbs service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -178,11 +178,11 @@ function clean_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function install_service_on_systemd() {
@@ -190,27 +190,27 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=ProDB arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- ${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=ProDB arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ ${csudo}systemctl enable tarbitratord
}
function install_service() {
@@ -229,9 +229,9 @@ function update_prodb() {
# Stop the service if running
if pidof tarbitrator &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tarbitratord || :
+ ${csudo}systemctl stop tarbitratord || :
elif ((${service_mod}==1)); then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
else
kill_tarbitrator
fi
@@ -245,9 +245,9 @@ function update_prodb() {
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi
@@ -265,9 +265,9 @@ function install_prodb() {
install_service
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi
diff --git a/packaging/tools/install_arbi_tq.sh b/packaging/tools/install_arbi_tq.sh
index 8757326605b05aca63a585d1c3e1c66c98f6aaa7..132346a749f1559436e6db244593c660dbd69556 100755
--- a/packaging/tools/install_arbi_tq.sh
+++ b/packaging/tools/install_arbi_tq.sh
@@ -29,7 +29,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -91,61 +91,61 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/bin
- #${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ #${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/rmtarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/remove_arbi_tq.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_arbi_tq.sh ${bin_link_dir}/rmtarbitrator || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/remove_arbi_tq.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi_tq.sh ${bin_link_dir}/rmtarbitrator || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -156,24 +156,24 @@ function install_service_on_sysvinit() {
# Install tqd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
#restart_config_str="tq:2345:respawn:${service_config_dir}/tqd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -181,11 +181,11 @@ function clean_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
# tq:2345:respawn:/etc/init.d/tarbitratord start
@@ -195,27 +195,27 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=TQ arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- ${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=TQ arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ ${csudo}systemctl enable tarbitratord
}
function install_service() {
@@ -234,9 +234,9 @@ function update_tq() {
# Stop the service if running
if pidof tarbitrator &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tarbitratord || :
+ ${csudo}systemctl stop tarbitratord || :
elif ((${service_mod}==1)); then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
else
kill_tarbitrator
fi
@@ -250,9 +250,9 @@ function update_tq() {
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi
@@ -270,9 +270,9 @@ function install_tq() {
install_service
echo
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} systemctl start tarbitratord${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo} service tarbitratord start${NC}"
+ echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}"
else
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi
diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh
index a73f6ac9718064855a245c0505e179b6376d7c96..4ea60d1d55336d606f7eabf10b464cff90860519 100755
--- a/packaging/tools/install_client.sh
+++ b/packaging/tools/install_client.sh
@@ -57,7 +57,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -65,40 +65,40 @@ update_flag=0
function kill_client() {
pid=$(ps -ef | grep "taos" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
fi
- ${csudo} rm -f ${bin_link_dir}/rmtaos || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/rmtaos || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
+ [ -x ${install_main_dir}/bin/taos ] && ${csudo}ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
if [ "$osType" != "Darwin" ]; then
- [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
+ [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
fi
- [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
}
function clean_lib() {
@@ -108,87 +108,87 @@ function clean_lib() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
- ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
+ ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} ldconfig
+ ${csudo}ldconfig
else
- ${csudo} update_dyld_shared_cache
+ ${csudo}update_dyld_shared_cache
fi
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -196,37 +196,37 @@ function install_jemalloc() {
}
function install_config() {
- #${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
+ #${csudo}rm -f ${install_main_dir}/cfg/taos.cfg || :
if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo} cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo}cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
+ ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else
- mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/ ${install_main_dir}/
+ ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
diff --git a/packaging/tools/install_client_jh.sh b/packaging/tools/install_client_jh.sh
index a8599812feaea06120aa3391771e7c94523a53c2..436b683b29b81e612ef15af6cf976f29b42347fc 100755
--- a/packaging/tools/install_client_jh.sh
+++ b/packaging/tools/install_client_jh.sh
@@ -54,7 +54,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -62,42 +62,42 @@ update_flag=0
function kill_client() {
pid=$(ps -ef | grep "jh_taos" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/jh_taos || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taos || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/jhdemo || :
- ${csudo} rm -f ${bin_link_dir}/jh_taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/jhdemo || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taosdump || :
fi
- ${csudo} rm -f ${bin_link_dir}/rmjh || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/rmjh || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/jh_taos ] && ${csudo} ln -s ${install_main_dir}/bin/jh_taos ${bin_link_dir}/jh_taos || :
+ [ -x ${install_main_dir}/bin/jh_taos ] && ${csudo}ln -s ${install_main_dir}/bin/jh_taos ${bin_link_dir}/jh_taos || :
if [ "$osType" != "Darwin" ]; then
- [ -x ${install_main_dir}/bin/jhdemo ] && ${csudo} ln -s ${install_main_dir}/bin/jhdemo ${bin_link_dir}/jhdemo || :
- [ -x ${install_main_dir}/bin/jh_taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/jh_taosdump ${bin_link_dir}/jh_taosdump || :
+ [ -x ${install_main_dir}/bin/jhdemo ] && ${csudo}ln -s ${install_main_dir}/bin/jhdemo ${bin_link_dir}/jhdemo || :
+ [ -x ${install_main_dir}/bin/jh_taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/jh_taosdump ${bin_link_dir}/jh_taosdump || :
fi
- [ -x ${install_main_dir}/bin/remove_client_jh.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client_jh.sh ${bin_link_dir}/rmjh || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/remove_client_jh.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client_jh.sh ${bin_link_dir}/rmjh || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
}
function clean_lib() {
@@ -107,64 +107,64 @@ function clean_lib() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
- ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
+ ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_config() {
if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo} cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo}cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
+ ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else
- mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
diff --git a/packaging/tools/install_client_kh.sh b/packaging/tools/install_client_kh.sh
index 3e7df18486a20b9ea75dba3d2644d46bee6b423b..0b8c0f5aeba96fff65907105ca571cf5955c6648 100755
--- a/packaging/tools/install_client_kh.sh
+++ b/packaging/tools/install_client_kh.sh
@@ -54,7 +54,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -62,42 +62,42 @@ update_flag=0
function kill_client() {
pid=$(ps -ef | grep "khclient" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/khclient || :
+ ${csudo}rm -f ${bin_link_dir}/khclient || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/khdemo || :
- ${csudo} rm -f ${bin_link_dir}/khdump || :
+ ${csudo}rm -f ${bin_link_dir}/khdemo || :
+ ${csudo}rm -f ${bin_link_dir}/khdump || :
fi
- ${csudo} rm -f ${bin_link_dir}/rmkh || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/rmkh || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/khclient ] && ${csudo} ln -s ${install_main_dir}/bin/khclient ${bin_link_dir}/khclient || :
+ [ -x ${install_main_dir}/bin/khclient ] && ${csudo}ln -s ${install_main_dir}/bin/khclient ${bin_link_dir}/khclient || :
if [ "$osType" != "Darwin" ]; then
- [ -x ${install_main_dir}/bin/khdemo ] && ${csudo} ln -s ${install_main_dir}/bin/khdemo ${bin_link_dir}/khdemo || :
- [ -x ${install_main_dir}/bin/khdump ] && ${csudo} ln -s ${install_main_dir}/bin/khdump ${bin_link_dir}/khdump || :
+ [ -x ${install_main_dir}/bin/khdemo ] && ${csudo}ln -s ${install_main_dir}/bin/khdemo ${bin_link_dir}/khdemo || :
+ [ -x ${install_main_dir}/bin/khdump ] && ${csudo}ln -s ${install_main_dir}/bin/khdump ${bin_link_dir}/khdump || :
fi
- [ -x ${install_main_dir}/bin/remove_client_kh.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client_kh.sh ${bin_link_dir}/rmkh || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/remove_client_kh.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client_kh.sh ${bin_link_dir}/rmkh || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
}
function clean_lib() {
@@ -107,65 +107,65 @@ function clean_lib() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
- ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
+ ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_config() {
if [ ! -f ${cfg_install_dir}/kinghistorian.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/kinghistorian.cfg ] && ${csudo} cp ${script_dir}/cfg/kinghistorian.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/kinghistorian.cfg ] && ${csudo}cp ${script_dir}/cfg/kinghistorian.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/kinghistorian.cfg ${install_main_dir}/cfg/kinghistorian.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/kinghistorian.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/kinghistorian.cfg ${install_main_dir}/cfg/kinghistorian.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/kinghistorian.cfg ${install_main_dir}/cfg
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
+ ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else
- mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
diff --git a/packaging/tools/install_client_power.sh b/packaging/tools/install_client_power.sh
index 3c9abddb09646ea54f44e28664afea49822055f6..4e7ee96a6255bd74862a509206ef6aff69320916 100755
--- a/packaging/tools/install_client_power.sh
+++ b/packaging/tools/install_client_power.sh
@@ -57,7 +57,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -65,42 +65,42 @@ update_flag=0
function kill_client() {
pid=$(ps -ef | grep "power" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/power || :
+ ${csudo}rm -f ${bin_link_dir}/power || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/powerdemo || :
- ${csudo} rm -f ${bin_link_dir}/powerdump || :
+ ${csudo}rm -f ${bin_link_dir}/powerdemo || :
+ ${csudo}rm -f ${bin_link_dir}/powerdump || :
fi
- ${csudo} rm -f ${bin_link_dir}/rmpower || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/rmpower || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/power ] && ${csudo} ln -s ${install_main_dir}/bin/power ${bin_link_dir}/power || :
+ [ -x ${install_main_dir}/bin/power ] && ${csudo}ln -s ${install_main_dir}/bin/power ${bin_link_dir}/power || :
if [ "$osType" != "Darwin" ]; then
- [ -x ${install_main_dir}/bin/powerdemo ] && ${csudo} ln -s ${install_main_dir}/bin/powerdemo ${bin_link_dir}/powerdemo || :
- [ -x ${install_main_dir}/bin/powerdump ] && ${csudo} ln -s ${install_main_dir}/bin/powerdump ${bin_link_dir}/powerdump || :
+ [ -x ${install_main_dir}/bin/powerdemo ] && ${csudo}ln -s ${install_main_dir}/bin/powerdemo ${bin_link_dir}/powerdemo || :
+ [ -x ${install_main_dir}/bin/powerdump ] && ${csudo}ln -s ${install_main_dir}/bin/powerdump ${bin_link_dir}/powerdump || :
fi
- [ -x ${install_main_dir}/bin/remove_client_power.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client_power.sh ${bin_link_dir}/rmpower || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/remove_client_power.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client_power.sh ${bin_link_dir}/rmpower || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
}
function clean_lib() {
@@ -110,83 +110,83 @@ function clean_lib() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
- ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
+ ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -195,34 +195,34 @@ function install_jemalloc() {
function install_config() {
if [ ! -f ${cfg_install_dir}/power.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/power.cfg ] && ${csudo} cp ${script_dir}/cfg/power.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/power.cfg ] && ${csudo}cp ${script_dir}/cfg/power.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/power.cfg ${install_main_dir}/cfg/power.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/power.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/power.cfg ${install_main_dir}/cfg/power.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/power.cfg ${install_main_dir}/cfg
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
+ ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else
- mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
diff --git a/packaging/tools/install_client_pro.sh b/packaging/tools/install_client_pro.sh
index e34dc6d4ac1d1ef1715ff903b38b1a8735001985..7551484e56c8d5fc59539d26f52ac7d318106fa5 100755
--- a/packaging/tools/install_client_pro.sh
+++ b/packaging/tools/install_client_pro.sh
@@ -54,7 +54,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -62,42 +62,42 @@ update_flag=0
function kill_client() {
pid=$(ps -ef | grep "prodbc" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/prodbc || :
+ ${csudo}rm -f ${bin_link_dir}/prodbc || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/prodemo || :
- ${csudo} rm -f ${bin_link_dir}/prodump || :
+ ${csudo}rm -f ${bin_link_dir}/prodemo || :
+ ${csudo}rm -f ${bin_link_dir}/prodump || :
fi
- ${csudo} rm -f ${bin_link_dir}/rmprodb || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/rmprodb || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/prodbc ] && ${csudo} ln -s ${install_main_dir}/bin/prodbc ${bin_link_dir}/prodbc || :
+ [ -x ${install_main_dir}/bin/prodbc ] && ${csudo}ln -s ${install_main_dir}/bin/prodbc ${bin_link_dir}/prodbc || :
if [ "$osType" != "Darwin" ]; then
- [ -x ${install_main_dir}/bin/prodemo ] && ${csudo} ln -s ${install_main_dir}/bin/prodemo ${bin_link_dir}/prodemo || :
- [ -x ${install_main_dir}/bin/prodump ] && ${csudo} ln -s ${install_main_dir}/bin/prodump ${bin_link_dir}/prodump || :
+ [ -x ${install_main_dir}/bin/prodemo ] && ${csudo}ln -s ${install_main_dir}/bin/prodemo ${bin_link_dir}/prodemo || :
+ [ -x ${install_main_dir}/bin/prodump ] && ${csudo}ln -s ${install_main_dir}/bin/prodump ${bin_link_dir}/prodump || :
fi
- [ -x ${install_main_dir}/bin/remove_client_prodb.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client_prodb.sh ${bin_link_dir}/rmprodb || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/remove_client_prodb.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client_prodb.sh ${bin_link_dir}/rmprodb || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
}
function clean_lib() {
@@ -107,65 +107,65 @@ function clean_lib() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
- ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
+ ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_config() {
if [ ! -f ${cfg_install_dir}/prodb.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/prodb.cfg ] && ${csudo} cp ${script_dir}/cfg/prodb.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/prodb.cfg ] && ${csudo}cp ${script_dir}/cfg/prodb.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/prodb.cfg ${install_main_dir}/cfg/prodb.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/prodb.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/prodb.cfg ${install_main_dir}/cfg/prodb.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/prodb.cfg ${install_main_dir}/cfg
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
+ ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else
- mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
diff --git a/packaging/tools/install_client_tq.sh b/packaging/tools/install_client_tq.sh
index b7f10324dcd1c62fee20fe11399fbb61d8a38577..04479cfdbe234fe323a43a6a521992838069ecd9 100755
--- a/packaging/tools/install_client_tq.sh
+++ b/packaging/tools/install_client_tq.sh
@@ -57,7 +57,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -65,42 +65,42 @@ update_flag=0
function kill_client() {
pid=$(ps -ef | grep "tq" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/tq || :
+ ${csudo}rm -f ${bin_link_dir}/tq || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/tqdemo || :
- ${csudo} rm -f ${bin_link_dir}/tqdump || :
+ ${csudo}rm -f ${bin_link_dir}/tqdemo || :
+ ${csudo}rm -f ${bin_link_dir}/tqdump || :
fi
- ${csudo} rm -f ${bin_link_dir}/rmtq || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/rmtq || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/tq ] && ${csudo} ln -s ${install_main_dir}/bin/tq ${bin_link_dir}/tq || :
+ [ -x ${install_main_dir}/bin/tq ] && ${csudo}ln -s ${install_main_dir}/bin/tq ${bin_link_dir}/tq || :
if [ "$osType" != "Darwin" ]; then
- [ -x ${install_main_dir}/bin/tqdemo ] && ${csudo} ln -s ${install_main_dir}/bin/tqdemo ${bin_link_dir}/tqdemo || :
- [ -x ${install_main_dir}/bin/tqdump ] && ${csudo} ln -s ${install_main_dir}/bin/tqdump ${bin_link_dir}/tqdump || :
+ [ -x ${install_main_dir}/bin/tqdemo ] && ${csudo}ln -s ${install_main_dir}/bin/tqdemo ${bin_link_dir}/tqdemo || :
+ [ -x ${install_main_dir}/bin/tqdump ] && ${csudo}ln -s ${install_main_dir}/bin/tqdump ${bin_link_dir}/tqdump || :
fi
- [ -x ${install_main_dir}/bin/remove_client_tq.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client_tq.sh ${bin_link_dir}/rmtq || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/remove_client_tq.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client_tq.sh ${bin_link_dir}/rmtq || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
}
function clean_lib() {
@@ -110,66 +110,66 @@ function clean_lib() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
- ${csudo} ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
+ ${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_config() {
if [ ! -f ${cfg_install_dir}/tq.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/tq.cfg ] && ${csudo} cp ${script_dir}/cfg/tq.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/tq.cfg ] && ${csudo}cp ${script_dir}/cfg/tq.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/tq.cfg ${install_main_dir}/cfg/tq.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/tq.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/tq.cfg ${install_main_dir}/cfg/tq.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/tq.cfg ${install_main_dir}/cfg
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
+ ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else
- mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
diff --git a/packaging/tools/install_jh.sh b/packaging/tools/install_jh.sh
index ecc166fba10ef4c3f8e0bacc04ff27ebf717e409..667766154e92004b3eea695b08f0fc43872cbd2e 100755
--- a/packaging/tools/install_jh.sh
+++ b/packaging/tools/install_jh.sh
@@ -46,7 +46,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -144,129 +144,129 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
-# ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
-# ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+# ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+# ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
if [ "$verMode" == "cluster" ]; then
- ${csudo} mkdir -p ${nginx_dir}
+ ${csudo}mkdir -p ${nginx_dir}
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/jh_taos || :
- ${csudo} rm -f ${bin_link_dir}/jh_taosd || :
- ${csudo} rm -f ${bin_link_dir}/jhdemo || :
- ${csudo} rm -f ${bin_link_dir}/rmjh || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taos || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taosd || :
+ ${csudo}rm -f ${bin_link_dir}/jhdemo || :
+ ${csudo}rm -f ${bin_link_dir}/rmjh || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/jh_taos ] && ${csudo} ln -s ${install_main_dir}/bin/jh_taos ${bin_link_dir}/jh_taos || :
- [ -x ${install_main_dir}/bin/jh_taosd ] && ${csudo} ln -s ${install_main_dir}/bin/jh_taosd ${bin_link_dir}/jh_taosd || :
- [ -x ${install_main_dir}/bin/jhdemo ] && ${csudo} ln -s ${install_main_dir}/bin/jhdemo ${bin_link_dir}/jhdemo || :
- [ -x ${install_main_dir}/bin/remove_jh.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_jh.sh ${bin_link_dir}/rmjh || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/jh_taos ] && ${csudo}ln -s ${install_main_dir}/bin/jh_taos ${bin_link_dir}/jh_taos || :
+ [ -x ${install_main_dir}/bin/jh_taosd ] && ${csudo}ln -s ${install_main_dir}/bin/jh_taosd ${bin_link_dir}/jh_taosd || :
+ [ -x ${install_main_dir}/bin/jhdemo ] && ${csudo}ln -s ${install_main_dir}/bin/jhdemo ${bin_link_dir}/jhdemo || :
+ [ -x ${install_main_dir}/bin/remove_jh.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_jh.sh ${bin_link_dir}/rmjh || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
if [ "$verMode" == "cluster" ]; then
- ${csudo} cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo} chmod 0555 ${nginx_dir}/*
- ${csudo} mkdir -p ${nginx_dir}/logs
- ${csudo} chmod 777 ${nginx_dir}/sbin/nginx
+ ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/*
+ ${csudo}mkdir -p ${nginx_dir}/logs
+ ${csudo}chmod 777 ${nginx_dir}/sbin/nginx
fi
}
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} ldconfig
+ ${csudo}ldconfig
else
- ${csudo} update_dyld_shared_cache
+ ${csudo}update_dyld_shared_cache
fi
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -286,7 +286,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -300,7 +300,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -310,15 +310,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -353,7 +353,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
serverFqdn=$localFqdn
echo
return
@@ -375,7 +375,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
serverFqdn=$localFqdn
break
fi
@@ -423,13 +423,13 @@ function local_fqdn_check() {
function install_config() {
if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo} cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo}cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
[ ! -z $1 ] && return 0 || : # only install client
@@ -459,7 +459,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -472,66 +472,66 @@ function install_config() {
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
function clean_service_on_sysvinit() {
if pidof jh_taosd &> /dev/null; then
- ${csudo} service jh_taosd stop || :
+ ${csudo}service jh_taosd stop || :
fi
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/jh_taosd ]; then
- ${csudo} chkconfig --del jh_taosd || :
+ ${csudo}chkconfig --del jh_taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/jh_taosd ]; then
- ${csudo} insserv -r jh_taosd || :
+ ${csudo}insserv -r jh_taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/jh_taosd ]; then
- ${csudo} update-rc.d -f jh_taosd remove || :
+ ${csudo}update-rc.d -f jh_taosd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/jh_taosd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/jh_taosd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -542,30 +542,30 @@ function install_service_on_sysvinit() {
# Install jh_taosd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/jh_taosd.deb ${install_main_dir}/init.d/jh_taosd
- ${csudo} cp ${script_dir}/init.d/jh_taosd.deb ${service_config_dir}/jh_taosd && ${csudo} chmod a+x ${service_config_dir}/jh_taosd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/jh_taosd.deb ${install_main_dir}/init.d/jh_taosd
+ ${csudo}cp ${script_dir}/init.d/jh_taosd.deb ${service_config_dir}/jh_taosd && ${csudo}chmod a+x ${service_config_dir}/jh_taosd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/jh_taosd.rpm ${install_main_dir}/init.d/jh_taosd
- ${csudo} cp ${script_dir}/init.d/jh_taosd.rpm ${service_config_dir}/jh_taosd && ${csudo} chmod a+x ${service_config_dir}/jh_taosd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/jh_taosd.rpm ${install_main_dir}/init.d/jh_taosd
+ ${csudo}cp ${script_dir}/init.d/jh_taosd.rpm ${service_config_dir}/jh_taosd && ${csudo}chmod a+x ${service_config_dir}/jh_taosd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add jh_taosd || :
- ${csudo} chkconfig --level 2345 jh_taosd on || :
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add jh_taosd || :
+ ${csudo}chkconfig --level 2345 jh_taosd on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv jh_taosd || :
- ${csudo} insserv -d jh_taosd || :
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv jh_taosd || :
+ ${csudo}insserv -d jh_taosd || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d jh_taosd defaults || :
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d jh_taosd defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -573,27 +573,27 @@ function clean_service_on_systemd() {
jh_taosd_service_config="${service_config_dir}/jh_taosd.service"
if systemctl is-active --quiet jh_taosd; then
echo "jh_iot is running, stopping it..."
- ${csudo} systemctl stop jh_taosd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop jh_taosd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable jh_taosd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${jh_taosd_service_config}
+ ${csudo}systemctl disable jh_taosd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${jh_taosd_service_config}
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
if systemctl is-active --quiet nginxd; then
echo "Nginx for jh_iot is running, stopping it..."
- ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop nginxd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
}
@@ -601,81 +601,81 @@ function install_service_on_systemd() {
clean_service_on_systemd
service_config="${service_config_dir}/jh_taosd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${service_config}"
- ${csudo} bash -c "echo 'Description=jh_iot server service' >> ${service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${service_config}"
- ${csudo} bash -c "echo >> ${service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/jh_taosd' >> ${service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/jh_taos/bin/startPre.sh' >> ${service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${service_config}"
- ${csudo} bash -c "echo >> ${service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${service_config}"
- ${csudo} systemctl enable jh_taosd
+ ${csudo}bash -c "echo '[Unit]' >> ${service_config}"
+ ${csudo}bash -c "echo 'Description=jh_iot server service' >> ${service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${service_config}"
+ ${csudo}bash -c "echo >> ${service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/jh_taosd' >> ${service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/jh_taos/bin/startPre.sh' >> ${service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${service_config}"
+ ${csudo}bash -c "echo >> ${service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${service_config}"
+ ${csudo}systemctl enable jh_taosd
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=jh_iot arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- #${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=jh_iot arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ #${csudo}systemctl enable tarbitratord
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Description=Nginx For jh_iot Service' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Type=forking' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
- if ! ${csudo} systemctl enable nginxd &> /dev/null; then
- ${csudo} systemctl daemon-reexec
- ${csudo} systemctl enable nginxd
+ ${csudo}bash -c "echo '[Unit]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Description=Nginx For jh_iot Service' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Type=forking' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
+ if ! ${csudo}systemctl enable nginxd &> /dev/null; then
+ ${csudo}systemctl daemon-reexec
+ ${csudo}systemctl enable nginxd
fi
- ${csudo} systemctl start nginxd
+ ${csudo}systemctl start nginxd
fi
}
@@ -755,9 +755,9 @@ function update() {
# Stop the service if running
if pidof jh_taosd &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop jh_taosd || :
+ ${csudo}systemctl stop jh_taosd || :
elif ((${service_mod}==1)); then
- ${csudo} service jh_taosd stop || :
+ ${csudo}service jh_taosd stop || :
else
kill_process jh_taosd
fi
@@ -766,9 +766,9 @@ function update() {
if [ "$verMode" == "cluster" ]; then
if pidof nginx &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop nginxd || :
+ ${csudo}systemctl stop nginxd || :
elif ((${service_mod}==1)); then
- ${csudo} service nginxd stop || :
+ ${csudo}service nginxd stop || :
else
kill_process nginx
fi
@@ -809,9 +809,9 @@ function update() {
echo
echo -e "${GREEN_DARK}To configure jh_iot ${NC}: edit /etc/jh_taos/taos.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo} systemctl start jh_taosd${NC}"
+ echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo}systemctl start jh_taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo} service jh_taosd start${NC}"
+ echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo}service jh_taosd start${NC}"
else
echo -e "${GREEN_DARK}To start jh_iot ${NC}: ./jh_taosd${NC}"
fi
@@ -886,9 +886,9 @@ function install() {
echo
echo -e "${GREEN_DARK}To configure jh_iot ${NC}: edit /etc/jh_taos/taos.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo} systemctl start jh_taosd${NC}"
+ echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo}systemctl start jh_taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo} service jh_taosd start${NC}"
+ echo -e "${GREEN_DARK}To start jh_iot ${NC}: ${csudo}service jh_taosd start${NC}"
else
echo -e "${GREEN_DARK}To start jh_iot ${NC}: jh_taosd${NC}"
fi
diff --git a/packaging/tools/install_kh.sh b/packaging/tools/install_kh.sh
index e53e014351ff9ae64e727151c72f3157a2077043..8adad4dbbe32c6e052721f8657425b19d7338c4e 100755
--- a/packaging/tools/install_kh.sh
+++ b/packaging/tools/install_kh.sh
@@ -46,7 +46,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -144,129 +144,129 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
-# ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
-# ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+# ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+# ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
if [ "$verMode" == "cluster" ]; then
- ${csudo} mkdir -p ${nginx_dir}
+ ${csudo}mkdir -p ${nginx_dir}
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/khclient || :
- ${csudo} rm -f ${bin_link_dir}/khserver || :
- ${csudo} rm -f ${bin_link_dir}/khdemo || :
- ${csudo} rm -f ${bin_link_dir}/rmkh || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/khclient || :
+ ${csudo}rm -f ${bin_link_dir}/khserver || :
+ ${csudo}rm -f ${bin_link_dir}/khdemo || :
+ ${csudo}rm -f ${bin_link_dir}/rmkh || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/khclient ] && ${csudo} ln -s ${install_main_dir}/bin/khclient ${bin_link_dir}/khclient || :
- [ -x ${install_main_dir}/bin/khserver ] && ${csudo} ln -s ${install_main_dir}/bin/khserver ${bin_link_dir}/khserver || :
- [ -x ${install_main_dir}/bin/khdemo ] && ${csudo} ln -s ${install_main_dir}/bin/khdemo ${bin_link_dir}/khdemo || :
- [ -x ${install_main_dir}/bin/remove_kh.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_kh.sh ${bin_link_dir}/rmkh || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/khclient ] && ${csudo}ln -s ${install_main_dir}/bin/khclient ${bin_link_dir}/khclient || :
+ [ -x ${install_main_dir}/bin/khserver ] && ${csudo}ln -s ${install_main_dir}/bin/khserver ${bin_link_dir}/khserver || :
+ [ -x ${install_main_dir}/bin/khdemo ] && ${csudo}ln -s ${install_main_dir}/bin/khdemo ${bin_link_dir}/khdemo || :
+ [ -x ${install_main_dir}/bin/remove_kh.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_kh.sh ${bin_link_dir}/rmkh || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
if [ "$verMode" == "cluster" ]; then
- ${csudo} cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo} chmod 0555 ${nginx_dir}/*
- ${csudo} mkdir -p ${nginx_dir}/logs
- ${csudo} chmod 777 ${nginx_dir}/sbin/nginx
+ ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/*
+ ${csudo}mkdir -p ${nginx_dir}/logs
+ ${csudo}chmod 777 ${nginx_dir}/sbin/nginx
fi
}
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} ldconfig
+ ${csudo}ldconfig
else
- ${csudo} update_dyld_shared_cache
+ ${csudo}update_dyld_shared_cache
fi
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -286,7 +286,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -300,7 +300,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -310,15 +310,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/kinghistorian.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/kinghistorian.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -353,7 +353,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/kinghistorian.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/kinghistorian.cfg
serverFqdn=$localFqdn
echo
return
@@ -375,7 +375,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/kinghistorian.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/kinghistorian.cfg
serverFqdn=$localFqdn
break
fi
@@ -423,13 +423,13 @@ function local_fqdn_check() {
function install_config() {
if [ ! -f ${cfg_install_dir}/kinghistorian.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/kinghistorian.cfg ] && ${csudo} cp ${script_dir}/cfg/kinghistorian.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/kinghistorian.cfg ] && ${csudo}cp ${script_dir}/cfg/kinghistorian.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/kinghistorian.cfg ${install_main_dir}/cfg/kinghistorian.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/kinghistorian.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/kinghistorian.cfg ${install_main_dir}/cfg/kinghistorian.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/kinghistorian.cfg ${install_main_dir}/cfg
[ ! -z $1 ] && return 0 || : # only install client
@@ -459,7 +459,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/kinghistorian.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/kinghistorian.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -472,66 +472,66 @@ function install_config() {
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
function clean_service_on_sysvinit() {
if pidof khserver &> /dev/null; then
- ${csudo} service khserver stop || :
+ ${csudo}service khserver stop || :
fi
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/khserver ]; then
- ${csudo} chkconfig --del khserver || :
+ ${csudo}chkconfig --del khserver || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/khserver ]; then
- ${csudo} insserv -r khserver || :
+ ${csudo}insserv -r khserver || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/khserver ]; then
- ${csudo} update-rc.d -f khserver remove || :
+ ${csudo}update-rc.d -f khserver remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/khserver || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/khserver || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -542,30 +542,30 @@ function install_service_on_sysvinit() {
# Install khserver service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/khserver.deb ${install_main_dir}/init.d/khserver
- ${csudo} cp ${script_dir}/init.d/khserver.deb ${service_config_dir}/khserver && ${csudo} chmod a+x ${service_config_dir}/khserver
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/khserver.deb ${install_main_dir}/init.d/khserver
+ ${csudo}cp ${script_dir}/init.d/khserver.deb ${service_config_dir}/khserver && ${csudo}chmod a+x ${service_config_dir}/khserver
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/khserver.rpm ${install_main_dir}/init.d/khserver
- ${csudo} cp ${script_dir}/init.d/khserver.rpm ${service_config_dir}/khserver && ${csudo} chmod a+x ${service_config_dir}/khserver
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/khserver.rpm ${install_main_dir}/init.d/khserver
+ ${csudo}cp ${script_dir}/init.d/khserver.rpm ${service_config_dir}/khserver && ${csudo}chmod a+x ${service_config_dir}/khserver
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add khserver || :
- ${csudo} chkconfig --level 2345 khserver on || :
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add khserver || :
+ ${csudo}chkconfig --level 2345 khserver on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv khserver || :
- ${csudo} insserv -d khserver || :
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv khserver || :
+ ${csudo}insserv -d khserver || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d khserver defaults || :
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d khserver defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -573,27 +573,27 @@ function clean_service_on_systemd() {
khserver_service_config="${service_config_dir}/khserver.service"
if systemctl is-active --quiet khserver; then
echo "KingHistorian is running, stopping it..."
- ${csudo} systemctl stop khserver &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop khserver &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable khserver &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${khserver_service_config}
+ ${csudo}systemctl disable khserver &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${khserver_service_config}
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
if systemctl is-active --quiet nginxd; then
echo "Nginx for KingHistorian is running, stopping it..."
- ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop nginxd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
}
@@ -601,81 +601,81 @@ function install_service_on_systemd() {
clean_service_on_systemd
service_config="${service_config_dir}/khserver.service"
- ${csudo} bash -c "echo '[Unit]' >> ${service_config}"
- ${csudo} bash -c "echo 'Description=KingHistorian server service' >> ${service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${service_config}"
- ${csudo} bash -c "echo >> ${service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/khserver' >> ${service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/kinghistorian/bin/startPre.sh' >> ${service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${service_config}"
- ${csudo} bash -c "echo >> ${service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${service_config}"
- ${csudo} systemctl enable khserver
+ ${csudo}bash -c "echo '[Unit]' >> ${service_config}"
+ ${csudo}bash -c "echo 'Description=KingHistorian server service' >> ${service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${service_config}"
+ ${csudo}bash -c "echo >> ${service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/khserver' >> ${service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/kinghistorian/bin/startPre.sh' >> ${service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${service_config}"
+ ${csudo}bash -c "echo >> ${service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${service_config}"
+ ${csudo}systemctl enable khserver
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=KingHistorian arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- #${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=KingHistorian arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ #${csudo}systemctl enable tarbitratord
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Description=Nginx For KingHistorian Service' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Type=forking' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
- if ! ${csudo} systemctl enable nginxd &> /dev/null; then
- ${csudo} systemctl daemon-reexec
- ${csudo} systemctl enable nginxd
+ ${csudo}bash -c "echo '[Unit]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Description=Nginx For KingHistorian Service' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Type=forking' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
+ if ! ${csudo}systemctl enable nginxd &> /dev/null; then
+ ${csudo}systemctl daemon-reexec
+ ${csudo}systemctl enable nginxd
fi
- ${csudo} systemctl start nginxd
+ ${csudo}systemctl start nginxd
fi
}
@@ -755,9 +755,9 @@ function update() {
# Stop the service if running
if pidof khserver &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop khserver || :
+ ${csudo}systemctl stop khserver || :
elif ((${service_mod}==1)); then
- ${csudo} service khserver stop || :
+ ${csudo}service khserver stop || :
else
kill_process khserver
fi
@@ -766,9 +766,9 @@ function update() {
if [ "$verMode" == "cluster" ]; then
if pidof nginx &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop nginxd || :
+ ${csudo}systemctl stop nginxd || :
elif ((${service_mod}==1)); then
- ${csudo} service nginxd stop || :
+ ${csudo}service nginxd stop || :
else
kill_process nginx
fi
@@ -809,9 +809,9 @@ function update() {
echo
echo -e "${GREEN_DARK}To configure KingHistorian ${NC}: edit /etc/kinghistorian/kinghistorian.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo} systemctl start khserver${NC}"
+ echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo}systemctl start khserver${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo} service khserver start${NC}"
+ echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo}service khserver start${NC}"
else
echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ./khserver${NC}"
fi
@@ -886,9 +886,9 @@ function install() {
echo
echo -e "${GREEN_DARK}To configure KingHistorian ${NC}: edit /etc/kinghistorian/kinghistorian.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo} systemctl start khserver${NC}"
+ echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo}systemctl start khserver${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo} service khserver start${NC}"
+ echo -e "${GREEN_DARK}To start KingHistorian ${NC}: ${csudo}service khserver start${NC}"
else
echo -e "${GREEN_DARK}To start KingHistorian ${NC}: khserver${NC}"
fi
diff --git a/packaging/tools/install_power.sh b/packaging/tools/install_power.sh
index cde33f9b368041d7072bc851d54b68e30a067a95..705c86432569c3e59145f8d887e55b78b111a4a8 100755
--- a/packaging/tools/install_power.sh
+++ b/packaging/tools/install_power.sh
@@ -49,7 +49,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -149,119 +149,119 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
if [ "$verMode" == "cluster" ]; then
- ${csudo} mkdir -p ${nginx_dir}
+ ${csudo}mkdir -p ${nginx_dir}
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/power || :
- ${csudo} rm -f ${bin_link_dir}/powerd || :
- ${csudo} rm -f ${bin_link_dir}/powerdemo || :
- ${csudo} rm -f ${bin_link_dir}/rmpower || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/power || :
+ ${csudo}rm -f ${bin_link_dir}/powerd || :
+ ${csudo}rm -f ${bin_link_dir}/powerdemo || :
+ ${csudo}rm -f ${bin_link_dir}/rmpower || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/power ] && ${csudo} ln -s ${install_main_dir}/bin/power ${bin_link_dir}/power || :
- [ -x ${install_main_dir}/bin/powerd ] && ${csudo} ln -s ${install_main_dir}/bin/powerd ${bin_link_dir}/powerd || :
- [ -x ${install_main_dir}/bin/powerdemo ] && ${csudo} ln -s ${install_main_dir}/bin/powerdemo ${bin_link_dir}/powerdemo || :
- [ -x ${install_main_dir}/bin/remove_power.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_power.sh ${bin_link_dir}/rmpower || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/power ] && ${csudo}ln -s ${install_main_dir}/bin/power ${bin_link_dir}/power || :
+ [ -x ${install_main_dir}/bin/powerd ] && ${csudo}ln -s ${install_main_dir}/bin/powerd ${bin_link_dir}/powerd || :
+ [ -x ${install_main_dir}/bin/powerdemo ] && ${csudo}ln -s ${install_main_dir}/bin/powerdemo ${bin_link_dir}/powerdemo || :
+ [ -x ${install_main_dir}/bin/remove_power.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_power.sh ${bin_link_dir}/rmpower || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
if [ "$verMode" == "cluster" ]; then
- ${csudo} cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo} chmod 0555 ${nginx_dir}/*
- ${csudo} mkdir -p ${nginx_dir}/logs
- ${csudo} chmod 777 ${nginx_dir}/sbin/nginx
+ ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/*
+ ${csudo}mkdir -p ${nginx_dir}/logs
+ ${csudo}chmod 777 ${nginx_dir}/sbin/nginx
fi
}
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -269,11 +269,11 @@ function install_jemalloc() {
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function add_newHostname_to_hosts() {
@@ -289,7 +289,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -303,7 +303,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -316,15 +316,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/power.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/power.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -359,7 +359,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/power.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/power.cfg
serverFqdn=$localFqdn
echo
return
@@ -381,7 +381,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/power.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/power.cfg
serverFqdn=$localFqdn
break
fi
@@ -429,13 +429,13 @@ function local_fqdn_check() {
function install_config() {
if [ ! -f ${cfg_install_dir}/power.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/power.cfg ] && ${csudo} cp ${script_dir}/cfg/power.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/power.cfg ] && ${csudo}cp ${script_dir}/cfg/power.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/power.cfg ${install_main_dir}/cfg/power.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/power.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/power.cfg ${install_main_dir}/cfg/power.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/power.cfg ${install_main_dir}/cfg
[ ! -z $1 ] && return 0 || : # only install client
@@ -465,7 +465,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/power.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/power.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -478,69 +478,69 @@ function install_config() {
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
function clean_service_on_sysvinit() {
#restart_config_str="power:2345:respawn:${service_config_dir}/powerd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof powerd &> /dev/null; then
- ${csudo} service powerd stop || :
+ ${csudo}service powerd stop || :
fi
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/powerd ]; then
- ${csudo} chkconfig --del powerd || :
+ ${csudo}chkconfig --del powerd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/powerd ]; then
- ${csudo} insserv -r powerd || :
+ ${csudo}insserv -r powerd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/powerd ]; then
- ${csudo} update-rc.d -f powerd remove || :
+ ${csudo}update-rc.d -f powerd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/powerd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/powerd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -551,33 +551,33 @@ function install_service_on_sysvinit() {
# Install powerd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/powerd.deb ${install_main_dir}/init.d/powerd
- ${csudo} cp ${script_dir}/init.d/powerd.deb ${service_config_dir}/powerd && ${csudo} chmod a+x ${service_config_dir}/powerd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/powerd.deb ${install_main_dir}/init.d/powerd
+ ${csudo}cp ${script_dir}/init.d/powerd.deb ${service_config_dir}/powerd && ${csudo}chmod a+x ${service_config_dir}/powerd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/powerd.rpm ${install_main_dir}/init.d/powerd
- ${csudo} cp ${script_dir}/init.d/powerd.rpm ${service_config_dir}/powerd && ${csudo} chmod a+x ${service_config_dir}/powerd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/powerd.rpm ${install_main_dir}/init.d/powerd
+ ${csudo}cp ${script_dir}/init.d/powerd.rpm ${service_config_dir}/powerd && ${csudo}chmod a+x ${service_config_dir}/powerd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
#restart_config_str="power:2345:respawn:${service_config_dir}/powerd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add powerd || :
- ${csudo} chkconfig --level 2345 powerd on || :
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add powerd || :
+ ${csudo}chkconfig --level 2345 powerd on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv powerd || :
- ${csudo} insserv -d powerd || :
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv powerd || :
+ ${csudo}insserv -d powerd || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d powerd defaults || :
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d powerd defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -585,27 +585,27 @@ function clean_service_on_systemd() {
powerd_service_config="${service_config_dir}/powerd.service"
if systemctl is-active --quiet powerd; then
echo "PowerDB is running, stopping it..."
- ${csudo} systemctl stop powerd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop powerd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable powerd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${powerd_service_config}
+ ${csudo}systemctl disable powerd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${powerd_service_config}
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
if systemctl is-active --quiet nginxd; then
echo "Nginx for PowerDB is running, stopping it..."
- ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop nginxd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
}
@@ -615,81 +615,81 @@ function install_service_on_systemd() {
clean_service_on_systemd
powerd_service_config="${service_config_dir}/powerd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'Description=PowerDB server service' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${powerd_service_config}"
- ${csudo} bash -c "echo >> ${powerd_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/powerd' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/power/bin/startPre.sh' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${powerd_service_config}"
- ${csudo} bash -c "echo >> ${powerd_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${powerd_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${powerd_service_config}"
- ${csudo} systemctl enable powerd
+ ${csudo}bash -c "echo '[Unit]' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'Description=PowerDB server service' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo >> ${powerd_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/powerd' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/power/bin/startPre.sh' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo >> ${powerd_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${powerd_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${powerd_service_config}"
+ ${csudo}systemctl enable powerd
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=PowerDB arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- #${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=PowerDB arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ #${csudo}systemctl enable tarbitratord
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Description=Nginx For PowrDB Service' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Type=forking' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
- if ! ${csudo} systemctl enable nginxd &> /dev/null; then
- ${csudo} systemctl daemon-reexec
- ${csudo} systemctl enable nginxd
+ ${csudo}bash -c "echo '[Unit]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Description=Nginx For PowrDB Service' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Type=forking' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
+ if ! ${csudo}systemctl enable nginxd &> /dev/null; then
+ ${csudo}systemctl daemon-reexec
+ ${csudo}systemctl enable nginxd
fi
- ${csudo} systemctl start nginxd
+ ${csudo}systemctl start nginxd
fi
}
@@ -770,9 +770,9 @@ function update_PowerDB() {
# Stop the service if running
if pidof powerd &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop powerd || :
+ ${csudo}systemctl stop powerd || :
elif ((${service_mod}==1)); then
- ${csudo} service powerd stop || :
+ ${csudo}service powerd stop || :
else
kill_process powerd
fi
@@ -781,9 +781,9 @@ function update_PowerDB() {
if [ "$verMode" == "cluster" ]; then
if pidof nginx &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop nginxd || :
+ ${csudo}systemctl stop nginxd || :
elif ((${service_mod}==1)); then
- ${csudo} service nginxd stop || :
+ ${csudo}service nginxd stop || :
else
kill_process nginx
fi
@@ -824,9 +824,9 @@ function update_PowerDB() {
echo
echo -e "${GREEN_DARK}To configure PowerDB ${NC}: edit /etc/power/power.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo} systemctl start powerd${NC}"
+ echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo}systemctl start powerd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo} service powerd start${NC}"
+ echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo}service powerd start${NC}"
else
echo -e "${GREEN_DARK}To start PowerDB ${NC}: ./powerd${NC}"
fi
@@ -901,9 +901,9 @@ function install_PowerDB() {
echo
echo -e "${GREEN_DARK}To configure PowerDB ${NC}: edit /etc/power/power.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo} systemctl start powerd${NC}"
+ echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo}systemctl start powerd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo} service powerd start${NC}"
+ echo -e "${GREEN_DARK}To start PowerDB ${NC}: ${csudo}service powerd start${NC}"
else
echo -e "${GREEN_DARK}To start PowerDB ${NC}: powerd${NC}"
fi
diff --git a/packaging/tools/install_pro.sh b/packaging/tools/install_pro.sh
index 44a21abc19f19a1bffc2be42e71db30157d4e220..f1c71985f1464e3074c006b1eec7597f5990bf9d 100755
--- a/packaging/tools/install_pro.sh
+++ b/packaging/tools/install_pro.sh
@@ -46,7 +46,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -144,130 +144,130 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
-# ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
-# ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+# ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+# ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
if [ "$verMode" == "cluster" ]; then
- ${csudo} mkdir -p ${nginx_dir}
+ ${csudo}mkdir -p ${nginx_dir}
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/prodbc || :
- ${csudo} rm -f ${bin_link_dir}/prodbs || :
- ${csudo} rm -f ${bin_link_dir}/prodemo || :
- ${csudo} rm -f ${bin_link_dir}/rmprodb || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/prodbc || :
+ ${csudo}rm -f ${bin_link_dir}/prodbs || :
+ ${csudo}rm -f ${bin_link_dir}/prodemo || :
+ ${csudo}rm -f ${bin_link_dir}/rmprodb || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/prodbc ] && ${csudo} ln -s ${install_main_dir}/bin/prodbc ${bin_link_dir}/prodbc || :
- [ -x ${install_main_dir}/bin/prodbs ] && ${csudo} ln -s ${install_main_dir}/bin/prodbs ${bin_link_dir}/prodbs || :
- [ -x ${install_main_dir}/bin/prodemo ] && ${csudo} ln -s ${install_main_dir}/bin/prodemo ${bin_link_dir}/prodemo || :
- [ -x ${install_main_dir}/bin/remove_pro.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_pro.sh ${bin_link_dir}/rmprodb || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/prodbc ] && ${csudo}ln -s ${install_main_dir}/bin/prodbc ${bin_link_dir}/prodbc || :
+ [ -x ${install_main_dir}/bin/prodbs ] && ${csudo}ln -s ${install_main_dir}/bin/prodbs ${bin_link_dir}/prodbs || :
+ [ -x ${install_main_dir}/bin/prodemo ] && ${csudo}ln -s ${install_main_dir}/bin/prodemo ${bin_link_dir}/prodemo || :
+ [ -x ${install_main_dir}/bin/remove_pro.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_pro.sh ${bin_link_dir}/rmprodb || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
if [ "$verMode" == "cluster" ]; then
- ${csudo} cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo} chmod 0555 ${nginx_dir}/*
- ${csudo} mkdir -p ${nginx_dir}/logs
- ${csudo} chmod 777 ${nginx_dir}/sbin/nginx
+ ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/*
+ ${csudo}mkdir -p ${nginx_dir}/logs
+ ${csudo}chmod 777 ${nginx_dir}/sbin/nginx
fi
}
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} ldconfig
+ ${csudo}ldconfig
else
- ${csudo} update_dyld_shared_cache
+ ${csudo}update_dyld_shared_cache
fi
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -287,7 +287,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -301,7 +301,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -311,15 +311,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/prodb.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/prodb.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -354,7 +354,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/prodb.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/prodb.cfg
serverFqdn=$localFqdn
echo
return
@@ -376,7 +376,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/prodb.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/prodb.cfg
serverFqdn=$localFqdn
break
fi
@@ -424,13 +424,13 @@ function local_fqdn_check() {
function install_config() {
if [ ! -f ${cfg_install_dir}/prodb.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/prodb.cfg ] && ${csudo} cp ${script_dir}/cfg/prodb.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/prodb.cfg ] && ${csudo}cp ${script_dir}/cfg/prodb.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/prodb.cfg ${install_main_dir}/cfg/prodb.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/prodb.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/prodb.cfg ${install_main_dir}/cfg/prodb.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/prodb.cfg ${install_main_dir}/cfg
[ ! -z $1 ] && return 0 || : # only install client
@@ -460,7 +460,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/prodb.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/prodb.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -473,66 +473,66 @@ function install_config() {
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
function clean_service_on_sysvinit() {
if pidof prodbs &> /dev/null; then
- ${csudo} service prodbs stop || :
+ ${csudo}service prodbs stop || :
fi
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/prodbs ]; then
- ${csudo} chkconfig --del prodbs || :
+ ${csudo}chkconfig --del prodbs || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/prodbs ]; then
- ${csudo} insserv -r prodbs || :
+ ${csudo}insserv -r prodbs || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/prodbs ]; then
- ${csudo} update-rc.d -f prodbs remove || :
+ ${csudo}update-rc.d -f prodbs remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/prodbs || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/prodbs || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -543,30 +543,30 @@ function install_service_on_sysvinit() {
# Install prodbs service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/prodbs.deb ${install_main_dir}/init.d/prodbs
- ${csudo} cp ${script_dir}/init.d/prodbs.deb ${service_config_dir}/prodbs && ${csudo} chmod a+x ${service_config_dir}/prodbs
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/prodbs.deb ${install_main_dir}/init.d/prodbs
+ ${csudo}cp ${script_dir}/init.d/prodbs.deb ${service_config_dir}/prodbs && ${csudo}chmod a+x ${service_config_dir}/prodbs
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/prodbs.rpm ${install_main_dir}/init.d/prodbs
- ${csudo} cp ${script_dir}/init.d/prodbs.rpm ${service_config_dir}/prodbs && ${csudo} chmod a+x ${service_config_dir}/prodbs
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/prodbs.rpm ${install_main_dir}/init.d/prodbs
+ ${csudo}cp ${script_dir}/init.d/prodbs.rpm ${service_config_dir}/prodbs && ${csudo}chmod a+x ${service_config_dir}/prodbs
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add prodbs || :
- ${csudo} chkconfig --level 2345 prodbs on || :
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add prodbs || :
+ ${csudo}chkconfig --level 2345 prodbs on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv prodbs || :
- ${csudo} insserv -d prodbs || :
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv prodbs || :
+ ${csudo}insserv -d prodbs || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d prodbs defaults || :
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d prodbs defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -574,27 +574,27 @@ function clean_service_on_systemd() {
prodbs_service_config="${service_config_dir}/prodbs.service"
if systemctl is-active --quiet prodbs; then
echo "ProDB is running, stopping it..."
- ${csudo} systemctl stop prodbs &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop prodbs &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable prodbs &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${prodbs_service_config}
+ ${csudo}systemctl disable prodbs &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${prodbs_service_config}
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
if systemctl is-active --quiet nginxd; then
echo "Nginx for ProDB is running, stopping it..."
- ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop nginxd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
}
@@ -602,81 +602,81 @@ function install_service_on_systemd() {
clean_service_on_systemd
prodbs_service_config="${service_config_dir}/prodbs.service"
- ${csudo} bash -c "echo '[Unit]' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'Description=ProDB server service' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo >> ${prodbs_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/prodbs' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/ProDB/bin/startPre.sh' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo >> ${prodbs_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${prodbs_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${prodbs_service_config}"
- ${csudo} systemctl enable prodbs
+ ${csudo}bash -c "echo '[Unit]' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'Description=ProDB server service' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/prodbs' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/ProDB/bin/startPre.sh' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${prodbs_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${prodbs_service_config}"
+ ${csudo}systemctl enable prodbs
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=ProDB arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- #${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=ProDB arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ #${csudo}systemctl enable tarbitratord
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Description=Nginx For PowrDB Service' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Type=forking' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
- if ! ${csudo} systemctl enable nginxd &> /dev/null; then
- ${csudo} systemctl daemon-reexec
- ${csudo} systemctl enable nginxd
+ ${csudo}bash -c "echo '[Unit]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Description=Nginx For PowrDB Service' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Type=forking' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
+ if ! ${csudo}systemctl enable nginxd &> /dev/null; then
+ ${csudo}systemctl daemon-reexec
+ ${csudo}systemctl enable nginxd
fi
- ${csudo} systemctl start nginxd
+ ${csudo}systemctl start nginxd
fi
}
@@ -756,9 +756,9 @@ function update_prodb() {
# Stop the service if running
if pidof prodbs &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop prodbs || :
+ ${csudo}systemctl stop prodbs || :
elif ((${service_mod}==1)); then
- ${csudo} service prodbs stop || :
+ ${csudo}service prodbs stop || :
else
kill_process prodbs
fi
@@ -767,9 +767,9 @@ function update_prodb() {
if [ "$verMode" == "cluster" ]; then
if pidof nginx &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop nginxd || :
+ ${csudo}systemctl stop nginxd || :
elif ((${service_mod}==1)); then
- ${csudo} service nginxd stop || :
+ ${csudo}service nginxd stop || :
else
kill_process nginx
fi
@@ -810,9 +810,9 @@ function update_prodb() {
echo
echo -e "${GREEN_DARK}To configure ProDB ${NC}: edit /etc/ProDB/prodb.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo} systemctl start prodbs${NC}"
+ echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo}systemctl start prodbs${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo} service prodbs start${NC}"
+ echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo}service prodbs start${NC}"
else
echo -e "${GREEN_DARK}To start ProDB ${NC}: ./prodbs${NC}"
fi
@@ -887,9 +887,9 @@ function install_prodb() {
echo
echo -e "${GREEN_DARK}To configure ProDB ${NC}: edit /etc/ProDB/prodb.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo} systemctl start prodbs${NC}"
+ echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo}systemctl start prodbs${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo} service prodbs start${NC}"
+ echo -e "${GREEN_DARK}To start ProDB ${NC}: ${csudo}service prodbs start${NC}"
else
echo -e "${GREEN_DARK}To start ProDB ${NC}: prodbs${NC}"
fi
diff --git a/packaging/tools/install_tq.sh b/packaging/tools/install_tq.sh
index 481cbb19792b654710aab13d99c50ab4b5475be1..e74d5c7c4576f96608bc8a727b97aa84b9626817 100755
--- a/packaging/tools/install_tq.sh
+++ b/packaging/tools/install_tq.sh
@@ -49,7 +49,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
update_flag=0
@@ -149,127 +149,127 @@ done
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
if [ "$verMode" == "cluster" ]; then
- ${csudo} mkdir -p ${nginx_dir}
+ ${csudo}mkdir -p ${nginx_dir}
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/tq || :
- ${csudo} rm -f ${bin_link_dir}/tqd || :
- ${csudo} rm -f ${bin_link_dir}/tqdemo || :
- ${csudo} rm -f ${bin_link_dir}/rmtq || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/tq || :
+ ${csudo}rm -f ${bin_link_dir}/tqd || :
+ ${csudo}rm -f ${bin_link_dir}/tqdemo || :
+ ${csudo}rm -f ${bin_link_dir}/rmtq || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
- ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/tq ] && ${csudo} ln -s ${install_main_dir}/bin/tq ${bin_link_dir}/tq || :
- [ -x ${install_main_dir}/bin/tqd ] && ${csudo} ln -s ${install_main_dir}/bin/tqd ${bin_link_dir}/tqd || :
- [ -x ${install_main_dir}/bin/tqdemo ] && ${csudo} ln -s ${install_main_dir}/bin/tqdemo ${bin_link_dir}/tqdemo || :
- [ -x ${install_main_dir}/bin/remove_tq.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_tq.sh ${bin_link_dir}/rmtq || :
- [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
+ [ -x ${install_main_dir}/bin/tq ] && ${csudo}ln -s ${install_main_dir}/bin/tq ${bin_link_dir}/tq || :
+ [ -x ${install_main_dir}/bin/tqd ] && ${csudo}ln -s ${install_main_dir}/bin/tqd ${bin_link_dir}/tqd || :
+ [ -x ${install_main_dir}/bin/tqdemo ] && ${csudo}ln -s ${install_main_dir}/bin/tqdemo ${bin_link_dir}/tqdemo || :
+ [ -x ${install_main_dir}/bin/remove_tq.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_tq.sh ${bin_link_dir}/rmtq || :
+ [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/bin/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
if [ "$verMode" == "cluster" ]; then
- ${csudo} cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo} chmod 0555 ${nginx_dir}/*
- ${csudo} mkdir -p ${nginx_dir}/logs
- ${csudo} chmod 777 ${nginx_dir}/sbin/nginx
+ ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/*
+ ${csudo}mkdir -p ${nginx_dir}/logs
+ ${csudo}chmod 777 ${nginx_dir}/sbin/nginx
fi
}
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
- ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
+ ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/bin
+ ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -289,7 +289,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -303,7 +303,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -316,15 +316,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/tq.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/tq.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -359,7 +359,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/tq.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/tq.cfg
serverFqdn=$localFqdn
echo
return
@@ -381,7 +381,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/tq.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/tq.cfg
serverFqdn=$localFqdn
break
fi
@@ -429,13 +429,13 @@ function local_fqdn_check() {
function install_config() {
if [ ! -f ${cfg_install_dir}/tq.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${script_dir}/cfg/tq.cfg ] && ${csudo} cp ${script_dir}/cfg/tq.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/tq.cfg ] && ${csudo}cp ${script_dir}/cfg/tq.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
- ${csudo} cp -f ${script_dir}/cfg/tq.cfg ${install_main_dir}/cfg/tq.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/tq.cfg ${install_main_dir}/cfg
+ ${csudo}cp -f ${script_dir}/cfg/tq.cfg ${install_main_dir}/cfg/tq.cfg.org
+ ${csudo}ln -s ${cfg_install_dir}/tq.cfg ${install_main_dir}/cfg
[ ! -z $1 ] && return 0 || : # only install client
@@ -465,7 +465,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/tq.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/tq.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -478,69 +478,69 @@ function install_config() {
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
}
function install_connector() {
- ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+ ${csudo}cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
}
function install_examples() {
if [ -d ${script_dir}/examples ]; then
- ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi
}
function clean_service_on_sysvinit() {
#restart_config_str="tq:2345:respawn:${service_config_dir}/tqd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof tqd &> /dev/null; then
- ${csudo} service tqd stop || :
+ ${csudo}service tqd stop || :
fi
if pidof tarbitrator &> /dev/null; then
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tqd ]; then
- ${csudo} chkconfig --del tqd || :
+ ${csudo}chkconfig --del tqd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tqd ]; then
- ${csudo} insserv -r tqd || :
+ ${csudo}insserv -r tqd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tqd ]; then
- ${csudo} update-rc.d -f tqd remove || :
+ ${csudo}update-rc.d -f tqd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tqd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tqd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -551,33 +551,33 @@ function install_service_on_sysvinit() {
# Install tqd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/init.d/tqd.deb ${install_main_dir}/init.d/tqd
- ${csudo} cp ${script_dir}/init.d/tqd.deb ${service_config_dir}/tqd && ${csudo} chmod a+x ${service_config_dir}/tqd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tqd.deb ${install_main_dir}/init.d/tqd
+ ${csudo}cp ${script_dir}/init.d/tqd.deb ${service_config_dir}/tqd && ${csudo}chmod a+x ${service_config_dir}/tqd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/init.d/tqd.rpm ${install_main_dir}/init.d/tqd
- ${csudo} cp ${script_dir}/init.d/tqd.rpm ${service_config_dir}/tqd && ${csudo} chmod a+x ${service_config_dir}/tqd
- ${csudo} cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
- ${csudo} cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo} chmod a+x ${service_config_dir}/tarbitratord
+ ${csudo}cp -f ${script_dir}/init.d/tqd.rpm ${install_main_dir}/init.d/tqd
+ ${csudo}cp ${script_dir}/init.d/tqd.rpm ${service_config_dir}/tqd && ${csudo}chmod a+x ${service_config_dir}/tqd
+ ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord
+ ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord
fi
#restart_config_str="tq:2345:respawn:${service_config_dir}/tqd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add tqd || :
- ${csudo} chkconfig --level 2345 tqd on || :
- ${csudo} chkconfig --add tarbitratord || :
- ${csudo} chkconfig --level 2345 tarbitratord on || :
+ ${csudo}chkconfig --add tqd || :
+ ${csudo}chkconfig --level 2345 tqd on || :
+ ${csudo}chkconfig --add tarbitratord || :
+ ${csudo}chkconfig --level 2345 tarbitratord on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv tqd || :
- ${csudo} insserv -d tqd || :
- ${csudo} insserv tarbitratord || :
- ${csudo} insserv -d tarbitratord || :
+ ${csudo}insserv tqd || :
+ ${csudo}insserv -d tqd || :
+ ${csudo}insserv tarbitratord || :
+ ${csudo}insserv -d tarbitratord || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d tqd defaults || :
- ${csudo} update-rc.d tarbitratord defaults || :
+ ${csudo}update-rc.d tqd defaults || :
+ ${csudo}update-rc.d tarbitratord defaults || :
fi
}
@@ -585,27 +585,27 @@ function clean_service_on_systemd() {
tqd_service_config="${service_config_dir}/tqd.service"
if systemctl is-active --quiet tqd; then
echo "TQ is running, stopping it..."
- ${csudo} systemctl stop tqd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tqd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tqd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tqd_service_config}
+ ${csudo}systemctl disable tqd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tqd_service_config}
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
if systemctl is-active --quiet tarbitratord; then
echo "tarbitrator is running, stopping it..."
- ${csudo} systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop tarbitratord &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable tarbitratord &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
if systemctl is-active --quiet nginxd; then
echo "Nginx for TQ is running, stopping it..."
- ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop nginxd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable nginxd &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
}
@@ -615,81 +615,81 @@ function install_service_on_systemd() {
clean_service_on_systemd
tqd_service_config="${service_config_dir}/tqd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'Description=TQ server service' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tqd_service_config}"
- ${csudo} bash -c "echo >> ${tqd_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tqd' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/tq/bin/startPre.sh' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tqd_service_config}"
- ${csudo} bash -c "echo >> ${tqd_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tqd_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tqd_service_config}"
- ${csudo} systemctl enable tqd
+ ${csudo}bash -c "echo '[Unit]' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'Description=TQ server service' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo >> ${tqd_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tqd' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/tq/bin/startPre.sh' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo >> ${tqd_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tqd_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tqd_service_config}"
+ ${csudo}systemctl enable tqd
tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
- ${csudo} bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Description=TQ arbitrator service' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
- #${csudo} systemctl enable tarbitratord
+ ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Description=TQ arbitrator service' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}"
+ #${csudo}systemctl enable tarbitratord
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/nginxd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Description=Nginx For PowrDB Service' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Type=forking' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
- ${csudo} bash -c "echo >> ${nginx_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${nginx_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
- if ! ${csudo} systemctl enable nginxd &> /dev/null; then
- ${csudo} systemctl daemon-reexec
- ${csudo} systemctl enable nginxd
+ ${csudo}bash -c "echo '[Unit]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Description=Nginx For PowrDB Service' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Type=forking' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'PIDFile=/usr/local/nginxd/logs/nginx.pid' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/local/nginxd/sbin/nginx' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'ExecStop=/usr/local/nginxd/sbin/nginx -s stop' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo >> ${nginx_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${nginx_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${nginx_service_config}"
+ if ! ${csudo}systemctl enable nginxd &> /dev/null; then
+ ${csudo}systemctl daemon-reexec
+ ${csudo}systemctl enable nginxd
fi
- ${csudo} systemctl start nginxd
+ ${csudo}systemctl start nginxd
fi
}
@@ -770,9 +770,9 @@ function update_tq() {
# Stop the service if running
if pidof tqd &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop tqd || :
+ ${csudo}systemctl stop tqd || :
elif ((${service_mod}==1)); then
- ${csudo} service tqd stop || :
+ ${csudo}service tqd stop || :
else
kill_process tqd
fi
@@ -781,9 +781,9 @@ function update_tq() {
if [ "$verMode" == "cluster" ]; then
if pidof nginx &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop nginxd || :
+ ${csudo}systemctl stop nginxd || :
elif ((${service_mod}==1)); then
- ${csudo} service nginxd stop || :
+ ${csudo}service nginxd stop || :
else
kill_process nginx
fi
@@ -824,9 +824,9 @@ function update_tq() {
echo
echo -e "${GREEN_DARK}To configure TQ ${NC}: edit /etc/tq/tq.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo} systemctl start tqd${NC}"
+ echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo}systemctl start tqd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo} service tqd start${NC}"
+ echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo}service tqd start${NC}"
else
echo -e "${GREEN_DARK}To start TQ ${NC}: ./tqd${NC}"
fi
@@ -901,9 +901,9 @@ function install_tq() {
echo
echo -e "${GREEN_DARK}To configure TQ ${NC}: edit /etc/tq/tq.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo} systemctl start tqd${NC}"
+ echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo}systemctl start tqd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo} service tqd start${NC}"
+ echo -e "${GREEN_DARK}To start TQ ${NC}: ${csudo}service tqd start${NC}"
else
echo -e "${GREEN_DARK}To start TQ ${NC}: tqd${NC}"
fi
diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh
index 38b45871a6a96887fee19cd460f056410f52fbc5..ba81aacb19e8054ce7d4423cd3b106c1a8d1ad67 100755
--- a/packaging/tools/make_install.sh
+++ b/packaging/tools/make_install.sh
@@ -67,7 +67,7 @@ os_type=0
if [ "$osType" != "Darwin" ]; then
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
if pidof systemd &> /dev/null; then
@@ -118,7 +118,7 @@ fi
function kill_taosadapter() {
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
@@ -126,79 +126,79 @@ function kill_taosd() {
ps -ef | grep "taosd"
pid=$(ps -ef | grep -w "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_main_path() {
#create install main dir and all sub dir
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -rf ${install_main_dir} || :
- ${csudo} mkdir -p ${install_main_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include
- ${csudo} mkdir -p ${install_main_dir}/init.d
+ ${csudo}rm -rf ${install_main_dir} || :
+ ${csudo}mkdir -p ${install_main_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include
+ ${csudo}mkdir -p ${install_main_dir}/init.d
else
- ${csudo} rm -rf ${install_main_dir} || ${csudo} rm -rf ${install_main_2_dir} || :
- ${csudo} mkdir -p ${install_main_dir} || ${csudo} mkdir -p ${install_main_2_dir}
- ${csudo} mkdir -p ${install_main_dir}/cfg || ${csudo} mkdir -p ${install_main_2_dir}/cfg
- ${csudo} mkdir -p ${install_main_dir}/bin || ${csudo} mkdir -p ${install_main_2_dir}/bin
- ${csudo} mkdir -p ${install_main_dir}/connector || ${csudo} mkdir -p ${install_main_2_dir}/connector
- ${csudo} mkdir -p ${install_main_dir}/driver || ${csudo} mkdir -p ${install_main_2_dir}/driver
- ${csudo} mkdir -p ${install_main_dir}/examples || ${csudo} mkdir -p ${install_main_2_dir}/examples
- ${csudo} mkdir -p ${install_main_dir}/include || ${csudo} mkdir -p ${install_main_2_dir}/include
+ ${csudo}rm -rf ${install_main_dir} || ${csudo}rm -rf ${install_main_2_dir} || :
+ ${csudo}mkdir -p ${install_main_dir} || ${csudo}mkdir -p ${install_main_2_dir}
+ ${csudo}mkdir -p ${install_main_dir}/cfg || ${csudo}mkdir -p ${install_main_2_dir}/cfg
+ ${csudo}mkdir -p ${install_main_dir}/bin || ${csudo}mkdir -p ${install_main_2_dir}/bin
+ ${csudo}mkdir -p ${install_main_dir}/connector || ${csudo}mkdir -p ${install_main_2_dir}/connector
+ ${csudo}mkdir -p ${install_main_dir}/driver || ${csudo}mkdir -p ${install_main_2_dir}/driver
+ ${csudo}mkdir -p ${install_main_dir}/examples || ${csudo}mkdir -p ${install_main_2_dir}/examples
+ ${csudo}mkdir -p ${install_main_dir}/include || ${csudo}mkdir -p ${install_main_2_dir}/include
fi
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosd || :
- ${csudo} rm -f ${bin_link_dir}/taosadapter || :
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
- ${csudo} rm -f ${bin_link_dir}/taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosd || :
+ ${csudo}rm -f ${bin_link_dir}/taosadapter || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${bin_link_dir}/taosdump || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${bin_link_dir}/perfMonitor || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
- ${csudo} rm -f ${bin_link_dir}/rmtaos || :
+ ${csudo}rm -f ${bin_link_dir}/perfMonitor || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/rmtaos || :
- ${csudo} cp -r ${binary_dir}/build/bin/* ${install_main_dir}/bin
- ${csudo} cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin
+ ${csudo}cp -r ${binary_dir}/build/bin/* ${install_main_dir}/bin
+ ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin
- ${csudo} cp -r ${script_dir}/remove.sh ${install_main_dir}/bin
- ${csudo} cp -r ${script_dir}/set_core.sh ${install_main_dir}/bin
- ${csudo} cp -r ${script_dir}/run_taosd.sh ${install_main_dir}/bin
- ${csudo} cp -r ${script_dir}/startPre.sh ${install_main_dir}/bin
+ ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin
+ ${csudo}cp -r ${script_dir}/set_core.sh ${install_main_dir}/bin
+ ${csudo}cp -r ${script_dir}/run_taosd.sh ${install_main_dir}/bin
+ ${csudo}cp -r ${script_dir}/startPre.sh ${install_main_dir}/bin
- ${csudo} chmod 0555 ${install_main_dir}/bin/*
+ ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
- [ -x ${install_main_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || :
- [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo} ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || :
- [ -x ${install_main_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
- [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
- [ -x ${install_main_dir}/bin/perfMonitor ] && ${csudo} ln -s ${install_main_dir}/bin/perfMonitor ${bin_link_dir}/perfMonitor || :
- [ -x ${install_main_dir}/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
- [ -x ${install_main_dir}/run_taosd.sh ] && ${csudo} ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
- [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
+ [ -x ${install_main_dir}/bin/taos ] && ${csudo}ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
+ [ -x ${install_main_dir}/bin/taosd ] && ${csudo}ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || :
+ [ -x ${install_main_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || :
+ [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
+ [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
+ [ -x ${install_main_dir}/bin/perfMonitor ] && ${csudo}ln -s ${install_main_dir}/bin/perfMonitor ${bin_link_dir}/perfMonitor || :
+ [ -x ${install_main_dir}/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${install_main_dir}/run_taosd.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd.sh ${bin_link_dir}/run_taosd.sh || :
+ [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
else
- ${csudo} cp -r ${binary_dir}/build/bin/* ${install_main_dir}/bin || ${csudo} cp -r ${binary_dir}/build/bin/* ${install_main_2_dir}/bin || :
- ${csudo} cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin || ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_2_dir} || :
- ${csudo} cp -r ${script_dir}/remove_client.sh ${install_main_dir}/bin || ${csudo} cp -r ${script_dir}/remove_client.sh ${install_main_2_dir}/bin
- ${csudo} chmod 0555 ${install_main_dir}/bin/* || ${csudo} chmod 0555 ${install_main_2_dir}/bin/*
+ ${csudo}cp -r ${binary_dir}/build/bin/* ${install_main_dir}/bin || ${csudo}cp -r ${binary_dir}/build/bin/* ${install_main_2_dir}/bin || :
+ ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin || ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_2_dir} || :
+ ${csudo}cp -r ${script_dir}/remove_client.sh ${install_main_dir}/bin || ${csudo}cp -r ${script_dir}/remove_client.sh ${install_main_2_dir}/bin
+ ${csudo}chmod 0555 ${install_main_dir}/bin/* || ${csudo}chmod 0555 ${install_main_2_dir}/bin/*
#Make link
- [ -x ${install_main_dir}/bin/taos ] || [ -x ${install_main_2_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || ${csudo} ln -s ${install_main_2_dir}/bin/taos || :
- [ -x ${install_main_dir}/bin/taosd ] || [ -x ${install_main_2_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || ${csudo} ln -s ${install_main_2_dir}/bin/taosd || :
- [ -x ${install_main_dir}/bin/taosadapter ] || [ -x ${install_main_2_dir}/bin/taosadapter ] && ${csudo} ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || ${csudo} ln -s ${install_main_2_dir}/bin/taosadapter || :
- [ -x ${install_main_dir}/bin/taosdump ] || [ -x ${install_main_2_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || ln -s ${install_main_2_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
- [ -x ${install_main_dir}/bin/taosdemo ] || [ -x ${install_main_2_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || ln -s ${install_main_2_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
+ [ -x ${install_main_dir}/bin/taos ] || [ -x ${install_main_2_dir}/bin/taos ] && ${csudo}ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || ${csudo}ln -s ${install_main_2_dir}/bin/taos || :
+ [ -x ${install_main_dir}/bin/taosd ] || [ -x ${install_main_2_dir}/bin/taosd ] && ${csudo}ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || ${csudo}ln -s ${install_main_2_dir}/bin/taosd || :
+ [ -x ${install_main_dir}/bin/taosadapter ] || [ -x ${install_main_2_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || ${csudo}ln -s ${install_main_2_dir}/bin/taosadapter || :
+ [ -x ${install_main_dir}/bin/taosdump ] || [ -x ${install_main_2_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || ln -s ${install_main_2_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
+ [ -x ${install_main_dir}/bin/taosdemo ] || [ -x ${install_main_2_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || ln -s ${install_main_2_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
fi
}
@@ -207,48 +207,48 @@ function install_jemalloc() {
/usr/bin/install -c -d /usr/local/bin
if [ -f "${binary_dir}/build/bin/jemalloc-config" ]; then
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/bin/jemalloc-config /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/bin/jemalloc-config /usr/local/bin
fi
if [ -f "${binary_dir}/build/bin/jemalloc.sh" ]; then
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/bin/jemalloc.sh /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/bin/jemalloc.sh /usr/local/bin
fi
if [ -f "${binary_dir}/build/bin/jeprof" ]; then
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/bin/jeprof /usr/local/bin
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/bin/jeprof /usr/local/bin
fi
if [ -f "${binary_dir}/build/include/jemalloc/jemalloc.h" ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/include/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${binary_dir}/build/include/jemalloc/jemalloc.h\
+ ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${binary_dir}/build/include/jemalloc/jemalloc.h\
/usr/local/include/jemalloc
fi
if [ -f "${binary_dir}/build/lib/libjemalloc.so.2" ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc.so.2 /usr/local/lib
- ${csudo} ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
- ${csudo} /usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc.so.2 /usr/local/lib
+ ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
+ ${csudo}/usr/bin/install -c -d /usr/local/lib
[ -f ${binary_dir}/build/lib/libjemalloc.a ] &&
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc.a /usr/local/lib
[ -f ${binary_dir}/build/lib/libjemalloc_pic.a ] &&
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc_pic.a /usr/local/lib
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/lib/libjemalloc_pic.a /usr/local/lib
if [ -f "${binary_dir}/build/lib/pkgconfig/jemalloc.pc" ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/lib/pkgconfig
- ${csudo} /usr/bin/install -c -m 644 ${binary_dir}/build/lib/pkgconfig/jemalloc.pc\
+ ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
+ ${csudo}/usr/bin/install -c -m 644 ${binary_dir}/build/lib/pkgconfig/jemalloc.pc\
/usr/local/lib/pkgconfig
fi
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/lib" | ${csudo} tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
- ${csudo} ldconfig
+ echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi
if [ -f "${binary_dir}/build/share/doc/jemalloc/jemalloc.html" ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/doc/jemalloc
- ${csudo} /usr/bin/install -c -m 644 ${binary_dir}/build/share/doc/jemalloc/jemalloc.html\
+ ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
+ ${csudo}/usr/bin/install -c -m 644 ${binary_dir}/build/share/doc/jemalloc/jemalloc.html\
/usr/local/share/doc/jemalloc
fi
if [ -f "${binary_dir}/build/share/man/man3/jemalloc.3" ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
- ${csudo} /usr/bin/install -c -m 644 ${binary_dir}/build/share/man/man3/jemalloc.3\
+ ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
+ ${csudo}/usr/bin/install -c -m 644 ${binary_dir}/build/share/man/man3/jemalloc.3\
/usr/local/share/man/man3
fi
fi
@@ -257,17 +257,17 @@ function install_jemalloc() {
function install_avro() {
if [ "$osType" != "Darwin" ]; then
if [ -f "${binary_dir}/build/$1/libavro.so.23.0.0" ] && [ -d /usr/local/$1 ]; then
- ${csudo} /usr/bin/install -c -d /usr/local/$1
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/$1/libavro.so.23.0.0 /usr/local/$1
- ${csudo} ln -sf libavro.so.23.0.0 /usr/local/$1/libavro.so.23
- ${csudo} ln -sf libavro.so.23 /usr/local/$1/libavro.so
- ${csudo} /usr/bin/install -c -d /usr/local/$1
+ ${csudo}/usr/bin/install -c -d /usr/local/$1
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/$1/libavro.so.23.0.0 /usr/local/$1
+ ${csudo}ln -sf libavro.so.23.0.0 /usr/local/$1/libavro.so.23
+ ${csudo}ln -sf libavro.so.23 /usr/local/$1/libavro.so
+ ${csudo}/usr/bin/install -c -d /usr/local/$1
[ -f ${binary_dir}/build/$1/libavro.a ] &&
- ${csudo} /usr/bin/install -c -m 755 ${binary_dir}/build/$1/libavro.a /usr/local/$1
+ ${csudo}/usr/bin/install -c -m 755 ${binary_dir}/build/$1/libavro.a /usr/local/$1
if [ -d /etc/ld.so.conf.d ]; then
- echo "/usr/local/$1" | ${csudo} tee /etc/ld.so.conf.d/libavro.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/libavro.conf"
- ${csudo} ldconfig
+ echo "/usr/local/$1" | ${csudo}tee /etc/ld.so.conf.d/libavro.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/libavro.conf"
+ ${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
@@ -277,47 +277,47 @@ function install_avro() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} cp ${binary_dir}/build/lib/libtaos.so.${verNumber} \
+ ${csudo}cp ${binary_dir}/build/lib/libtaos.so.${verNumber} \
${install_main_dir}/driver \
- && ${csudo} chmod 777 ${install_main_dir}/driver/*
+ && ${csudo}chmod 777 ${install_main_dir}/driver/*
- ${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -sf ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -sf ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then
- ${csudo} ln -sf ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1
- ${csudo} ln -sf ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so
+ ${csudo}ln -sf ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1
+ ${csudo}ln -sf ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so
fi
else
- ${csudo} cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib \
+ ${csudo}cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib \
${install_main_dir}/driver \
- || ${csudo} cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib \
+ || ${csudo}cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib \
${install_main_2_dir}/driver \
- && ${csudo} chmod 777 ${install_main_dir}/driver/* \
- || ${csudo} chmod 777 ${install_main_2_dir}/driver/*
+ && ${csudo}chmod 777 ${install_main_dir}/driver/* \
+ || ${csudo}chmod 777 ${install_main_2_dir}/driver/*
- ${csudo} ln -sf ${install_main_dir}/driver/libtaos.* \
+ ${csudo}ln -sf ${install_main_dir}/driver/libtaos.* \
${install_main_dir}/driver/libtaos.1.dylib \
- || ${csudo} ln -sf ${install_main_2_dir}/driver/libtaos.* \
+ || ${csudo}ln -sf ${install_main_2_dir}/driver/libtaos.* \
${install_main_2_dir}/driver/libtaos.1.dylib || :
- ${csudo} ln -sf ${install_main_dir}/driver/libtaos.1.dylib \
+ ${csudo}ln -sf ${install_main_dir}/driver/libtaos.1.dylib \
${install_main_dir}/driver/libtaos.dylib \
- || ${csudo} ln -sf ${install_main_2_dir}/driver/libtaos.1.dylib \
+ || ${csudo}ln -sf ${install_main_2_dir}/driver/libtaos.1.dylib \
${install_main_2_dir}/driver/libtaos.dylib || :
- ${csudo} ln -sf ${install_main_dir}/driver/libtaos.${verNumber}.dylib \
+ ${csudo}ln -sf ${install_main_dir}/driver/libtaos.${verNumber}.dylib \
${lib_link_dir}/libtaos.1.dylib \
- || ${csudo} ln -sf ${install_main_2_dir}/driver/libtaos.${verNumber}.dylib \
+ || ${csudo}ln -sf ${install_main_2_dir}/driver/libtaos.${verNumber}.dylib \
${lib_link_dir}/libtaos.1.dylib || :
- ${csudo} ln -sf ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib || :
+ ${csudo}ln -sf ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib || :
fi
install_jemalloc
@@ -325,129 +325,129 @@ function install_lib() {
install_avro lib64
if [ "$osType" != "Darwin" ]; then
- ${csudo} ldconfig
+ ${csudo}ldconfig
fi
}
function install_header() {
if [ "$osType" != "Darwin" ]; then
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
- ${csudo} cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taosdef.h ${source_dir}/src/inc/taoserror.h \
- ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
- ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
+ ${csudo}cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taosdef.h ${source_dir}/src/inc/taoserror.h \
+ ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
+ ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
else
- ${csudo} cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taosdef.h ${source_dir}/src/inc/taoserror.h \
+ ${csudo}cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taosdef.h ${source_dir}/src/inc/taoserror.h \
${install_main_dir}/include \
- || ${csudo} cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taosdef.h ${source_dir}/src/inc/taoserror.h \
+ || ${csudo}cp -f ${source_dir}/src/inc/taos.h ${source_dir}/src/inc/taosdef.h ${source_dir}/src/inc/taoserror.h \
${install_main_2_dir}/include \
- && ${csudo} chmod 644 ${install_main_dir}/include/* \
- || ${csudo} chmod 644 ${install_main_2_dir}/include/*
+ && ${csudo}chmod 644 ${install_main_dir}/include/* \
+ || ${csudo}chmod 644 ${install_main_2_dir}/include/*
fi
}
function install_config() {
if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
+ ${csudo}mkdir -p ${cfg_install_dir}
[ -f ${script_dir}/../cfg/taos.cfg ] &&
- ${csudo} cp ${script_dir}/../cfg/taos.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/taos.cfg
- ${csudo} cp -f ${script_dir}/../cfg/taos.cfg \
+ ${csudo}cp ${script_dir}/../cfg/taos.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/taos.cfg
+ ${csudo}cp -f ${script_dir}/../cfg/taos.cfg \
${cfg_install_dir}/taos.cfg.${verNumber}
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg \
+ ${csudo}ln -s ${cfg_install_dir}/taos.cfg \
${install_main_dir}/cfg/taos.cfg
else
- ${csudo} cp -f ${script_dir}/../cfg/taos.cfg \
+ ${csudo}cp -f ${script_dir}/../cfg/taos.cfg \
${cfg_install_dir}/taos.cfg.${verNumber}
fi
}
function install_taosadapter_config() {
if [ ! -f "${cfg_install_dir}/taosadapter.toml" ]; then
- ${csudo} mkdir -p ${cfg_install_dir}
+ ${csudo}mkdir -p ${cfg_install_dir}
[ -f ${binary_dir}/test/cfg/taosadapter.toml ] &&
- ${csudo} cp ${binary_dir}/test/cfg/taosadapter.toml ${cfg_install_dir}
+ ${csudo}cp ${binary_dir}/test/cfg/taosadapter.toml ${cfg_install_dir}
[ -f ${cfg_install_dir}/taosadapter.toml ] &&
- ${csudo} chmod 644 ${cfg_install_dir}/taosadapter.toml
+ ${csudo}chmod 644 ${cfg_install_dir}/taosadapter.toml
[ -f ${binary_dir}/test/cfg/taosadapter.toml ] &&
- ${csudo} cp -f ${binary_dir}/test/cfg/taosadapter.toml \
+ ${csudo}cp -f ${binary_dir}/test/cfg/taosadapter.toml \
${cfg_install_dir}/taosadapter.toml.${verNumber}
[ -f ${cfg_install_dir}/taosadapter.toml ] && \
- ${csudo} ln -s ${cfg_install_dir}/taosadapter.toml \
+ ${csudo}ln -s ${cfg_install_dir}/taosadapter.toml \
${install_main_dir}/cfg/taosadapter.toml
else
if [ -f "${binary_dir}/test/cfg/taosadapter.toml" ]; then
- ${csudo} cp -f ${binary_dir}/test/cfg/taosadapter.toml \
+ ${csudo}cp -f ${binary_dir}/test/cfg/taosadapter.toml \
${cfg_install_dir}/taosadapter.toml.${verNumber}
fi
fi
}
function install_log() {
- ${csudo} rm -rf ${log_dir} || :
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+ ${csudo}rm -rf ${log_dir} || :
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log
else
- ${csudo} ln -s ${log_dir} ${install_main_dir}/log || ${csudo} ln -s ${log_dir} ${install_main_2_dir}/log
+ ${csudo}ln -s ${log_dir} ${install_main_dir}/log || ${csudo}ln -s ${log_dir} ${install_main_2_dir}/log
fi
}
function install_data() {
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${data_dir}
if [ "$osType" != "Darwin" ]; then
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data
else
- ${csudo} ln -s ${data_dir} ${install_main_dir}/data || ${csudo} ln -s ${data_dir} ${install_main_2_dir}/data
+ ${csudo}ln -s ${data_dir} ${install_main_dir}/data || ${csudo}ln -s ${data_dir} ${install_main_2_dir}/data
fi
}
function install_connector() {
if find ${source_dir}/src/connector/go -mindepth 1 -maxdepth 1 | read; then
- ${csudo} cp -r ${source_dir}/src/connector/go ${install_main_dir}/connector
+ ${csudo}cp -r ${source_dir}/src/connector/go ${install_main_dir}/connector
else
echo "WARNING: go connector not found, please check if want to use it!"
fi
if [ "$osType" != "Darwin" ]; then
- ${csudo} cp -rf ${source_dir}/src/connector/python ${install_main_dir}/connector
- ${csudo} cp ${binary_dir}/build/lib/*.jar ${install_main_dir}/connector &> /dev/null && ${csudo} chmod 777 ${install_main_dir}/connector/*.jar || echo &> /dev/null
+ ${csudo}cp -rf ${source_dir}/src/connector/python ${install_main_dir}/connector
+ ${csudo}cp ${binary_dir}/build/lib/*.jar ${install_main_dir}/connector &> /dev/null && ${csudo}chmod 777 ${install_main_dir}/connector/*.jar || echo &> /dev/null
else
- ${csudo} cp -rf ${source_dir}/src/connector/python ${install_main_dir}/connector || ${csudo} cp -rf ${source_dir}/src/connector/python ${install_main_2_dir}/connector
- ${csudo} cp ${binary_dir}/build/lib/*.jar ${install_main_dir}/connector &> /dev/null && ${csudo} chmod 777 ${install_main_dir}/connector/*.jar || echo &> /dev/null
- ${csudo} cp ${binary_dir}/build/lib/*.jar ${install_main_2_dir}/connector &> /dev/null && ${csudo} chmod 777 ${install_main_2_dir}/connector/*.jar || echo &> /dev/null
+ ${csudo}cp -rf ${source_dir}/src/connector/python ${install_main_dir}/connector || ${csudo}cp -rf ${source_dir}/src/connector/python ${install_main_2_dir}/connector
+ ${csudo}cp ${binary_dir}/build/lib/*.jar ${install_main_dir}/connector &> /dev/null && ${csudo}chmod 777 ${install_main_dir}/connector/*.jar || echo &> /dev/null
+ ${csudo}cp ${binary_dir}/build/lib/*.jar ${install_main_2_dir}/connector &> /dev/null && ${csudo}chmod 777 ${install_main_2_dir}/connector/*.jar || echo &> /dev/null
fi
}
function install_examples() {
if [ "$osType" != "Darwin" ]; then
- ${csudo} cp -rf ${source_dir}/tests/examples/* ${install_main_dir}/examples
+ ${csudo}cp -rf ${source_dir}/tests/examples/* ${install_main_dir}/examples
else
- ${csudo} cp -rf ${source_dir}/tests/examples/* ${install_main_dir}/examples || ${csudo} cp -rf ${source_dir}/tests/examples/* ${install_main_2_dir}/examples
+ ${csudo}cp -rf ${source_dir}/tests/examples/* ${install_main_dir}/examples || ${csudo}cp -rf ${source_dir}/tests/examples/* ${install_main_2_dir}/examples
fi
}
function clean_service_on_sysvinit() {
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof taosd &> /dev/null; then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --del taosd || :
+ ${csudo}chkconfig --del taosd || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv -r taosd || :
+ ${csudo}insserv -r taosd || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d -f taosd remove || :
+ ${csudo}update-rc.d -f taosd remove || :
fi
- ${csudo} rm -f ${service_config_dir}/taosd || :
+ ${csudo}rm -f ${service_config_dir}/taosd || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -458,24 +458,24 @@ function install_service_on_sysvinit() {
# Install taosd service
if ((${os_type}==1)); then
- ${csudo} cp -f ${script_dir}/../deb/taosd ${install_main_dir}/init.d
- ${csudo} cp ${script_dir}/../deb/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
+ ${csudo}cp -f ${script_dir}/../deb/taosd ${install_main_dir}/init.d
+ ${csudo}cp ${script_dir}/../deb/taosd ${service_config_dir} && ${csudo}chmod a+x ${service_config_dir}/taosd
elif ((${os_type}==2)); then
- ${csudo} cp -f ${script_dir}/../rpm/taosd ${install_main_dir}/init.d
- ${csudo} cp ${script_dir}/../rpm/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
+ ${csudo}cp -f ${script_dir}/../rpm/taosd ${install_main_dir}/init.d
+ ${csudo}cp ${script_dir}/../rpm/taosd ${service_config_dir} && ${csudo}chmod a+x ${service_config_dir}/taosd
fi
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add taosd || :
- ${csudo} chkconfig --level 2345 taosd on || :
+ ${csudo}chkconfig --add taosd || :
+ ${csudo}chkconfig --level 2345 taosd on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv taosd || :
- ${csudo} insserv -d taosd || :
+ ${csudo}insserv taosd || :
+ ${csudo}insserv -d taosd || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d taosd defaults || :
+ ${csudo}update-rc.d taosd defaults || :
fi
}
@@ -484,11 +484,11 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet taosd; then
echo "TDengine is running, stopping it..."
- ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop taosd &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable taosd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable taosd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${taosd_service_config}
+ ${csudo}rm -f ${taosd_service_config}
}
# taos:2345:respawn:/etc/init.d/taosd start
@@ -498,36 +498,36 @@ function install_service_on_systemd() {
taosd_service_config="${service_config_dir}/taosd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}"
- ${csudo} bash -c "echo >> ${taosd_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}"
- ${csudo} bash -c "echo >> ${taosd_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}"
- ${csudo} systemctl enable taosd
+ ${csudo}bash -c "echo '[Unit]' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo >> ${taosd_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo >> ${taosd_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}"
+ ${csudo}systemctl enable taosd
}
function install_taosadapter_service() {
if ((${service_mod}==0)); then
[ -f ${binary_dir}/test/cfg/taosadapter.service ] &&\
- ${csudo} cp ${binary_dir}/test/cfg/taosadapter.service\
+ ${csudo}cp ${binary_dir}/test/cfg/taosadapter.service\
${service_config_dir}/ || :
- ${csudo} systemctl daemon-reload
+ ${csudo}systemctl daemon-reload
fi
}
@@ -548,9 +548,9 @@ function update_TDengine() {
if pidof taosd &> /dev/null; then
if ((${service_mod}==0)); then
- ${csudo} systemctl stop taosd || :
+ ${csudo}systemctl stop taosd || :
elif ((${service_mod}==1)); then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
else
kill_taosadapter
kill_taosd
@@ -580,9 +580,9 @@ function update_TDengine() {
echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
echo -e "${GREEN_DARK}To configure Taos Adapter (if has) ${NC}: edit /etc/taos/taosadapter.toml"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}service taosd start${NC}"
else
echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}"
echo -e "${GREEN_DARK}To start TDengine ${NC}: taosd${NC}"
@@ -620,10 +620,11 @@ function install_TDengine() {
echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
echo -e "${GREEN_DARK}To configure taosadapter (if has) ${NC}: edit /etc/taos/taosadapter.toml"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}service taosd start${NC}"
else
+ echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}"
echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}"
fi
diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh
index 7a90435d8f1ce8dc190e0f1513aee080838e4645..7fc2f984570f65a0b0381e5e54510e0fef667c6a 100755
--- a/packaging/tools/post.sh
+++ b/packaging/tools/post.sh
@@ -41,7 +41,7 @@ NC='\033[0m'
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -65,62 +65,62 @@ else
fi
function kill_taosadapter() {
-# ${csudo} pkill -f taosadapter || :
+# ${csudo}pkill -f taosadapter || :
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_taosd() {
-# ${csudo} pkill -f taosd || :
+# ${csudo}pkill -f taosd || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function install_include() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h|| :
- ${csudo} ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h
- ${csudo} ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h
- ${csudo} ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h
+ ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h|| :
+ ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h
+ ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h
+ ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h
}
function install_lib() {
- ${csudo} rm -f ${lib_link_dir}/libtaos* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos* || :
- ${csudo} ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1
- ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
+ ${csudo}ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1
+ ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
- ${csudo} ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
- ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
+ ${csudo}ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
+ ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
- ${csudo} ldconfig
+ ${csudo}ldconfig
}
function install_bin() {
# Remove links
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosd || :
- ${csudo} rm -f ${bin_link_dir}/taosadapter || :
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
- ${csudo} rm -f ${bin_link_dir}/taosdump || :
- ${csudo} rm -f ${bin_link_dir}/rmtaos || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosd || :
+ ${csudo}rm -f ${bin_link_dir}/taosadapter || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${bin_link_dir}/taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmtaos || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
- ${csudo} chmod 0555 ${bin_dir}/*
+ ${csudo}chmod 0555 ${bin_dir}/*
#Make link
- [ -x ${bin_dir}/taos ] && ${csudo} ln -s ${bin_dir}/taos ${bin_link_dir}/taos || :
- [ -x ${bin_dir}/taosd ] && ${csudo} ln -s ${bin_dir}/taosd ${bin_link_dir}/taosd || :
- [ -x ${bin_dir}/taosadapter ] && ${csudo} ln -s ${bin_dir}/taosadapter ${bin_link_dir}/taosadapter || :
- [ -x ${bin_dir}/taosdemo ] && ${csudo} ln -s ${bin_dir}/taosdemo ${bin_link_dir}/taosdemo || :
- [ -x ${bin_dir}/taosdump ] && ${csudo} ln -s ${bin_dir}/taosdump ${bin_link_dir}/taosdump || :
- [ -x ${bin_dir}/set_core.sh ] && ${csudo} ln -s ${bin_dir}/set_core.sh ${bin_link_dir}/set_core || :
+ [ -x ${bin_dir}/taos ] && ${csudo}ln -s ${bin_dir}/taos ${bin_link_dir}/taos || :
+ [ -x ${bin_dir}/taosd ] && ${csudo}ln -s ${bin_dir}/taosd ${bin_link_dir}/taosd || :
+ [ -x ${bin_dir}/taosadapter ] && ${csudo}ln -s ${bin_dir}/taosadapter ${bin_link_dir}/taosadapter || :
+ [ -x ${bin_dir}/taosdemo ] && ${csudo}ln -s ${bin_dir}/taosdemo ${bin_link_dir}/taosdemo || :
+ [ -x ${bin_dir}/taosdump ] && ${csudo}ln -s ${bin_dir}/taosdump ${bin_link_dir}/taosdump || :
+ [ -x ${bin_dir}/set_core.sh ] && ${csudo}ln -s ${bin_dir}/set_core.sh ${bin_link_dir}/set_core || :
}
function add_newHostname_to_hosts() {
@@ -136,7 +136,7 @@ function add_newHostname_to_hosts() {
return
fi
done
- ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||:
+ ${csudo}echo "127.0.0.1 $1" >> /etc/hosts ||:
}
function set_hostname() {
@@ -150,7 +150,7 @@ function set_hostname() {
fi
done
- ${csudo} hostname $newHostname ||:
+ ${csudo}hostname $newHostname ||:
retval=`echo $?`
if [[ $retval != 0 ]]; then
echo
@@ -163,15 +163,15 @@ function set_hostname() {
#ubuntu/centos /etc/hostname
if [[ -e /etc/hostname ]]; then
- ${csudo} echo $newHostname > /etc/hostname ||:
+ ${csudo}echo $newHostname > /etc/hostname ||:
fi
#debian: #HOSTNAME=yourname
if [[ -e /etc/sysconfig/network ]]; then
- ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
+ ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||:
fi
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg
serverFqdn=$newHostname
if [[ -e /etc/hosts ]]; then
@@ -206,7 +206,7 @@ function set_ipAsFqdn() {
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
localFqdn="127.0.0.1"
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
serverFqdn=$localFqdn
echo
return
@@ -228,7 +228,7 @@ function set_ipAsFqdn() {
read -p "Please choose an IP from local IP list:" localFqdn
else
# Write the local FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg
serverFqdn=$localFqdn
break
fi
@@ -277,24 +277,24 @@ function local_fqdn_check() {
function install_taosadapter_config() {
if [ ! -f "${cfg_install_dir}/taosadapter.toml" ]; then
[ ! -d %{cfg_install_dir} ] &&
- ${csudo} ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${cfg_dir}/taosadapter.toml ] && ${csudo} cp ${cfg_dir}/taosadapter.toml ${cfg_install_dir}
+ ${csudo}${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${cfg_dir}/taosadapter.toml ] && ${csudo}cp ${cfg_dir}/taosadapter.toml ${cfg_install_dir}
[ -f ${cfg_install_dir}/taosadapter.toml ] &&
- ${csudo} chmod 644 ${cfg_install_dir}/taosadapter.toml
+ ${csudo}chmod 644 ${cfg_install_dir}/taosadapter.toml
fi
[ -f ${cfg_dir}/taosadapter.toml ] &&
- ${csudo} mv ${cfg_dir}/taosadapter.toml ${cfg_dir}/taosadapter.toml.new
+ ${csudo}mv ${cfg_dir}/taosadapter.toml ${cfg_dir}/taosadapter.toml.new
[ -f ${cfg_install_dir}/taosadapter.toml ] &&
- ${csudo} ln -s ${cfg_install_dir}/taosadapter.toml ${cfg_dir}
+ ${csudo}ln -s ${cfg_install_dir}/taosadapter.toml ${cfg_dir}
}
function install_config() {
if [ ! -f "${cfg_install_dir}/taos.cfg" ]; then
- ${csudo} ${csudo} mkdir -p ${cfg_install_dir}
- [ -f ${cfg_dir}/taos.cfg ] && ${csudo} cp ${cfg_dir}/taos.cfg ${cfg_install_dir}
- ${csudo} chmod 644 ${cfg_install_dir}/*
+ ${csudo}${csudo}mkdir -p ${cfg_install_dir}
+ [ -f ${cfg_dir}/taos.cfg ] && ${csudo}cp ${cfg_dir}/taos.cfg ${cfg_install_dir}
+ ${csudo}chmod 644 ${cfg_install_dir}/*
fi
# Save standard input to 6 and open / dev / TTY on standard input
@@ -305,8 +305,8 @@ function install_config() {
# restore the backup standard input, and turn off 6
exec 0<&6 6<&-
- ${csudo} mv ${cfg_dir}/taos.cfg ${cfg_dir}/taos.cfg.new
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${cfg_dir}
+ ${csudo}mv ${cfg_dir}/taos.cfg ${cfg_dir}/taos.cfg.new
+ ${csudo}ln -s ${cfg_install_dir}/taos.cfg ${cfg_dir}
#FQDN_FORMAT="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
#FQDN_FORMAT="(:[1-6][0-9][0-9][0-9][0-9]$)"
#PORT_FORMAT="(/[1-6][0-9][0-9][0-9][0-9]?/)"
@@ -326,7 +326,7 @@ function install_config() {
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
- ${csudo} sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg
+ ${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/taos.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
@@ -349,7 +349,7 @@ function install_config() {
#if [[ "$emailAddr" =~ $EMAIL_PATTERN ]]; then
# Write the email address to temp file
email_file="${install_main_dir}/email"
- ${csudo} bash -c "echo $emailAddr > ${email_file}"
+ ${csudo}bash -c "echo $emailAddr > ${email_file}"
break
#else
# read -p "Please enter the correct email address: " emailAddr
@@ -362,24 +362,24 @@ function install_config() {
function clean_service_on_sysvinit() {
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof taosd &> /dev/null; then
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --del taosd || :
+ ${csudo}chkconfig --del taosd || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv -r taosd || :
+ ${csudo}insserv -r taosd || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d -f taosd remove || :
+ ${csudo}update-rc.d -f taosd remove || :
fi
- ${csudo} rm -f ${service_config_dir}/taosd || :
+ ${csudo}rm -f ${service_config_dir}/taosd || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -389,19 +389,19 @@ function install_service_on_sysvinit() {
sleep 1
# Install taosd service
- ${csudo} cp %{init_d_dir}/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
+ ${csudo}cp %{init_d_dir}/taosd ${service_config_dir} && ${csudo}chmod a+x ${service_config_dir}/taosd
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+ #${csudo}grep -q -F "$restart_config_str" /etc/inittab || ${csudo}bash -c "echo '${restart_config_str}' >> /etc/inittab"
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --add taosd || :
- ${csudo} chkconfig --level 2345 taosd on || :
+ ${csudo}chkconfig --add taosd || :
+ ${csudo}chkconfig --level 2345 taosd on || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv taosd || :
- ${csudo} insserv -d taosd || :
+ ${csudo}insserv taosd || :
+ ${csudo}insserv -d taosd || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d taosd defaults || :
+ ${csudo}update-rc.d taosd defaults || :
fi
}
@@ -411,11 +411,11 @@ function clean_service_on_systemd() {
# taosd service already is stoped before install in preinst script
#if systemctl is-active --quiet taosd; then
# echo "TDengine is running, stopping it..."
- # ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
+ # ${csudo}systemctl stop taosd &> /dev/null || echo &> /dev/null
#fi
- ${csudo} systemctl disable taosd &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable taosd &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${taosd_service_config}
+ ${csudo}rm -f ${taosd_service_config}
}
# taos:2345:respawn:/etc/init.d/taosd start
@@ -425,36 +425,36 @@ function install_service_on_systemd() {
taosd_service_config="${service_config_dir}/taosd.service"
- ${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}"
- ${csudo} bash -c "echo >> ${taosd_service_config}"
- ${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'Restart=always' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}"
- ${csudo} bash -c "echo >> ${taosd_service_config}"
- ${csudo} bash -c "echo '[Install]' >> ${taosd_service_config}"
- ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}"
- ${csudo} systemctl enable taosd
+ ${csudo}bash -c "echo '[Unit]' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo >> ${taosd_service_config}"
+ ${csudo}bash -c "echo '[Service]' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Type=simple' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'Restart=always' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo >> ${taosd_service_config}"
+ ${csudo}bash -c "echo '[Install]' >> ${taosd_service_config}"
+ ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}"
+ ${csudo}systemctl enable taosd
}
function install_taosadapter_service() {
if ((${service_mod}==0)); then
[ -f ${script_dir}/../cfg/taosadapter.service ] &&\
- ${csudo} cp ${script_dir}/../cfg/taosadapter.service \
+ ${csudo}cp ${script_dir}/../cfg/taosadapter.service \
${service_config_dir}/ || :
- ${csudo} systemctl daemon-reload
+ ${csudo}systemctl daemon-reload
fi
}
@@ -474,14 +474,14 @@ function install_TDengine() {
echo -e "${GREEN}Start to install TDengine...${NC}"
#install log and data dir , then ln to /usr/local/taos
- ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
- ${csudo} mkdir -p ${data_dir}
+ ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
+ ${csudo}mkdir -p ${data_dir}
- ${csudo} rm -rf ${log_link_dir} || :
- ${csudo} rm -rf ${data_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${data_link_dir} || :
- ${csudo} ln -s ${log_dir} ${log_link_dir} || :
- ${csudo} ln -s ${data_dir} ${data_link_dir} || :
+ ${csudo}ln -s ${log_dir} ${log_link_dir} || :
+ ${csudo}ln -s ${data_dir} ${data_link_dir} || :
# Install include, lib, binary and service
install_include
@@ -498,10 +498,10 @@ function install_TDengine() {
echo
echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg"
if ((${service_mod}==0)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} update-rc.d taosd default ${RED} for the first time${NC}"
- echo -e " : ${csudo} service taosd start ${RED} after${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}update-rc.d taosd default ${RED} for the first time${NC}"
+ echo -e " : ${csudo}service taosd start ${RED} after${NC}"
else
echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}"
fi
diff --git a/packaging/tools/preun.sh b/packaging/tools/preun.sh
index 43fead76ba675dfa8ee45422d9f9dc8166b2488d..27dc830a1f189d196a5b937f71dbafc776d035d4 100755
--- a/packaging/tools/preun.sh
+++ b/packaging/tools/preun.sh
@@ -20,7 +20,7 @@ taos_service_name="taosd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -46,14 +46,14 @@ fi
function kill_taosadapter() {
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_taosd() {
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
@@ -61,44 +61,44 @@ function clean_service_on_systemd() {
taosadapter_service_config="${service_config_dir}/taosadapter.service"
if systemctl is-active --quiet taosadapter; then
echo "taosadapter is running, stopping it..."
- ${csudo} systemctl stop taosadapter &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop taosadapter &> /dev/null || echo &> /dev/null
fi
taosd_service_config="${service_config_dir}/${taos_service_name}.service"
if systemctl is-active --quiet ${taos_service_name}; then
echo "TDengine taosd is running, stopping it..."
- ${csudo} systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${taosd_service_config}
+ ${csudo}rm -f ${taosd_service_config}
- [ -f ${taosadapter_service_config} ] && ${csudo} rm -f ${taosadapter_service_config}
+ [ -f ${taosadapter_service_config} ] && ${csudo}rm -f ${taosadapter_service_config}
}
function clean_service_on_sysvinit() {
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof taosd &> /dev/null; then
echo "TDengine taosd is running, stopping it..."
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
fi
if ((${initd_mod}==1)); then
- ${csudo} chkconfig --del taosd || :
+ ${csudo}chkconfig --del taosd || :
elif ((${initd_mod}==2)); then
- ${csudo} insserv -r taosd || :
+ ${csudo}insserv -r taosd || :
elif ((${initd_mod}==3)); then
- ${csudo} update-rc.d -f taosd remove || :
+ ${csudo}update-rc.d -f taosd remove || :
fi
- ${csudo} rm -f ${service_config_dir}/taosd || :
+ ${csudo}rm -f ${service_config_dir}/taosd || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -118,20 +118,20 @@ function clean_service() {
clean_service
# Remove all links
-${csudo} rm -f ${bin_link_dir}/taos || :
-${csudo} rm -f ${bin_link_dir}/taosd || :
-${csudo} rm -f ${bin_link_dir}/taosadapter || :
-${csudo} rm -f ${bin_link_dir}/taosdemo || :
-${csudo} rm -f ${bin_link_dir}/set_core || :
-${csudo} rm -f ${cfg_link_dir}/*.new || :
-${csudo} rm -f ${inc_link_dir}/taos.h || :
-${csudo} rm -f ${inc_link_dir}/taosdef.h || :
-${csudo} rm -f ${inc_link_dir}/taoserror.h || :
-${csudo} rm -f ${lib_link_dir}/libtaos.* || :
-${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
-
-${csudo} rm -f ${log_link_dir} || :
-${csudo} rm -f ${data_link_dir} || :
+${csudo}rm -f ${bin_link_dir}/taos || :
+${csudo}rm -f ${bin_link_dir}/taosd || :
+${csudo}rm -f ${bin_link_dir}/taosadapter || :
+${csudo}rm -f ${bin_link_dir}/taosdemo || :
+${csudo}rm -f ${bin_link_dir}/set_core || :
+${csudo}rm -f ${cfg_link_dir}/*.new || :
+${csudo}rm -f ${inc_link_dir}/taos.h || :
+${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+${csudo}rm -f ${inc_link_dir}/taoserror.h || :
+${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+
+${csudo}rm -f ${log_link_dir} || :
+${csudo}rm -f ${data_link_dir} || :
if ((${service_mod}==2)); then
kill_taosadapter
diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh
index 4f814692ebaacf8017ede030a977af36528a27c1..b9bd1c163809c1d2dabfff6f85ffaa765378cede 100755
--- a/packaging/tools/remove.sh
+++ b/packaging/tools/remove.sh
@@ -32,7 +32,7 @@ tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -58,140 +58,140 @@ fi
function kill_taosadapter() {
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_taosd() {
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosd || :
- ${csudo} rm -f ${bin_link_dir}/taosadapter || :
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
- ${csudo} rm -f ${bin_link_dir}/taosdump || :
- ${csudo} rm -f ${bin_link_dir}/rmtaos || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosd || :
+ ${csudo}rm -f ${bin_link_dir}/taosadapter || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${bin_link_dir}/taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmtaos || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
function clean_service_on_systemd() {
taosd_service_config="${service_config_dir}/${taos_service_name}.service"
if systemctl is-active --quiet ${taos_service_name}; then
echo "TDengine taosd is running, stopping it..."
- ${csudo} systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${taosd_service_config}
+ ${csudo}systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${taosd_service_config}
taosadapter_service_config="${service_config_dir}/taosadapter.service"
if systemctl is-active --quiet ${taosadapter_service_name}; then
echo "TDengine taosAdapter is running, stopping it..."
- ${csudo} systemctl stop ${taosadapter_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${taosadapter_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${taosadapter_service_name} &> /dev/null || echo &> /dev/null
- [ -f ${taosadapter_service_config} ] && ${csudo} rm -f ${taosadapter_service_config}
+ ${csudo}systemctl disable ${taosadapter_service_name} &> /dev/null || echo &> /dev/null
+ [ -f ${taosadapter_service_config} ] && ${csudo}rm -f ${taosadapter_service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "TDengine tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/${nginx_service_name}.service"
if [ -d ${install_nginxd_dir} ]; then
if systemctl is-active --quiet ${nginx_service_name}; then
echo "Nginx for TDengine is running, stopping it..."
- ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${nginx_service_config}
fi
fi
}
function clean_service_on_sysvinit() {
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof taosd &> /dev/null; then
echo "TDengine taosd is running, stopping it..."
- ${csudo} service taosd stop || :
+ ${csudo}service taosd stop || :
fi
if pidof tarbitrator &> /dev/null; then
echo "TDengine tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/taosd ]; then
- ${csudo} chkconfig --del taosd || :
+ ${csudo}chkconfig --del taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/taosd ]; then
- ${csudo} insserv -r taosd || :
+ ${csudo}insserv -r taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/taosd ]; then
- ${csudo} update-rc.d -f taosd remove || :
+ ${csudo}update-rc.d -f taosd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/taosd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/taosd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -221,10 +221,10 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
-${csudo} rm -rf ${data_link_dir} || :
+${csudo}rm -rf ${data_link_dir} || :
-${csudo} rm -rf ${install_main_dir}
-${csudo} rm -rf ${install_nginxd_dir}
+${csudo}rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_nginxd_dir}
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else
@@ -233,13 +233,13 @@ fi
if echo $osinfo | grep -qwi "ubuntu" ; then
# echo "this is ubuntu system"
- ${csudo} dpkg --force-all -P tdengine > /dev/null 2>&1 || :
+ ${csudo}dpkg --force-all -P tdengine > /dev/null 2>&1 || :
elif echo $osinfo | grep -qwi "debian" ; then
# echo "this is debian system"
- ${csudo} dpkg --force-all -P tdengine > /dev/null 2>&1 || :
+ ${csudo}dpkg --force-all -P tdengine > /dev/null 2>&1 || :
elif echo $osinfo | grep -qwi "centos" ; then
# echo "this is centos system"
- ${csudo} rpm -e --noscripts tdengine > /dev/null 2>&1 || :
+ ${csudo}rpm -e --noscripts tdengine > /dev/null 2>&1 || :
fi
echo -e "${GREEN}TDengine is removed successfully!${NC}"
diff --git a/packaging/tools/remove_arbi.sh b/packaging/tools/remove_arbi.sh
index 4495f25f3617c3c28c6dbd22ddeeda93cdf5423a..0a1162cd7a6793d8542ad5079b8c8cce1659724a 100755
--- a/packaging/tools/remove_arbi.sh
+++ b/packaging/tools/remove_arbi.sh
@@ -20,7 +20,7 @@ service_config_dir="/etc/systemd/system"
tarbitrator_service_name="tarbitratord"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -46,24 +46,24 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf /arbitrator.log || :
+ ${csudo}rm -rf /arbitrator.log || :
}
function clean_service_on_systemd() {
@@ -71,37 +71,37 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "TDengine tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
echo "TDengine's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -125,6 +125,6 @@ clean_bin
# Remove log file
clean_log
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}TDengine's arbitrator is removed successfully!${NC}"
diff --git a/packaging/tools/remove_arbi_jh.sh b/packaging/tools/remove_arbi_jh.sh
index 8b690771c761ac51772dac83cafec46360a16be3..018bf793d9df80ed5076fa15e3714975e2c3ea80 100755
--- a/packaging/tools/remove_arbi_jh.sh
+++ b/packaging/tools/remove_arbi_jh.sh
@@ -19,7 +19,7 @@ service_config_dir="/etc/systemd/system"
tarbitrator_service_name="tarbitratord"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -45,24 +45,24 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf /arbitrator.log || :
+ ${csudo}rm -rf /arbitrator.log || :
}
function clean_service_on_systemd() {
@@ -70,37 +70,37 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "jh_iot's tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
echo "jh_iot's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -124,7 +124,7 @@ clean_bin
# Remove log file
clean_log
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}jh_iot's arbitrator is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_arbi_kh.sh b/packaging/tools/remove_arbi_kh.sh
index ec3254b01649add57f9485c59878059e086b2669..2d270ea0bef735e1c307970e4d5b45d6eca56622 100755
--- a/packaging/tools/remove_arbi_kh.sh
+++ b/packaging/tools/remove_arbi_kh.sh
@@ -19,7 +19,7 @@ service_config_dir="/etc/systemd/system"
tarbitrator_service_name="tarbitratord"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -45,24 +45,24 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf /arbitrator.log || :
+ ${csudo}rm -rf /arbitrator.log || :
}
function clean_service_on_systemd() {
@@ -70,37 +70,37 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "KingHistorian's tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
echo "KingHistorian's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -124,7 +124,7 @@ clean_bin
# Remove log file
clean_log
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}KingHistorian's arbitrator is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_arbi_power.sh b/packaging/tools/remove_arbi_power.sh
index 27b08a47e87c28395faa004515702d9e1b51492a..459ca481e32954e8472f5f1c108a597fd59ff129 100755
--- a/packaging/tools/remove_arbi_power.sh
+++ b/packaging/tools/remove_arbi_power.sh
@@ -20,7 +20,7 @@ service_config_dir="/etc/systemd/system"
tarbitrator_service_name="tarbitratord"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -46,24 +46,24 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf /arbitrator.log || :
+ ${csudo}rm -rf /arbitrator.log || :
}
function clean_service_on_systemd() {
@@ -71,37 +71,37 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "PowerDB tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
echo "PowerDB's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -125,7 +125,7 @@ clean_bin
# Remove log file
clean_log
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}PowerDB's arbitrator is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_arbi_pro.sh b/packaging/tools/remove_arbi_pro.sh
index 4bb435cc97e7b31341007ac56c6eb1bbe75a9fda..4a5edff1c6f9b006085977a2c3bf9c9e4fa24326 100755
--- a/packaging/tools/remove_arbi_pro.sh
+++ b/packaging/tools/remove_arbi_pro.sh
@@ -19,7 +19,7 @@ service_config_dir="/etc/systemd/system"
tarbitrator_service_name="tarbitratord"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -45,25 +45,25 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf /arbitrator.log || :
+ ${csudo}rm -rf /arbitrator.log || :
}
function clean_service_on_systemd() {
@@ -71,37 +71,37 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "ProDB tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
echo "ProDB's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -125,7 +125,7 @@ clean_bin
# Remove log file
clean_log
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}ProDB's arbitrator is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_arbi_tq.sh b/packaging/tools/remove_arbi_tq.sh
index e0b401255f1071a21f0a5e09cd9b6e0e307ec5ba..f1b5bed44080f0631689098c6990a5cecdd186f1 100755
--- a/packaging/tools/remove_arbi_tq.sh
+++ b/packaging/tools/remove_arbi_tq.sh
@@ -20,7 +20,7 @@ service_config_dir="/etc/systemd/system"
tarbitrator_service_name="tarbitratord"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -46,24 +46,24 @@ fi
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf /arbitrator.log || :
+ ${csudo}rm -rf /arbitrator.log || :
}
function clean_service_on_systemd() {
@@ -71,37 +71,37 @@ function clean_service_on_systemd() {
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "TQ tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}rm -f ${tarbitratord_service_config}
}
function clean_service_on_sysvinit() {
if pidof tarbitrator &> /dev/null; then
echo "TQ's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -125,7 +125,7 @@ clean_bin
# Remove log file
clean_log
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}TQ's arbitrator is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh
index aad8d67d948d566b72820625391ba7592859c079..b7e5a327bfd3b7d81520737b252111889660084d 100755
--- a/packaging/tools/remove_client.sh
+++ b/packaging/tools/remove_client.sh
@@ -24,47 +24,47 @@ inc_link_dir="/usr/include"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function kill_client() {
#pid=$(ps -ef | grep "taos" | grep -v "grep" | awk '{print $2}')
if [ -n "$(pidof taos)" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/taos || :
- ${csudo} rm -f ${bin_link_dir}/taosdemo || :
- ${csudo} rm -f ${bin_link_dir}/taosdump || :
- ${csudo} rm -f ${bin_link_dir}/rmtaos || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/taos || :
+ ${csudo}rm -f ${bin_link_dir}/taosdemo || :
+ ${csudo}rm -f ${bin_link_dir}/taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmtaos || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
# Stop client.
@@ -80,7 +80,7 @@ clean_log
# Remove link configuration file
clean_config
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}TDengine client is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_client_jh.sh b/packaging/tools/remove_client_jh.sh
index a3f5dfd10debb0a28211b3682becd083d49ca9c6..491339fb450f9017004f312032ff5f2dbcaa4164 100755
--- a/packaging/tools/remove_client_jh.sh
+++ b/packaging/tools/remove_client_jh.sh
@@ -20,44 +20,44 @@ inc_link_dir="/usr/include"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function kill_client() {
if [ -n "$(pidof jh_taos)" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/jh_taos || :
- ${csudo} rm -f ${bin_link_dir}/jhdemo || :
- ${csudo} rm -f ${bin_link_dir}/jh_taosdump || :
- ${csudo} rm -f ${bin_link_dir}/rmjh || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taos || :
+ ${csudo}rm -f ${bin_link_dir}/jhdemo || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmjh || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
# Stop client.
@@ -73,7 +73,7 @@ clean_log
# Remove link configuration file
clean_config
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}jh_iot client is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_client_kh.sh b/packaging/tools/remove_client_kh.sh
index 6a44e875e3426b14400508b1bdbd7510c2ae49cb..56cf49ca820fcc3077c2253d89955048c5ffa273 100755
--- a/packaging/tools/remove_client_kh.sh
+++ b/packaging/tools/remove_client_kh.sh
@@ -20,44 +20,44 @@ inc_link_dir="/usr/include"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function kill_client() {
if [ -n "$(pidof khclient)" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/khclient || :
- ${csudo} rm -f ${bin_link_dir}/khdemo || :
- ${csudo} rm -f ${bin_link_dir}/khdump || :
- ${csudo} rm -f ${bin_link_dir}/rmkh || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/khclient || :
+ ${csudo}rm -f ${bin_link_dir}/khdemo || :
+ ${csudo}rm -f ${bin_link_dir}/khdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmkh || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
# Stop client.
@@ -73,7 +73,7 @@ clean_log
# Remove link configuration file
clean_config
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}KingHistorian client is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_client_power.sh b/packaging/tools/remove_client_power.sh
index 75e9717e54b6e02ad5a5d8b28244caf89ab570fb..f16e7813ef894b23b01b89b365ad2038b5b1bb40 100755
--- a/packaging/tools/remove_client_power.sh
+++ b/packaging/tools/remove_client_power.sh
@@ -24,47 +24,47 @@ inc_link_dir="/usr/include"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function kill_client() {
#pid=$(ps -ef | grep "power" | grep -v "grep" | awk '{print $2}')
if [ -n "$(pidof power)" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/power || :
- ${csudo} rm -f ${bin_link_dir}/powerdemo || :
- ${csudo} rm -f ${bin_link_dir}/powerdump || :
- ${csudo} rm -f ${bin_link_dir}/rmpower || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/power || :
+ ${csudo}rm -f ${bin_link_dir}/powerdemo || :
+ ${csudo}rm -f ${bin_link_dir}/powerdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmpower || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
# Stop client.
@@ -80,7 +80,7 @@ clean_log
# Remove link configuration file
clean_config
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}PowerDB client is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_client_pro.sh b/packaging/tools/remove_client_pro.sh
index b7ddb27bf48c3e416523c021d42c6ae468fb04e2..3ed0cef1e98896f8160ae3d5a0c5e89bfc01500f 100755
--- a/packaging/tools/remove_client_pro.sh
+++ b/packaging/tools/remove_client_pro.sh
@@ -20,45 +20,45 @@ inc_link_dir="/usr/include"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function kill_client() {
if [ -n "$(pidof prodbc)" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/prodbc || :
- ${csudo} rm -f ${bin_link_dir}/prodemo || :
- ${csudo} rm -f ${bin_link_dir}/prodump || :
- ${csudo} rm -f ${bin_link_dir}/rmprodb || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/prodbc || :
+ ${csudo}rm -f ${bin_link_dir}/prodemo || :
+ ${csudo}rm -f ${bin_link_dir}/prodump || :
+ ${csudo}rm -f ${bin_link_dir}/rmprodb || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
# Stop client.
@@ -74,7 +74,7 @@ clean_log
# Remove link configuration file
clean_config
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}ProDB client is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_client_tq.sh b/packaging/tools/remove_client_tq.sh
index d701217c77e671a4ad24234bdfb4a196f5545970..a35eb9d46e4e33783b47fa33703764c10ee87b9b 100755
--- a/packaging/tools/remove_client_tq.sh
+++ b/packaging/tools/remove_client_tq.sh
@@ -24,47 +24,47 @@ inc_link_dir="/usr/include"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
function kill_client() {
#pid=$(ps -ef | grep "tq" | grep -v "grep" | awk '{print $2}')
if [ -n "$(pidof tq)" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tq || :
- ${csudo} rm -f ${bin_link_dir}/tqdemo || :
- ${csudo} rm -f ${bin_link_dir}/tqdump || :
- ${csudo} rm -f ${bin_link_dir}/rmtq || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/tq || :
+ ${csudo}rm -f ${bin_link_dir}/tqdemo || :
+ ${csudo}rm -f ${bin_link_dir}/tqdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmtq || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
# Stop client.
@@ -80,7 +80,7 @@ clean_log
# Remove link configuration file
clean_config
-${csudo} rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}TQ client is removed successfully!${NC}"
echo
diff --git a/packaging/tools/remove_jh.sh b/packaging/tools/remove_jh.sh
index 6965ba388f99e8a2ac1c33def2f696f8d7c3898e..7b3abff42ad662160cf984adf73abeb51116a422 100755
--- a/packaging/tools/remove_jh.sh
+++ b/packaging/tools/remove_jh.sh
@@ -28,7 +28,7 @@ tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -54,78 +54,78 @@ fi
function kill_process() {
pid=$(ps -ef | grep "jh_taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/jh_taos || :
- ${csudo} rm -f ${bin_link_dir}/jh_taosd || :
- ${csudo} rm -f ${bin_link_dir}/jhdemo || :
- ${csudo} rm -f ${bin_link_dir}/jh_taosdump || :
- ${csudo} rm -f ${bin_link_dir}/rmjh || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taos || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taosd || :
+ ${csudo}rm -f ${bin_link_dir}/jhdemo || :
+ ${csudo}rm -f ${bin_link_dir}/jh_taosdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmjh || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
function clean_service_on_systemd() {
service_config="${service_config_dir}/${service_name}.service"
if systemctl is-active --quiet ${service_name}; then
echo "jh_iot's jh_taosd is running, stopping it..."
- ${csudo} systemctl stop ${service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${service_config}
+ ${csudo}systemctl disable ${service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "jh_iot's tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/${nginx_service_name}.service"
if [ -d ${bin_dir}/web ]; then
if systemctl is-active --quiet ${nginx_service_name}; then
echo "Nginx for jh_iot is running, stopping it..."
- ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}rm -f ${nginx_service_config}
fi
fi
}
@@ -133,42 +133,42 @@ function clean_service_on_systemd() {
function clean_service_on_sysvinit() {
if pidof jh_taosd &> /dev/null; then
echo "jh_iot's jh_taosd is running, stopping it..."
- ${csudo} service jh_taosd stop || :
+ ${csudo}service jh_taosd stop || :
fi
if pidof tarbitrator &> /dev/null; then
echo "jh_iot's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/jh_taosd ]; then
- ${csudo} chkconfig --del jh_taosd || :
+ ${csudo}chkconfig --del jh_taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/jh_taosd ]; then
- ${csudo} insserv -r jh_taosd || :
+ ${csudo}insserv -r jh_taosd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/jh_taosd ]; then
- ${csudo} update-rc.d -f jh_taosd remove || :
+ ${csudo}update-rc.d -f jh_taosd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/jh_taosd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/jh_taosd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -196,10 +196,10 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
-${csudo} rm -rf ${data_link_dir} || :
+${csudo}rm -rf ${data_link_dir} || :
-${csudo} rm -rf ${install_main_dir}
-${csudo} rm -rf ${install_nginxd_dir}
+${csudo}rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_nginxd_dir}
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else
diff --git a/packaging/tools/remove_kh.sh b/packaging/tools/remove_kh.sh
index cf6a93fdf2bf8884bda02b4f44058eb7f8d77210..0c830455c7ef4950384f456ed55a7dd9ca706bfb 100755
--- a/packaging/tools/remove_kh.sh
+++ b/packaging/tools/remove_kh.sh
@@ -28,7 +28,7 @@ tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -54,78 +54,78 @@ fi
function kill_process() {
pid=$(ps -ef | grep "khserver" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/khclient || :
- ${csudo} rm -f ${bin_link_dir}/khserver || :
- ${csudo} rm -f ${bin_link_dir}/khdemo || :
- ${csudo} rm -f ${bin_link_dir}/khdump || :
- ${csudo} rm -f ${bin_link_dir}/rmkh || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/khclient || :
+ ${csudo}rm -f ${bin_link_dir}/khserver || :
+ ${csudo}rm -f ${bin_link_dir}/khdemo || :
+ ${csudo}rm -f ${bin_link_dir}/khdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmkh || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
function clean_service_on_systemd() {
service_config="${service_config_dir}/${service_name}.service"
if systemctl is-active --quiet ${service_name}; then
echo "KingHistorian's khserver is running, stopping it..."
- ${csudo} systemctl stop ${service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${service_config}
+ ${csudo}systemctl disable ${service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "KingHistorian's tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/${nginx_service_name}.service"
if [ -d ${bin_dir}/web ]; then
if systemctl is-active --quiet ${nginx_service_name}; then
echo "Nginx for KingHistorian is running, stopping it..."
- ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}rm -f ${nginx_service_config}
fi
fi
}
@@ -133,42 +133,42 @@ function clean_service_on_systemd() {
function clean_service_on_sysvinit() {
if pidof khserver &> /dev/null; then
echo "KingHistorian's khserver is running, stopping it..."
- ${csudo} service khserver stop || :
+ ${csudo}service khserver stop || :
fi
if pidof tarbitrator &> /dev/null; then
echo "KingHistorian's tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/khserver ]; then
- ${csudo} chkconfig --del khserver || :
+ ${csudo}chkconfig --del khserver || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/khserver ]; then
- ${csudo} insserv -r khserver || :
+ ${csudo}insserv -r khserver || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/khserver ]; then
- ${csudo} update-rc.d -f khserver remove || :
+ ${csudo}update-rc.d -f khserver remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/khserver || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/khserver || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -196,10 +196,10 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
-${csudo} rm -rf ${data_link_dir} || :
+${csudo}rm -rf ${data_link_dir} || :
-${csudo} rm -rf ${install_main_dir}
-${csudo} rm -rf ${install_nginxd_dir}
+${csudo}rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_nginxd_dir}
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else
diff --git a/packaging/tools/remove_power.sh b/packaging/tools/remove_power.sh
index 70d0095f978f8c7a2578c63110cdd118fef43e30..4216147bdf63b3e102d94a668abafd1de18c5ac1 100755
--- a/packaging/tools/remove_power.sh
+++ b/packaging/tools/remove_power.sh
@@ -31,7 +31,7 @@ tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -57,79 +57,79 @@ fi
function kill_powerd() {
pid=$(ps -ef | grep "powerd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/power || :
- ${csudo} rm -f ${bin_link_dir}/powerd || :
- ${csudo} rm -f ${bin_link_dir}/powerdemo || :
- ${csudo} rm -f ${bin_link_dir}/powerdump || :
- ${csudo} rm -f ${bin_link_dir}/rmpower || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/power || :
+ ${csudo}rm -f ${bin_link_dir}/powerd || :
+ ${csudo}rm -f ${bin_link_dir}/powerdemo || :
+ ${csudo}rm -f ${bin_link_dir}/powerdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmpower || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
function clean_service_on_systemd() {
power_service_config="${service_config_dir}/${power_service_name}.service"
if systemctl is-active --quiet ${power_service_name}; then
echo "PowerDB powerd is running, stopping it..."
- ${csudo} systemctl stop ${power_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${power_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${power_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${power_service_config}
+ ${csudo}systemctl disable ${power_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${power_service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "PowerDB tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/${nginx_service_name}.service"
if [ -d ${bin_dir}/web ]; then
if systemctl is-active --quiet ${nginx_service_name}; then
echo "Nginx for PowerDB is running, stopping it..."
- ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}rm -f ${nginx_service_config}
fi
fi
}
@@ -137,42 +137,42 @@ function clean_service_on_systemd() {
function clean_service_on_sysvinit() {
if pidof powerd &> /dev/null; then
echo "PowerDB powerd is running, stopping it..."
- ${csudo} service powerd stop || :
+ ${csudo}service powerd stop || :
fi
if pidof tarbitrator &> /dev/null; then
echo "PowerDB tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/powerd ]; then
- ${csudo} chkconfig --del powerd || :
+ ${csudo}chkconfig --del powerd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/powerd ]; then
- ${csudo} insserv -r powerd || :
+ ${csudo}insserv -r powerd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/powerd ]; then
- ${csudo} update-rc.d -f powerd remove || :
+ ${csudo}update-rc.d -f powerd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/powerd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/powerd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -200,10 +200,10 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
-${csudo} rm -rf ${data_link_dir} || :
+${csudo}rm -rf ${data_link_dir} || :
-${csudo} rm -rf ${install_main_dir}
-${csudo} rm -rf ${install_nginxd_dir}
+${csudo}rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_nginxd_dir}
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else
@@ -212,13 +212,13 @@ fi
#if echo $osinfo | grep -qwi "ubuntu" ; then
## echo "this is ubuntu system"
-# ${csudo} rm -f /var/lib/dpkg/info/tdengine* || :
+# ${csudo}rm -f /var/lib/dpkg/info/tdengine* || :
#elif echo $osinfo | grep -qwi "debian" ; then
## echo "this is debian system"
-# ${csudo} rm -f /var/lib/dpkg/info/tdengine* || :
+# ${csudo}rm -f /var/lib/dpkg/info/tdengine* || :
#elif echo $osinfo | grep -qwi "centos" ; then
## echo "this is centos system"
-# ${csudo} rpm -e --noscripts tdengine || :
+# ${csudo}rpm -e --noscripts tdengine || :
#fi
echo -e "${GREEN}PowerDB is removed successfully!${NC}"
diff --git a/packaging/tools/remove_pro.sh b/packaging/tools/remove_pro.sh
index 1572a7f08c6083f7da3d81176f107e4cb977d4f9..f9e8069bb5bb14b44520d0bea3edf2225e6d6b06 100755
--- a/packaging/tools/remove_pro.sh
+++ b/packaging/tools/remove_pro.sh
@@ -28,7 +28,7 @@ tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -54,79 +54,79 @@ fi
function kill_prodbs() {
pid=$(ps -ef | grep "prodbs" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/prodbc || :
- ${csudo} rm -f ${bin_link_dir}/prodbs || :
- ${csudo} rm -f ${bin_link_dir}/prodemo || :
- ${csudo} rm -f ${bin_link_dir}/prodump || :
- ${csudo} rm -f ${bin_link_dir}/rmprodb || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/prodbc || :
+ ${csudo}rm -f ${bin_link_dir}/prodbs || :
+ ${csudo}rm -f ${bin_link_dir}/prodemo || :
+ ${csudo}rm -f ${bin_link_dir}/prodump || :
+ ${csudo}rm -f ${bin_link_dir}/rmprodb || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
function clean_service_on_systemd() {
prodb_service_config="${service_config_dir}/${prodb_service_name}.service"
if systemctl is-active --quiet ${prodb_service_name}; then
echo "ProDB prodbs is running, stopping it..."
- ${csudo} systemctl stop ${prodb_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${prodb_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${prodb_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${prodb_service_config}
+ ${csudo}systemctl disable ${prodb_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${prodb_service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "ProDB tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/${nginx_service_name}.service"
if [ -d ${bin_dir}/web ]; then
if systemctl is-active --quiet ${nginx_service_name}; then
echo "Nginx for ProDB is running, stopping it..."
- ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}rm -f ${nginx_service_config}
fi
fi
}
@@ -134,42 +134,42 @@ function clean_service_on_systemd() {
function clean_service_on_sysvinit() {
if pidof prodbs &> /dev/null; then
echo "ProDB prodbs is running, stopping it..."
- ${csudo} service prodbs stop || :
+ ${csudo}service prodbs stop || :
fi
if pidof tarbitrator &> /dev/null; then
echo "ProDB tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/prodbs ]; then
- ${csudo} chkconfig --del prodbs || :
+ ${csudo}chkconfig --del prodbs || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/prodbs ]; then
- ${csudo} insserv -r prodbs || :
+ ${csudo}insserv -r prodbs || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/prodbs ]; then
- ${csudo} update-rc.d -f prodbs remove || :
+ ${csudo}update-rc.d -f prodbs remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/prodbs || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/prodbs || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -197,10 +197,10 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
-${csudo} rm -rf ${data_link_dir} || :
+${csudo}rm -rf ${data_link_dir} || :
-${csudo} rm -rf ${install_main_dir}
-${csudo} rm -rf ${install_nginxd_dir}
+${csudo}rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_nginxd_dir}
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else
diff --git a/packaging/tools/remove_tq.sh b/packaging/tools/remove_tq.sh
index eb83b92d1a5ef7e9e4ac498d98cc538a34da2a4f..e9a071f7d6b6bd5ae89c12cf8db5de014dbc2d52 100755
--- a/packaging/tools/remove_tq.sh
+++ b/packaging/tools/remove_tq.sh
@@ -31,7 +31,7 @@ tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd"
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
initd_mod=0
@@ -57,125 +57,125 @@ fi
function kill_tqd() {
pid=$(ps -ef | grep "tqd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
- ${csudo} kill -9 $pid || :
+ ${csudo}kill -9 $pid || :
fi
}
function clean_bin() {
# Remove link
- ${csudo} rm -f ${bin_link_dir}/tq || :
- ${csudo} rm -f ${bin_link_dir}/tqd || :
- ${csudo} rm -f ${bin_link_dir}/tqdemo || :
- ${csudo} rm -f ${bin_link_dir}/tqdump || :
- ${csudo} rm -f ${bin_link_dir}/rmtq || :
- ${csudo} rm -f ${bin_link_dir}/tarbitrator || :
- ${csudo} rm -f ${bin_link_dir}/set_core || :
- ${csudo} rm -f ${bin_link_dir}/run_taosd.sh || :
+ ${csudo}rm -f ${bin_link_dir}/tq || :
+ ${csudo}rm -f ${bin_link_dir}/tqd || :
+ ${csudo}rm -f ${bin_link_dir}/tqdemo || :
+ ${csudo}rm -f ${bin_link_dir}/tqdump || :
+ ${csudo}rm -f ${bin_link_dir}/rmtq || :
+ ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
+ ${csudo}rm -f ${bin_link_dir}/set_core || :
+ ${csudo}rm -f ${bin_link_dir}/run_taosd.sh || :
}
function clean_lib() {
# Remove link
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
- ${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
- #${csudo} rm -rf ${v15_java_app_dir} || :
+ ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
+ #${csudo}rm -rf ${v15_java_app_dir} || :
}
function clean_header() {
# Remove link
- ${csudo} rm -f ${inc_link_dir}/taos.h || :
- ${csudo} rm -f ${inc_link_dir}/taosdef.h || :
- ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+ ${csudo}rm -f ${inc_link_dir}/taos.h || :
+ ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
+ ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
}
function clean_config() {
# Remove link
- ${csudo} rm -f ${cfg_link_dir}/* || :
+ ${csudo}rm -f ${cfg_link_dir}/* || :
}
function clean_log() {
# Remove link
- ${csudo} rm -rf ${log_link_dir} || :
+ ${csudo}rm -rf ${log_link_dir} || :
}
function clean_service_on_systemd() {
tq_service_config="${service_config_dir}/${tq_service_name}.service"
if systemctl is-active --quiet ${tq_service_name}; then
echo "TQ tqd is running, stopping it..."
- ${csudo} systemctl stop ${tq_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tq_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tq_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tq_service_config}
+ ${csudo}systemctl disable ${tq_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tq_service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then
echo "TQ tarbitrator is running, stopping it..."
- ${csudo} systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${tarbitratord_service_config}
+ ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}rm -f ${tarbitratord_service_config}
if [ "$verMode" == "cluster" ]; then
nginx_service_config="${service_config_dir}/${nginx_service_name}.service"
if [ -d ${bin_dir}/web ]; then
if systemctl is-active --quiet ${nginx_service_name}; then
echo "Nginx for TQ is running, stopping it..."
- ${csudo} systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl stop ${nginx_service_name} &> /dev/null || echo &> /dev/null
fi
- ${csudo} systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
+ ${csudo}systemctl disable ${nginx_service_name} &> /dev/null || echo &> /dev/null
- ${csudo} rm -f ${nginx_service_config}
+ ${csudo}rm -f ${nginx_service_config}
fi
fi
}
function clean_service_on_sysvinit() {
#restart_config_str="tq:2345:respawn:${service_config_dir}/tqd start"
- #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+ #${csudo}sed -i "\|${restart_config_str}|d" /etc/inittab || :
if pidof tqd &> /dev/null; then
echo "TQ tqd is running, stopping it..."
- ${csudo} service tqd stop || :
+ ${csudo}service tqd stop || :
fi
if pidof tarbitrator &> /dev/null; then
echo "TQ tarbitrator is running, stopping it..."
- ${csudo} service tarbitratord stop || :
+ ${csudo}service tarbitratord stop || :
fi
if ((${initd_mod}==1)); then
if [ -e ${service_config_dir}/tqd ]; then
- ${csudo} chkconfig --del tqd || :
+ ${csudo}chkconfig --del tqd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} chkconfig --del tarbitratord || :
+ ${csudo}chkconfig --del tarbitratord || :
fi
elif ((${initd_mod}==2)); then
if [ -e ${service_config_dir}/tqd ]; then
- ${csudo} insserv -r tqd || :
+ ${csudo}insserv -r tqd || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} insserv -r tarbitratord || :
+ ${csudo}insserv -r tarbitratord || :
fi
elif ((${initd_mod}==3)); then
if [ -e ${service_config_dir}/tqd ]; then
- ${csudo} update-rc.d -f tqd remove || :
+ ${csudo}update-rc.d -f tqd remove || :
fi
if [ -e ${service_config_dir}/tarbitratord ]; then
- ${csudo} update-rc.d -f tarbitratord remove || :
+ ${csudo}update-rc.d -f tarbitratord remove || :
fi
fi
- ${csudo} rm -f ${service_config_dir}/tqd || :
- ${csudo} rm -f ${service_config_dir}/tarbitratord || :
+ ${csudo}rm -f ${service_config_dir}/tqd || :
+ ${csudo}rm -f ${service_config_dir}/tarbitratord || :
if $(which init &> /dev/null); then
- ${csudo} init q || :
+ ${csudo}init q || :
fi
}
@@ -203,10 +203,10 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
-${csudo} rm -rf ${data_link_dir} || :
+${csudo}rm -rf ${data_link_dir} || :
-${csudo} rm -rf ${install_main_dir}
-${csudo} rm -rf ${install_nginxd_dir}
+${csudo}rm -rf ${install_main_dir}
+${csudo}rm -rf ${install_nginxd_dir}
if [[ -e /etc/os-release ]]; then
osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
else
diff --git a/packaging/tools/set_core.sh b/packaging/tools/set_core.sh
index f515fd3dc5ed4a26fc7f4120573d39303ea3d751..db95aeb34346b161d979b074e0cb50c017e0bc6d 100755
--- a/packaging/tools/set_core.sh
+++ b/packaging/tools/set_core.sh
@@ -15,7 +15,7 @@ corePath=$1
csudo=""
if command -v sudo > /dev/null; then
- csudo="sudo"
+ csudo="sudo "
fi
if [[ ! -n ${corePath} ]]; then
@@ -31,10 +31,10 @@ if [[ ! -n ${corePath} ]]; then
fi
ulimit -c unlimited
-${csudo} sed -i '/ulimit -c unlimited/d' /etc/profile ||:
-${csudo} sed -i '$a\ulimit -c unlimited' /etc/profile ||:
+${csudo}sed -i '/ulimit -c unlimited/d' /etc/profile ||:
+${csudo}sed -i '$a\ulimit -c unlimited' /etc/profile ||:
source /etc/profile
-${csudo} mkdir -p ${corePath} ||:
-${csudo} sysctl -w kernel.core_pattern=${corePath}/core-%e-%p ||:
-${csudo} echo "${corePath}/core-%e-%p" | ${csudo} tee /proc/sys/kernel/core_pattern ||:
+${csudo}mkdir -p ${corePath} ||:
+${csudo}sysctl -w kernel.core_pattern=${corePath}/core-%e-%p ||:
+${csudo}echo "${corePath}/core-%e-%p" | ${csudo}tee /proc/sys/kernel/core_pattern ||:
diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h
index 10cfe8bcc5053fa9fe44982268d9e8843d071ce6..c5e3cb727f85dafd2b51efe741cd635394908cfd 100644
--- a/src/client/inc/tsclient.h
+++ b/src/client/inc/tsclient.h
@@ -440,7 +440,7 @@ int tsParseSql(SSqlObj *pSql, bool initial);
void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet);
int tscBuildAndSendRequest(SSqlObj *pSql, SQueryInfo* pQueryInfo);
-int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex);
+int tscRenewTableMeta(SSqlObj *pSql);
void tscAsyncResultOnError(SSqlObj *pSql);
void tscQueueAsyncError(void(*fp), void *param, int32_t code);
diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c
index 085b949cc102e3752abd41caacdf07985351e1db..0d43e101754e9ae3eb33440005790f238f6664a5 100644
--- a/src/client/src/tscParseLineProtocol.c
+++ b/src/client/src/tscParseLineProtocol.c
@@ -795,69 +795,69 @@ static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int nu
static int32_t applyChildTableDataPointsWithInsertSQL(TAOS* taos, char* cTableName, char* sTableName, SSmlSTableSchema* sTableSchema,
SArray* cTablePoints, size_t rowSize, SSmlLinesInfo* info) {
int32_t code = TSDB_CODE_SUCCESS;
- size_t numTags = taosArrayGetSize(sTableSchema->tags);
- size_t numCols = taosArrayGetSize(sTableSchema->fields);
- size_t rows = taosArrayGetSize(cTablePoints);
+ size_t numTags = taosArrayGetSize(sTableSchema->tags);
+ size_t numCols = taosArrayGetSize(sTableSchema->fields);
+ size_t rows = taosArrayGetSize(cTablePoints);
SArray* tagsSchema = sTableSchema->tags;
SArray* colsSchema = sTableSchema->fields;
TAOS_SML_KV* tagKVs[TSDB_MAX_TAGS] = {0};
- for (int i= 0; i < rows; ++i) {
- TAOS_SML_DATA_POINT * pDataPoint = taosArrayGetP(cTablePoints, i);
+ for (int i = 0; i < rows; ++i) {
+ TAOS_SML_DATA_POINT* pDataPoint = taosArrayGetP(cTablePoints, i);
for (int j = 0; j < pDataPoint->tagNum; ++j) {
TAOS_SML_KV* kv = pDataPoint->tags + j;
tagKVs[kv->fieldSchemaIdx] = kv;
}
}
- char* sql = malloc(tsMaxSQLStringLen+1);
+ char* sql = malloc(tsMaxSQLStringLen + 1);
if (sql == NULL) {
tscError("malloc sql memory error");
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
- int32_t freeBytes = tsMaxSQLStringLen + 1 ;
+ int32_t freeBytes = tsMaxSQLStringLen + 1;
int32_t totalLen = 0;
totalLen += sprintf(sql, "insert into %s using %s (", cTableName, sTableName);
for (int i = 0; i < numTags; ++i) {
SSchema* tagSchema = taosArrayGet(tagsSchema, i);
- totalLen += snprintf(sql+totalLen, freeBytes-totalLen, "%s,", tagSchema->name);
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, "%s,", tagSchema->name);
}
--totalLen;
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, ")");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, ")");
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, " tags (");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, " tags (");
-// for (int i = 0; i < numTags; ++i) {
-// snprintf(sql+strlen(sql), freeBytes-strlen(sql), "?,");
-// }
+ // for (int i = 0; i < numTags; ++i) {
+ // snprintf(sql+strlen(sql), freeBytes-strlen(sql), "?,");
+ // }
for (int i = 0; i < numTags; ++i) {
if (tagKVs[i] == NULL) {
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, "NULL,");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, "NULL,");
} else {
- TAOS_SML_KV* kv = tagKVs[i];
- size_t beforeLen = totalLen;
- int32_t len = 0;
- converToStr(sql+beforeLen, kv->type, kv->value, kv->length, &len);
+ TAOS_SML_KV* kv = tagKVs[i];
+ size_t beforeLen = totalLen;
+ int32_t len = 0;
+ converToStr(sql + beforeLen, kv->type, kv->value, kv->length, &len);
totalLen += len;
- totalLen += snprintf(sql+totalLen, freeBytes-totalLen, ",");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, ",");
}
}
--totalLen;
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, ") (");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, ") (");
for (int i = 0; i < numCols; ++i) {
SSchema* colSchema = taosArrayGet(colsSchema, i);
- totalLen += snprintf(sql+totalLen, freeBytes-totalLen, "%s,", colSchema->name);
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, "%s,", colSchema->name);
}
--totalLen;
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, ") values ");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, ") values ");
- TAOS_SML_KV** colKVs = malloc(numCols*sizeof(TAOS_SML_KV*));
+ TAOS_SML_KV** colKVs = malloc(numCols * sizeof(TAOS_SML_KV*));
for (int r = 0; r < rows; ++r) {
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, "(");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, "(");
- memset(colKVs, 0, numCols*sizeof(TAOS_SML_KV*));
+ memset(colKVs, 0, numCols * sizeof(TAOS_SML_KV*));
TAOS_SML_DATA_POINT* point = taosArrayGetP(cTablePoints, r);
for (int i = 0; i < point->fieldNum; ++i) {
@@ -867,28 +867,68 @@ static int32_t applyChildTableDataPointsWithInsertSQL(TAOS* taos, char* cTableNa
for (int i = 0; i < numCols; ++i) {
if (colKVs[i] == NULL) {
- totalLen += snprintf(sql + totalLen, freeBytes-totalLen, "NULL,");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, "NULL,");
} else {
- TAOS_SML_KV* kv = colKVs[i];
- size_t beforeLen = totalLen;
- int32_t len = 0;
- converToStr(sql+beforeLen, kv->type, kv->value, kv->length, &len);
+ TAOS_SML_KV* kv = colKVs[i];
+ size_t beforeLen = totalLen;
+ int32_t len = 0;
+ converToStr(sql + beforeLen, kv->type, kv->value, kv->length, &len);
totalLen += len;
- totalLen += snprintf(sql+totalLen, freeBytes-totalLen, ",");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, ",");
}
}
--totalLen;
- totalLen += snprintf(sql+totalLen, freeBytes - totalLen, ")");
+ totalLen += snprintf(sql + totalLen, freeBytes - totalLen, ")");
}
free(colKVs);
sql[totalLen] = '\0';
- tscDebug("SML:0x%"PRIx64" insert child table table %s of super table %s sql: %s", info->id, cTableName, sTableName, sql);
- TAOS_RES* res = taos_query(taos, sql);
+ tscDebug("SML:0x%" PRIx64 " insert child table table %s of super table %s sql: %s", info->id, cTableName, sTableName,
+ sql);
+
+ bool tryAgain = false;
+ int32_t try = 0;
+ do {
+ TAOS_RES* res = taos_query(taos, sql);
+ code = taos_errno(res);
+ if (code != 0) {
+ tscError("SML:0x%"PRIx64 " taos_query return %d:%s", info->id, code, taos_errstr(res));
+ }
+
+ tscDebug("SML:0x%"PRIx64 " taos_query inserted %d rows", info->id, taos_affected_rows(res));
+ info->affectedRows += taos_affected_rows(res);
+ taos_free_result(res);
+
+ tryAgain = false;
+ if ((code == TSDB_CODE_TDB_INVALID_TABLE_ID
+ || code == TSDB_CODE_VND_INVALID_VGROUP_ID
+ || code == TSDB_CODE_TDB_TABLE_RECONFIGURE
+ || code == TSDB_CODE_APP_NOT_READY
+ || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) && try++ < TSDB_MAX_REPLICA) {
+ tryAgain = true;
+ }
+
+ if (code == TSDB_CODE_TDB_INVALID_TABLE_ID || code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
+ TAOS_RES* res2 = taos_query(taos, "RESET QUERY CACHE");
+ int32_t code2 = taos_errno(res2);
+ if (code2 != TSDB_CODE_SUCCESS) {
+ tscError("SML:0x%" PRIx64 " insert child table by sql. reset query cache. error: %s", info->id, taos_errstr(res2));
+ }
+ taos_free_result(res2);
+ if (tryAgain) {
+ taosMsleep(100 * (2 << try));
+ }
+ }
+
+ if (code == TSDB_CODE_APP_NOT_READY || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
+ if (tryAgain) {
+ taosMsleep( 100 * (2 << try));
+ }
+ }
+ } while (tryAgain);
+
free(sql);
- code = taos_errno(res);
- info->affectedRows += taos_affected_rows(res);
- taos_free_result(res);
+
return code;
}
diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c
index 8d1a79e734cabf6694daf30d8887265488bcf630..ea0a3124b234d24db1411c4453ce7bd9d3e73e2d 100644
--- a/src/client/src/tscPrepare.c
+++ b/src/client/src/tscPrepare.c
@@ -1705,7 +1705,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
SSqlObj* pSql = pStmt->pSql;
SSqlCmd* pCmd = &pSql->cmd;
- uint32_t nameLen = (uint32_t)strlen(name);
+ int32_t nameLen = (int32_t)strlen(name);
if (name == NULL || nameLen <= 0) {
tscError("0x%"PRIx64" tbname is NULL", pSql->self);
@@ -1727,18 +1727,22 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
SStrToken tname = {0};
tname.type = TK_STRING;
tname.z = (char *)strdup(name);
- tname.n = (uint32_t)strlen(name);
+ if (!tname.z) {
+ tscError("0x%" PRIx64 " out of memory", pSql->self);
+ STMT_RET(TSDB_CODE_TSC_OUT_OF_MEMORY);
+ }
+ tname.n = (uint32_t)strlen(tname.z);
bool dbIncluded = false;
// Check if the table name available or not
if (tscValidateName(&tname, true, &dbIncluded) != TSDB_CODE_SUCCESS) {
- tscError("0x%"PRIx64" tbname[%s] is invalid", pSql->self, name);
+ tscError("0x%" PRIx64 " tbname[%s] is invalid", pSql->self, tname.z);
free(tname.z);
STMT_RET(invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "name is invalid"));
}
- uint64_t* uid = (uint64_t*)taosHashGet(pStmt->mtb.pTableHash, name, strlen(name));
+ uint64_t* uid = (uint64_t*)taosHashGet(pStmt->mtb.pTableHash, tname.z, tname.n);
if (uid != NULL) {
pStmt->mtb.currentUid = *uid;
@@ -1752,6 +1756,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
if ((*t1)->pData == NULL) {
code = tscCreateDataBlockData(*t1, TSDB_PAYLOAD_SIZE, (*t1)->pTableMeta->tableInfo.rowSize, sizeof(SSubmitBlk));
if (code != TSDB_CODE_SUCCESS) {
+ free(tname.z);
STMT_RET(code);
}
}
@@ -1766,7 +1771,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
taosHashPut(pCmd->insertParam.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)t1, POINTER_BYTES);
- tscDebug("0x%"PRIx64" table:%s is already prepared, uid:%" PRIu64, pSql->self, name, pStmt->mtb.currentUid);
+ tscDebug("0x%" PRIx64 " table:%s is already prepared, uid:%" PRIu64, pSql->self, tname.z, pStmt->mtb.currentUid);
free(tname.z);
STMT_RET(TSDB_CODE_SUCCESS);
}
@@ -1779,18 +1784,19 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
SName fullname = {0};
tscSetTableFullName(&fullname, &tname, pSql, dbIncluded);
- free(tname.z);
memcpy(&pTableMetaInfo->name, &fullname, sizeof(fullname));
code = tscGetTableMetaEx(pSql, pTableMetaInfo, false, true);
if (code != TSDB_CODE_SUCCESS) {
+ free(tname.z);
STMT_RET(code);
}
pTableMeta = pTableMetaInfo->pTableMeta;
if (strcmp(sTableName, pTableMeta->sTableName)) {
+ free(tname.z);
tscError("0x%"PRIx64" only tables belongs to one stable is allowed", pSql->self);
STMT_RET(TSDB_CODE_TSC_APP_ERROR);
}
@@ -1806,25 +1812,26 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
taosHashPut(pCmd->insertParam.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)&pBlock, POINTER_BYTES);
taosHashPut(pStmt->mtb.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)&pBlock, POINTER_BYTES);
- taosHashPut(pStmt->mtb.pTableHash, name, strlen(name), (char*) &pTableMeta->id.uid, sizeof(pTableMeta->id.uid));
+ taosHashPut(pStmt->mtb.pTableHash, tname.z, tname.n, (char*)&pTableMeta->id.uid, sizeof(pTableMeta->id.uid));
- tscDebug("0x%"PRIx64" table:%s is prepared, uid:%" PRIx64, pSql->self, name, pStmt->mtb.currentUid);
+ tscDebug("0x%" PRIx64 " table:%s is prepared, uid:%" PRIx64, pSql->self, tname.z, pStmt->mtb.currentUid);
+ free(tname.z);
STMT_RET(TSDB_CODE_SUCCESS);
}
- free(tname.z);
-
if (pStmt->mtb.tagSet) {
- pStmt->mtb.tbname = tscReplaceStrToken(&pSql->sqlstr, &pStmt->mtb.tbname, name);
+ pStmt->mtb.tbname = tscReplaceStrToken(&pSql->sqlstr, &pStmt->mtb.tbname, tname.z);
} else {
if (tags == NULL) {
tscError("No tags set");
+ free(tname.z);
STMT_RET(invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "no tags set"));
}
- int32_t ret = stmtGenInsertStatement(pSql, pStmt, name, tags);
+ int32_t ret = stmtGenInsertStatement(pSql, pStmt, tname.z, tags);
if (ret != TSDB_CODE_SUCCESS) {
+ free(tname.z);
STMT_RET(ret);
}
}
@@ -1859,6 +1866,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
code = tscGetDataBlockFromList(pCmd->insertParam.pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, sizeof(SSubmitBlk),
pTableMeta->tableInfo.rowSize, &pTableMetaInfo->name, pTableMeta, &pBlock, NULL);
if (code != TSDB_CODE_SUCCESS) {
+ free(tname.z);
STMT_RET(code);
}
@@ -1869,15 +1877,16 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
pStmt->mtb.tbNum++;
taosHashPut(pStmt->mtb.pTableBlockHashList, (void *)&pStmt->mtb.currentUid, sizeof(pStmt->mtb.currentUid), (void*)&pBlock, POINTER_BYTES);
- taosHashPut(pStmt->mtb.pTableHash, name, strlen(name), (char*) &pTableMeta->id.uid, sizeof(pTableMeta->id.uid));
+ taosHashPut(pStmt->mtb.pTableHash, tname.z, tname.n, (char*)&pTableMeta->id.uid, sizeof(pTableMeta->id.uid));
if (pStmt->mtb.lastBlock == NULL) {
insertStmtGenLastBlock(&pStmt->mtb.lastBlock, pBlock);
}
- tscDebug("0x%"PRIx64" table:%s is prepared, uid:%" PRIx64, pSql->self, name, pStmt->mtb.currentUid);
+ tscDebug("0x%" PRIx64 " table:%s is prepared, uid:%" PRIx64, pSql->self, tname.z, pStmt->mtb.currentUid);
}
+ free(tname.z);
STMT_RET(code);
}
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index 1828cda348d0140cce35a648e3e86d05d61c7442..3032b27b9cab6005d9cde120ede7fde831df181f 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -191,7 +191,7 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType,
}
if (colType == TSDB_DATA_TYPE_BOOL && (var->i64 > 1 ||var->i64 < 0)) {
break;
- }
+ }
tbufWriteInt64(&bw, var->i64);
} else if (IS_UNSIGNED_NUMERIC_TYPE(colType)) {
if (IS_SIGNED_NUMERIC_TYPE(var->nType) || IS_UNSIGNED_NUMERIC_TYPE(var->nType)) {
@@ -603,11 +603,11 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
-
+
if (pInfo->type != TSDB_SQL_DROP_DNODE) {
if ((escapeEnabled && (validateTableName(pzName->z, pzName->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS)) ||
((!escapeEnabled) && (tscValidateName(pzName, escapeEnabled, &dbIncluded) != TSDB_CODE_SUCCESS))){
- return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
+ return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
}
@@ -623,7 +623,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
code = tscSetTableFullName(&pTableMetaInfo->name, &sTblToken, pSql, dbIncluded);
if(code != TSDB_CODE_SUCCESS) {
- return code;
+ return code;
}
} else if (pInfo->type == TSDB_SQL_DROP_DNODE) {
if (pzName->type == TK_STRING) {
@@ -765,7 +765,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
-
+
if (validateTableName(pToken->z, pToken->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
@@ -788,7 +788,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
-
+
if (validateTableName(pToken->z, pToken->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
@@ -804,7 +804,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg1 = "invalid database name";
SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0);
-
+
if (tscValidateName(pToken, false, NULL) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
@@ -2175,16 +2175,16 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
pQueryInfo->colList = taosArrayInit(4, POINTER_BYTES);
}
-
+
bool hasDistinct = false;
- bool hasAgg = false;
+ bool hasAgg = false;
size_t numOfExpr = taosArrayGetSize(pSelNodeList);
- int32_t distIdx = -1;
+ int32_t distIdx = -1;
for (int32_t i = 0; i < numOfExpr; ++i) {
int32_t outputIndex = (int32_t)tscNumOfExprs(pQueryInfo);
tSqlExprItem* pItem = taosArrayGet(pSelNodeList, i);
if (hasDistinct == false) {
- hasDistinct = (pItem->distinct == true);
+ hasDistinct = (pItem->distinct == true);
distIdx = hasDistinct ? i : -1;
}
if(pItem->aliasName != NULL && validateColumnName(pItem->aliasName) != TSDB_CODE_SUCCESS){
@@ -2202,7 +2202,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
return code;
}
} else if (type == SQL_NODE_SQLFUNCTION) {
- hasAgg = true;
+ hasAgg = true;
if (hasDistinct) break;
pItem->pNode->functionId = isValidFunction(pItem->pNode->Expr.operand.z, pItem->pNode->Expr.operand.n);
@@ -2252,12 +2252,12 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
}
}
- //TODO(dengyihao), refactor as function
- //handle distinct func mixed with other func
+ //TODO(dengyihao), refactor as function
+ //handle distinct func mixed with other func
if (hasDistinct == true) {
if (distIdx != 0 || hasAgg) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
- }
+ }
if (joinQuery) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
}
@@ -2267,11 +2267,11 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
if (pQueryInfo->pDownstream != NULL) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8);
}
-
+
pQueryInfo->distinct = true;
}
-
-
+
+
// there is only one user-defined column in the final result field, add the timestamp column.
size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList);
if ((numOfSrcCols <= 0 || !hasNoneUserDefineExpr(pQueryInfo)) && !tscQueryTags(pQueryInfo) && !tscQueryBlockInfo(pQueryInfo)) {
@@ -2490,6 +2490,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
/*SExprInfo* pExpr = */ tscAddFuncInSelectClause(pQueryInfo, startPos, TSDB_FUNC_TAGPRJ, &index, &colSchema,
TSDB_COL_TAG, getNewResColId(pCmd));
}
+ pQueryInfo->type |= TSDB_QUERY_TYPE_PROJECTION_QUERY;
} else {
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex);
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
@@ -2759,7 +2760,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if (pItem->pNode->Expr.paramList == NULL ||
(functionId != TSDB_FUNC_LEASTSQR && functionId != TSDB_FUNC_DERIVATIVE && functionId != TSDB_FUNC_ELAPSED && numOfParams != 1) ||
((functionId == TSDB_FUNC_LEASTSQR || functionId == TSDB_FUNC_DERIVATIVE) && numOfParams != 3) ||
- (functionId == TSDB_FUNC_ELAPSED && numOfParams > 2)) {
+ (functionId == TSDB_FUNC_ELAPSED && numOfParams != 1 && numOfParams != 2)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
@@ -4693,7 +4694,12 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr,
if (pExpr->value.nType == (uint32_t)-1) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
-
+
+ //now allowing now +/- value in select expr
+ if (pExpr->tokenId == TK_TIMESTAMP) {
+ return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
+ }
+
if (pExpr->type == SQL_NODE_VALUE) {
*type = SQLEXPR_TYPE_VALUE;
}
@@ -6277,7 +6283,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
const char* msg0 = "only one column allowed in orderby";
const char* msg1 = "invalid column name in orderby clause";
const char* msg2 = "too many order by columns";
- const char* msg3 = "only primary timestamp/column in groupby clause allowed as order column";
+ const char* msg3 = "only primary timestamp, first tag/tbname in groupby clause allowed as order column";
const char* msg4 = "only tag in groupby clause allowed in order clause";
const char* msg5 = "only primary timestamp/column in top/bottom function allowed as order column";
const char* msg6 = "only primary timestamp allowed as the second order column";
@@ -9502,7 +9508,7 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
char buf[TSDB_TABLE_FNAME_LEN];
SStrToken sTblToken;
sTblToken.z = buf;
-
+
if (validateTableName(oriName->z, oriName->n, &sTblToken, &dbIncluded) != TSDB_CODE_SUCCESS) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c
index 35582973c2af7b214d3054807d31a897c7256191..4879576bc447b0f483a641b749dbc4b9fc5218e2 100644
--- a/src/client/src/tscServer.c
+++ b/src/client/src/tscServer.c
@@ -444,7 +444,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
}
pSql->retryReason = rpcMsg->code;
- rpcMsg->code = tscRenewTableMeta(pSql, 0);
+ rpcMsg->code = tscRenewTableMeta(pSql);
// if there is an error occurring, proceed to the following error handling procedure.
if (rpcMsg->code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
taosReleaseRef(tscObjRef, handle);
@@ -3074,28 +3074,46 @@ static void freeElem(void* p) {
/**
* retrieve table meta from mnode, and then update the local table meta hashmap.
* @param pSql sql object
- * @param tableIndex table index
* @return status code
*/
-int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
+int tscRenewTableMeta(SSqlObj *pSql) {
+ int32_t code = TSDB_CODE_SUCCESS;
SSqlCmd* pCmd = &pSql->cmd;
SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd);
- STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, tableIndex);
- char name[TSDB_TABLE_FNAME_LEN] = {0};
- int32_t code = tNameExtractFullName(&pTableMetaInfo->name, name);
- if (code != TSDB_CODE_SUCCESS) {
- tscError("0x%"PRIx64" failed to generate the table full name", pSql->self);
- return TSDB_CODE_TSC_INVALID_OPERATION;
- }
+ SArray* pNameList = taosArrayInit(1, POINTER_BYTES);
+ SArray* vgroupList = taosArrayInit(1, POINTER_BYTES);
- STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
- if (pTableMeta) {
- tscDebug("0x%"PRIx64" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%" PRIu64, pSql->self, name,
- tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid);
+ SHashObj *nameTable = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
+
+ while (pQueryInfo) {
+ STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
+
+ char name[TSDB_TABLE_FNAME_LEN] = {0};
+ code = tNameExtractFullName(&pTableMetaInfo->name, name);
+ if (code != TSDB_CODE_SUCCESS) {
+ tscError("0x%"PRIx64" failed to generate the table full name", pSql->self);
+ return TSDB_CODE_TSC_INVALID_OPERATION;
+ }
+
+ //do not add duplicate names
+ if (!taosHashGet(nameTable, name, strlen(name))) {
+ STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
+ if (pTableMeta) {
+ tscDebug("0x%"PRIx64" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%" PRIu64, pSql->self, name,
+ tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid);
+ }
+
+ char* n = strdup(name);
+ taosArrayPush(pNameList, &n);
+ uint8_t dummy_val = 0;
+ taosHashPut(nameTable, name, strlen(name), &dummy_val, sizeof(uint8_t));
+ }
+ pQueryInfo = pQueryInfo->sibling;
}
+ taosHashCleanup(nameTable);
// remove stored tableMeta info in hash table
tscResetSqlCmd(pCmd, true, pSql->self);
@@ -3103,18 +3121,13 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
SSqlCmd* pCmd2 = &pSql->rootObj->cmd;
pCmd2->pTableMetaMap = tscCleanupTableMetaMap(pCmd2->pTableMetaMap);
pCmd2->pTableMetaMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
-
+
pSql->rootObj->retryReason = pSql->retryReason;
SSqlObj *tmpSql = pSql->rootObj;
tscFreeSubobj(pSql->rootObj);
tfree(tmpSql->pSubs);
- SArray* pNameList = taosArrayInit(1, POINTER_BYTES);
- SArray* vgroupList = taosArrayInit(1, POINTER_BYTES);
-
- char* n = strdup(name);
- taosArrayPush(pNameList, &n);
code = getMultiTableMetaFromMnode(tmpSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true);
taosArrayDestroyEx(pNameList, freeElem);
taosArrayDestroyEx(vgroupList, freeElem);
diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c
index 5f8964bb34b5939ab768877cb8ae701e20443f75..bcec2ffc57ba46aea9ffd222aa3bf3d3415ab0de 100644
--- a/src/client/src/tscSubquery.c
+++ b/src/client/src/tscSubquery.c
@@ -3783,7 +3783,7 @@ void tscSetQuerySort(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr) {
size_t size = taosArrayGetSize(pQueryInfo->pUpstream);
for(int32_t i = 0; i < size; ++i) {
SQueryInfo* pq = taosArrayGetP(pQueryInfo->pUpstream, i);
- if (pq->groupbyTag && pq->interval.interval > 0) {
+ if (pq->groupbyTag) {
pQueryAttr->needSort = true;
return;
}
diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c
index bbd448e2d8b5069fae438d7adb9de14a31446d1b..7041c922d9b8ff32d6c1340fe313769cf4cf9729 100644
--- a/src/client/src/tscSystem.c
+++ b/src/client/src/tscSystem.c
@@ -113,7 +113,7 @@ int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncry
SRpcObj rpcObj;
memset(&rpcObj, 0, sizeof(rpcObj));
- strncpy(rpcObj.key, key, strlen(key));
+ tstrncpy(rpcObj.key, key, sizeof(rpcObj.key));
rpcObj.pDnodeConn = rpcOpen(&rpcInit);
if (rpcObj.pDnodeConn == NULL) {
pthread_mutex_unlock(&rpcObjMutex);
diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c
index e2263f696a885e885091e86c6b1210bc817996c2..555a67fa270558496c8427198e72cdf8757cc4e8 100644
--- a/src/client/src/tscUtil.c
+++ b/src/client/src/tscUtil.c
@@ -132,8 +132,7 @@ int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *le
return TSDB_CODE_SUCCESS;
}
-
-static void tscStrToLower(char *str, int32_t n) {
+UNUSED_FUNC static void tscStrToLower(char* str, int32_t n) {
if (str == NULL || n <= 0) { return;}
for (int32_t i = 0; i < n; i++) {
if (str[i] >= 'A' && str[i] <= 'Z') {
@@ -3029,7 +3028,8 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
if (pToken->type == TK_STRING) {
tscDequoteAndTrimToken(pToken);
- tscStrToLower(pToken->z, pToken->n);
+ // tscStrToLower(pToken->z, pToken->n);
+ strntolower(pToken->z, pToken->z, pToken->n);
//pToken->n = (uint32_t)strtrim(pToken->z);
int len = tGetToken(pToken->z, &pToken->type);
@@ -3083,7 +3083,8 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
if (validateQuoteToken(pToken, escapeEnabled, NULL) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION;
} else {
- tscStrToLower(pToken->z,pToken->n);
+ // tscStrToLower(pToken->z,pToken->n);
+ strntolower(pToken->z, pToken->z, pToken->n);
firstPartQuote = true;
}
}
@@ -3101,7 +3102,8 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
if (validateQuoteToken(pToken, escapeEnabled, NULL) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION;
} else {
- tscStrToLower(pToken->z,pToken->n);
+ // tscStrToLower(pToken->z,pToken->n);
+ strntolower(pToken->z, pToken->z, pToken->n);
}
}
@@ -4928,7 +4930,11 @@ int32_t createProjectionExpr(SQueryInfo* pQueryInfo, STableMetaInfo* pTableMetaI
}
}
- pse->colInfo.flag = pSource->base.colInfo.flag; //TSDB_COL_NORMAL;
+ if (!pQueryInfo->stableQuery && TSDB_COL_IS_TAG(pSource->base.colInfo.flag)) {
+ pse->colInfo.flag = (pSource->base.colInfo.flag) & (~TSDB_COL_TAG);
+ } else {
+ pse->colInfo.flag = pSource->base.colInfo.flag;
+ }
pse->resType = pSource->base.resType;
pse->resBytes = pSource->base.resBytes;
strncpy(pse->colInfo.name, pSource->base.aliasName, tListLen(pse->colInfo.name));
@@ -5518,6 +5524,11 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
varDataSetLen(tagData, outLen);
tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_NCHAR, tagVal, true);
}else if(item->type == cJSON_Number){
+ if(!isfinite(item->valuedouble)){
+ tscError("json value is invalidate");
+ retCode = tscSQLSyntaxErrMsg(errMsg, "json value number is illegal", NULL);
+ goto end;
+ }
char tagVal[LONG_BYTES + CHAR_BYTES] = {0};
*tagVal = jsonType2DbType(item->valuedouble, item->type); // type
char* tagData = POINTER_SHIFT(tagVal,CHAR_BYTES);
@@ -5558,7 +5569,7 @@ end:
int8_t jsonType2DbType(double data, int jsonType){
switch(jsonType){
case cJSON_Number:
- if (data - (int64_t)data > 0) return TSDB_DATA_TYPE_DOUBLE; else return TSDB_DATA_TYPE_BIGINT;
+ if (data - (int64_t)data == 0) return TSDB_DATA_TYPE_BIGINT; else return TSDB_DATA_TYPE_DOUBLE;
case cJSON_String:
return TSDB_DATA_TYPE_NCHAR;
case cJSON_NULL:
diff --git a/src/common/inc/tvariant.h b/src/common/inc/tvariant.h
index 31bc7a247ad9851aa48d99a3c6eec31e90313972..23fd601090bc24606e22b7bc99f7fbf52bd4ac34 100644
--- a/src/common/inc/tvariant.h
+++ b/src/common/inc/tvariant.h
@@ -39,7 +39,9 @@ typedef struct tVariant {
bool tVariantIsValid(tVariant *pVar);
-void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape);
+void tVariantCreate(tVariant *pVar, SStrToken *token);
+
+void tVariantCreateExt(tVariant *pVar, SStrToken *token, int32_t optrType, bool needRmquoteEscape);
void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32_t type);
diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c
index 68ed5c5c109cdfacb5ffac50e4f424ec431b78a0..33b93cfde482e67667e463b13a95be33db785462 100644
--- a/src/common/src/tvariant.c
+++ b/src/common/src/tvariant.c
@@ -16,6 +16,7 @@
#include "hash.h"
#include "taos.h"
+#include "taoserror.h"
#include "taosdef.h"
#include "ttoken.h"
#include "ttokendef.h"
@@ -30,7 +31,11 @@
assert(0); \
} while (0)
-void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) {
+void tVariantCreate(tVariant *pVar, SStrToken *token) {
+ tVariantCreateExt(pVar, token, TK_ID, true);
+}
+
+void tVariantCreateExt(tVariant *pVar, SStrToken *token, int32_t optrType, bool needRmquoteEscape) {
int32_t ret = 0;
int32_t type = token->type;
@@ -54,7 +59,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) {
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_INT:{
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true);
- if (ret != 0) {
+ if (ret != TSDB_CODE_SUCCESS) {
SStrToken t = {0};
tGetToken(token->z, &t.type);
if (t.type == TK_MINUS) { // it is a signed number which is greater than INT64_MAX or less than INT64_MIN
@@ -64,7 +69,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) {
// data overflow, try unsigned parse the input number
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, false);
- if (ret != 0) {
+ if (ret != TSDB_CODE_SUCCESS) {
pVar->nType = -1; // -1 means error type
return;
}
@@ -85,15 +90,29 @@ void tVariantCreate(tVariant *pVar, SStrToken *token, bool needRmquoteEscape) {
break;
}
case TSDB_DATA_TYPE_TIMESTAMP: {
- pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO);
- break;
- }
-
+ if (optrType == TK_NOW) {
+ pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO);
+ } else if (optrType == TK_PLUS || optrType == TK_MINUS) {
+ char unit = 0;
+ ret = parseAbsoluteDuration(token->z, token->n, &pVar->i64, &unit, TSDB_TIME_PRECISION_NANO);
+ if (ret != TSDB_CODE_SUCCESS) {
+ pVar->nType = -1; // -1 means error type
+ return;
+ }
+ if (optrType == TK_PLUS) {
+ pVar->i64 += taosGetTimestamp(TSDB_TIME_PRECISION_NANO);
+ } else {
+ pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO) - pVar->i64;
+ }
+ }
+ break;
+ }
+
default: { // nType == 0 means the null value
type = TSDB_DATA_TYPE_NULL;
}
}
-
+
pVar->nType = type;
}
@@ -164,7 +183,7 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
pVar->wpz = calloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE);
memcpy(pVar->wpz, pz, lenInwchar * TSDB_NCHAR_SIZE);
pVar->nLen = (int32_t)len;
-
+
break;
}
case TSDB_DATA_TYPE_JSON:{
@@ -179,18 +198,18 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
pVar->nLen = (int32_t)len;
break;
}
-
+
default:
pVar->i64 = GET_INT32_VAL(pz);
pVar->nLen = tDataTypes[TSDB_DATA_TYPE_INT].bytes;
}
-
+
pVar->nType = type;
}
void tVariantDestroy(tVariant *pVar) {
if (pVar == NULL) return;
-
+
if (pVar->nType == TSDB_DATA_TYPE_BINARY || pVar->nType == TSDB_DATA_TYPE_NCHAR || pVar->nType == TSDB_DATA_TYPE_JSON) {
tfree(pVar->pz);
pVar->nLen = 0;
@@ -248,7 +267,7 @@ bool tVariantTypeMatch(tVariant *pVar, int8_t dbType){
void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
if (pSrc == NULL || pDst == NULL) return;
-
+
pDst->nType = pSrc->nType;
if (pSrc->nType == TSDB_DATA_TYPE_BINARY || pSrc->nType == TSDB_DATA_TYPE_NCHAR || pSrc->nType == TSDB_DATA_TYPE_JSON) {
int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE;
@@ -332,14 +351,14 @@ int32_t tVariantCompare(const tVariant* p1, const tVariant* p2) {
int32_t tVariantToString(tVariant *pVar, char *dst) {
if (pVar == NULL || dst == NULL) return 0;
-
+
switch (pVar->nType) {
case TSDB_DATA_TYPE_BINARY: {
int32_t len = sprintf(dst, "\'%s\'", pVar->pz);
assert(len <= pVar->nLen + sizeof("\'") * 2); // two more chars
return len;
}
-
+
case TSDB_DATA_TYPE_NCHAR: {
dst[0] = '\'';
taosUcs4ToMbs(pVar->wpz, (twcslen(pVar->wpz) + 1) * TSDB_NCHAR_SIZE, dst + 1);
@@ -348,7 +367,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
dst[len + 1] = 0;
return len + 1;
}
-
+
case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_SMALLINT:
@@ -357,7 +376,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
case TSDB_DATA_TYPE_USMALLINT:
case TSDB_DATA_TYPE_UINT:
return sprintf(dst, "%d", (int32_t)pVar->i64);
-
+
case TSDB_DATA_TYPE_BIGINT:
return sprintf(dst, "%" PRId64, pVar->i64);
case TSDB_DATA_TYPE_UBIGINT:
@@ -365,7 +384,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
case TSDB_DATA_TYPE_FLOAT:
case TSDB_DATA_TYPE_DOUBLE:
return sprintf(dst, "%.9lf", pVar->dKey);
-
+
default:
return 0;
}
@@ -403,21 +422,21 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
if (*pDest == pVariant->pz) {
pBuf = calloc(1, INITIAL_ALLOC_SIZE);
}
-
+
if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) {
size_t newSize = pVariant->nLen * TSDB_NCHAR_SIZE;
if (pBuf != NULL) {
if (newSize >= INITIAL_ALLOC_SIZE) {
pBuf = realloc(pBuf, newSize + 1);
}
-
+
taosUcs4ToMbs(pVariant->wpz, (int32_t)newSize, pBuf);
free(pVariant->wpz);
pBuf[newSize] = 0;
} else {
taosUcs4ToMbs(pVariant->wpz, (int32_t)newSize, *pDest);
}
-
+
} else {
if (IS_SIGNED_NUMERIC_TYPE(pVariant->nType)) {
sprintf(pBuf == NULL ? *pDest : pBuf, "%" PRId64, pVariant->i64);
@@ -429,18 +448,18 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
setNull(pBuf == NULL ? *pDest : pBuf, TSDB_DATA_TYPE_BINARY, 0);
}
}
-
+
if (pBuf != NULL) {
*pDest = pBuf;
}
-
+
*pDestSize = (int32_t)strlen(*pDest);
return 0;
}
static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
char tmpBuf[40] = {0};
-
+
char * pDst = tmpBuf;
int32_t nLen = 0;
@@ -778,7 +797,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
if (converted) {
*converted = true;
}
-
+
if (value > FLT_MAX || value < -FLT_MAX) {
SET_EXT_INFO(converted, value, -FLT_MAX, FLT_MAX, extInfo);
return -1;
@@ -789,8 +808,8 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
if (converted) {
*converted = true;
}
-
- if (pVariant->i64 > FLT_MAX || pVariant->i64 < -FLT_MAX) {
+
+ if (pVariant->i64 > FLT_MAX || pVariant->i64 < -FLT_MAX) {
SET_EXT_INFO(converted, pVariant->i64, -FLT_MAX, FLT_MAX, extInfo);
return -1;
}
@@ -800,12 +819,12 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
if (converted) {
*converted = true;
}
-
- if (pVariant->dKey > FLT_MAX || pVariant->dKey < -FLT_MAX) {
+
+ if (pVariant->dKey > FLT_MAX || pVariant->dKey < -FLT_MAX) {
SET_EXT_INFO(converted, pVariant->dKey, -FLT_MAX, FLT_MAX, extInfo);
return -1;
}
-
+
SET_FLOAT_VAL(payload, pVariant->dKey);
} else if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
*((uint32_t *)payload) = TSDB_DATA_FLOAT_NULL;
@@ -850,7 +869,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
break;
}
-
+
case TSDB_DATA_TYPE_BINARY:{
if (!includeLengthPrefix) {
if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
@@ -921,7 +940,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
assert(p == varDataVal(payload));
}
}
-
+
break;
}
case TSDB_DATA_TYPE_JSON:{
@@ -935,7 +954,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
break;
}
}
-
+
return 0;
}
@@ -950,13 +969,13 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
if (pVariant == NULL || pVariant->nType == 0) { // value is not set
return 0;
}
-
+
switch (type) {
case TSDB_DATA_TYPE_BOOL: { // bool
if (convertToBool(pVariant, &pVariant->i64) < 0) {
return -1;
}
-
+
pVariant->nType = type;
break;
}
@@ -977,7 +996,7 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
free(pVariant->pz);
return -1;
}
-
+
free(pVariant->pz);
pVariant->dKey = v;
} else if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) {
@@ -987,14 +1006,14 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
free(pVariant->pz);
return -1;
}
-
+
free(pVariant->pz);
pVariant->dKey = v;
} else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) {
double tmp = (double) pVariant->i64;
pVariant->dKey = tmp;
}
-
+
pVariant->nType = TSDB_DATA_TYPE_DOUBLE;
break;
}
@@ -1015,6 +1034,6 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
break;
}
}
-
+
return 0;
}
diff --git a/src/connector/C#/src/test/Cases/Utils.cs b/src/connector/C#/src/test/Cases/Utils.cs
index 26414c91f9e6b65f58b0405786ced54fa4b61bcd..5a2962564fb9063e8994e549f0135cedb36b6ec5 100644
--- a/src/connector/C#/src/test/Cases/Utils.cs
+++ b/src/connector/C#/src/test/Cases/Utils.cs
@@ -163,4 +163,4 @@ namespace Test.UtilsTools
System.Environment.Exit(0);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/connector/go b/src/connector/go
index 25f8683ece07897fea12c347d369602b2235665f..7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4 160000
--- a/src/connector/go
+++ b/src/connector/go
@@ -1 +1 @@
-Subproject commit 25f8683ece07897fea12c347d369602b2235665f
+Subproject commit 7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4
diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
index d4c30115f851aa0f8b6f80994bbece609649428d..78420083a1d235036203bb3d57b2617663032d8d 100644
--- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
+++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
@@ -14,13 +14,43 @@ import java.math.BigDecimal;
import java.sql.*;
import java.time.Instant;
import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.chrono.IsoChronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
+import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoField;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class RestfulResultSet extends AbstractResultSet implements ResultSet {
+ public static DateTimeFormatter rfc3339Parser = null;
+
+ {
+ rfc3339Parser = new DateTimeFormatterBuilder()
+ .parseCaseInsensitive()
+ .appendValue(ChronoField.YEAR, 4)
+ .appendLiteral('-')
+ .appendValue(ChronoField.MONTH_OF_YEAR, 2)
+ .appendLiteral('-')
+ .appendValue(ChronoField.DAY_OF_MONTH, 2)
+ .appendLiteral('T')
+ .appendValue(ChronoField.HOUR_OF_DAY, 2)
+ .appendLiteral(':')
+ .appendValue(ChronoField.MINUTE_OF_HOUR, 2)
+ .appendLiteral(':')
+ .appendValue(ChronoField.SECOND_OF_MINUTE, 2)
+ .optionalStart()
+ .appendFraction(ChronoField.NANO_OF_SECOND, 2, 9, true)
+ .optionalEnd()
+ .appendOffset("+HH:MM", "Z").toFormatter()
+ .withResolverStyle(ResolverStyle.STRICT)
+ .withChronology(IsoChronology.INSTANCE);
+ }
+
private final Statement statement;
// data
private final List> resultSet = new ArrayList<>();
@@ -187,25 +217,41 @@ public class RestfulResultSet extends AbstractResultSet implements ResultSet {
}
case UTC: {
String value = row.getString(colIndex);
- long epochSec = Timestamp.valueOf(value.substring(0, 19).replace("T", " ")).getTime() / 1000;
- int fractionalSec = Integer.parseInt(value.substring(20, value.length() - 5));
- long nanoAdjustment;
- if (value.length() > 31) {
- // ns timestamp: yyyy-MM-ddTHH:mm:ss.SSSSSSSSS+0x00
- nanoAdjustment = fractionalSec;
- this.timestampPrecision = TimestampPrecision.NS;
- } else if (value.length() > 28) {
- // ms timestamp: yyyy-MM-ddTHH:mm:ss.SSSSSS+0x00
- nanoAdjustment = fractionalSec * 1000L;
- this.timestampPrecision = TimestampPrecision.US;
+ if (value.lastIndexOf(":") > 19) {
+ ZonedDateTime parse = ZonedDateTime.parse(value, rfc3339Parser);
+ long nanoAdjustment;
+ if (value.length() > 32) {
+ // ns timestamp: yyyy-MM-ddTHH:mm:ss.SSSSSSSSS+0x:00
+ this.timestampPrecision = TimestampPrecision.NS;
+ } else if (value.length() > 29) {
+ // ms timestamp: yyyy-MM-ddTHH:mm:ss.SSSSSS+0x:00
+ this.timestampPrecision = TimestampPrecision.US;
+ } else {
+ // ms timestamp: yyyy-MM-ddTHH:mm:ss.SSS+0x:00
+ this.timestampPrecision = TimestampPrecision.MS;
+ }
+ return Timestamp.from(parse.toInstant());
} else {
- // ms timestamp: yyyy-MM-ddTHH:mm:ss.SSS+0x00
- nanoAdjustment = fractionalSec * 1000_000L;
- this.timestampPrecision = TimestampPrecision.MS;
+ long epochSec = Timestamp.valueOf(value.substring(0, 19).replace("T", " ")).getTime() / 1000;
+ int fractionalSec = Integer.parseInt(value.substring(20, value.length() - 5));
+ long nanoAdjustment;
+ if (value.length() > 32) {
+ // ns timestamp: yyyy-MM-ddTHH:mm:ss.SSSSSSSSS+0x00
+ nanoAdjustment = fractionalSec;
+ this.timestampPrecision = TimestampPrecision.NS;
+ } else if (value.length() > 29) {
+ // ms timestamp: yyyy-MM-ddTHH:mm:ss.SSSSSS+0x00
+ nanoAdjustment = fractionalSec * 1000L;
+ this.timestampPrecision = TimestampPrecision.US;
+ } else {
+ // ms timestamp: yyyy-MM-ddTHH:mm:ss.SSS+0x00
+ nanoAdjustment = fractionalSec * 1000_000L;
+ this.timestampPrecision = TimestampPrecision.MS;
+ }
+ ZoneOffset zoneOffset = ZoneOffset.of(value.substring(value.length() - 5));
+ Instant instant = Instant.ofEpochSecond(epochSec, nanoAdjustment).atOffset(zoneOffset).toInstant();
+ return Timestamp.from(instant);
}
- ZoneOffset zoneOffset = ZoneOffset.of(value.substring(value.length() - 5));
- Instant instant = Instant.ofEpochSecond(epochSec, nanoAdjustment).atOffset(zoneOffset).toInstant();
- return Timestamp.from(instant);
}
case STRING:
default: {
diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
index cdcd2eec482cc39e940bf20f6ae636568257faf2..dada75e4a04b035cbe20da72075215c77f1c5883 100644
--- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
+++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
@@ -72,6 +72,7 @@ public class RestfulStatement extends AbstractStatement {
}
this.database = sql.trim().replace("use", "").trim();
this.conn.setCatalog(this.database);
+ this.conn.setClientInfo(TSDBDriver.PROPERTY_KEY_DBNAME, this.database);
result = false;
} else if (SqlSyntaxValidator.isDatabaseUnspecifiedQuery(sql)) {
executeOneQuery(sql);
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java
index afba0398752f1fd6c23dd7874301be27616fdab2..501c7e17c837ce311ec0f7b43f63122e53b8a0d9 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/JsonTagTest.java
@@ -1,19 +1,19 @@
package com.taosdata.jdbc;
-import com.google.common.collect.Lists;
-import org.checkerframework.checker.units.qual.A;
+import com.taosdata.jdbc.annotation.CatalogRunner;
+import com.taosdata.jdbc.annotation.Description;
+import com.taosdata.jdbc.annotation.TestTarget;
import org.junit.*;
+import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import java.sql.*;
-import java.util.List;
-/**
- * test json tag
- */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@RunWith(CatalogRunner.class)
+@TestTarget(alias = "JsonTag", author = "huolibo", version = "2.0.36")
public class JsonTagTest {
- private static String dbname = "json_tag_test";
+ private static final String dbName = "json_tag_test";
private static Connection connection;
private static Statement statement;
private static final String superSql = "create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)";
@@ -74,6 +74,7 @@ public class JsonTagTest {
};
@Test
+ @Description("insert json tag")
public void case01_InsertTest() throws SQLException {
for (String sql : sql) {
statement.execute(sql);
@@ -87,7 +88,8 @@ public class JsonTagTest {
}
@Test
- public void case02_InvalidJsonInsertTest() {
+ @Description("error json tag insert")
+ public void case02_ErrorJsonInsertTest() {
int count = 0;
for (String sql : errorJsonInsertSql) {
try {
@@ -99,59 +101,62 @@ public class JsonTagTest {
Assert.assertEquals(errorJsonInsertSql.length, count);
}
- // test invalidate json key, key must can be printed assic char
@Test(expected = SQLException.class)
+ @Description("exception will throw when json value is array")
public void case02_ArrayErrorTest() throws SQLException {
statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":[1,true]}')");
}
@Test(expected = SQLException.class)
- public void case02_EmptyKeyErrorTest() throws SQLException {
- statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\":\"fff\"}')");
- }
-
- @Test(expected = SQLException.class)
+ @Description("exception will throw when json value is empty")
public void case02_EmptyValueErrorTest() throws SQLException {
statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":{}}')");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when json key is not ASCII")
public void case02_AbnormalKeyErrorTest1() throws SQLException {
statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"。loc\":\"fff\"}')");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when json key is '\\t'")
public void case02_AbnormalKeyErrorTest2() throws SQLException {
statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\t\":\"fff\"}')");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when json key is chinese")
public void case02_AbnormalKeyErrorTest3() throws SQLException {
statement.execute("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"试试\":\"fff\"}')");
}
@Test
+ @Description("alter json tag")
public void case03_AlterTag() throws SQLException {
statement.execute("ALTER TABLE jsons1_1 SET TAG jtag='{\"tag1\":\"femail\",\"tag2\":35,\"tag3\":true}'");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when add json tag")
public void case03_AddTagErrorTest() throws SQLException {
statement.execute("ALTER STABLE jsons1 add tag tag2 nchar(20)");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when delete json tag")
public void case03_dropTagErrorTest() throws SQLException {
statement.execute("ALTER STABLE jsons1 drop tag jtag");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when set some json tag value")
public void case03_AlterTagErrorTest() throws SQLException {
statement.execute("ALTER TABLE jsons1_1 SET TAG jtag=4");
}
- // test error syntax
@Test
+ @Description("exception will throw when select syntax error")
public void case04_SelectErrorTest() {
int count = 0;
for (String sql : errorSelectSql) {
@@ -164,8 +169,8 @@ public class JsonTagTest {
Assert.assertEquals(errorSelectSql.length, count);
}
- // test select normal column
@Test
+ @Description("normal select stable")
public void case04_select01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select dataint from jsons1");
int count = 0;
@@ -176,8 +181,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag
@Test
+ @Description("select all column from stable")
public void case04_select02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1");
int count = 0;
@@ -189,6 +194,7 @@ public class JsonTagTest {
}
@Test
+ @Description("select json tag from stable")
public void case04_select03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag from jsons1");
int count = 0;
@@ -200,6 +206,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition tag is null")
public void case04_select04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag from jsons1 where jtag is null");
int count = 0;
@@ -211,6 +218,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition tag is not null")
public void case04_select05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag from jsons1 where jtag is not null");
int count = 0;
@@ -222,6 +230,7 @@ public class JsonTagTest {
}
@Test
+ @Description("select json tag")
public void case04_select06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag from jsons1_8");
resultSet.next();
@@ -231,6 +240,7 @@ public class JsonTagTest {
}
@Test
+ @Description("select json tag")
public void case04_select07() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag from jsons1_1");
resultSet.next();
@@ -239,8 +249,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test jtag is NULL
@Test
+ @Description("select not exist json tag")
public void case04_select08() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag from jsons1_9");
resultSet.next();
@@ -249,8 +259,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag->'key', value is string
@Test
+ @Description("select a json tag")
public void case04_select09() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_1");
resultSet.next();
@@ -260,6 +270,7 @@ public class JsonTagTest {
}
@Test
+ @Description("select a json tag, the value is empty")
public void case04_select10() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag2' from jsons1_6");
resultSet.next();
@@ -268,8 +279,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag->'key', value is int
@Test
+ @Description("select a json tag, the value is int")
public void case04_select11() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag2' from jsons1_1");
resultSet.next();
@@ -278,8 +289,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag->'key', value is bool
@Test
+ @Description("select a json tag, the value is boolean")
public void case04_select12() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag3' from jsons1_1");
resultSet.next();
@@ -288,8 +299,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag->'key', value is null
@Test
+ @Description("select a json tag, the value is null")
public void case04_select13() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_4");
resultSet.next();
@@ -298,8 +309,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag->'key', value is double
@Test
+ @Description("select a json tag, the value is double")
public void case04_select14() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1_5");
resultSet.next();
@@ -308,8 +319,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test select json tag->'key', key is not exist
@Test
+ @Description("select a json tag, the key is not exist")
public void case04_select15() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag10' from jsons1_4");
resultSet.next();
@@ -319,6 +330,7 @@ public class JsonTagTest {
}
@Test
+ @Description("select a json tag, the result number equals tables number")
public void case04_select16() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1");
int count = 0;
@@ -330,18 +342,7 @@ public class JsonTagTest {
}
@Test
- public void case04_select17() throws SQLException {
- ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from jsons1");
- int count = 0;
- while (resultSet.next()) {
- count++;
- }
- Assert.assertEquals(sql.length + invalidJsonCreateSql.length + invalidJsonInsertSql.length, count);
- close(resultSet);
- }
-
- // where json value is string
- @Test
+ @Description("where condition '=' for string")
public void case04_select19() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'='beijing'");
int count = 0;
@@ -353,6 +354,7 @@ public class JsonTagTest {
}
@Test
+ @Description("select and where conditon '=' for string")
public void case04_select20() throws SQLException {
ResultSet resultSet = statement.executeQuery("select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'");
int count = 0;
@@ -364,6 +366,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition result is null")
public void case04_select21() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='beijing'");
int count = 0;
@@ -375,6 +378,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition equation has chinese")
public void case04_select23() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='收到货'");
int count = 0;
@@ -386,6 +390,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '>' for character")
public void case05_symbolOperation01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'>'beijing'");
int count = 0;
@@ -397,6 +402,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '>=' for character")
public void case05_symbolOperation02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'>='beijing'");
int count = 0;
@@ -408,6 +414,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '<' for character")
public void case05_symbolOperation03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'<'beijing'");
int count = 0;
@@ -419,6 +426,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '<=' in character")
public void case05_symbolOperation04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'<='beijing'");
int count = 0;
@@ -430,6 +438,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '!=' in character")
public void case05_symbolOperation05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'!='beijing'");
int count = 0;
@@ -441,6 +450,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '=' empty")
public void case05_symbolOperation06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2'=''");
int count = 0;
@@ -453,11 +463,11 @@ public class JsonTagTest {
// where json value is int
@Test
+ @Description("where condition support '=' for int")
public void case06_selectValue01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=5");
int count = 0;
while (resultSet.next()) {
- System.out.println(resultSet.getString(1));
count++;
}
Assert.assertEquals(1, count);
@@ -465,6 +475,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where conditional support '<' for int")
public void case06_selectValue02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<54");
int count = 0;
@@ -476,6 +487,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '<=' for int")
public void case06_selectValue03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<=11");
int count = 0;
@@ -487,6 +499,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where conditional support '>' for int")
public void case06_selectValue04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>4");
int count = 0;
@@ -498,6 +511,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '>=' for int")
public void case06_selectValue05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>=5");
int count = 0;
@@ -509,6 +523,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where conditional support '!=' for int")
public void case06_selectValue06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=5");
int count = 0;
@@ -520,6 +535,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where conditional support '!=' for int")
public void case06_selectValue07() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=55");
int count = 0;
@@ -531,6 +547,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where conditional support '!=' for int and result is nothing")
public void case06_selectValue08() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=10");
int count = 0;
@@ -541,8 +558,8 @@ public class JsonTagTest {
close(resultSet);
}
- // where json value is double
@Test
+ @Description("where condition support '=' for double")
public void case07_selectValue01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=1.232");
int count = 0;
@@ -554,6 +571,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '<' for double")
public void case07_doubleOperation01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<1.232");
int count = 0;
@@ -565,6 +583,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '<=' for double")
public void case07_doubleOperation02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'<=1.232");
int count = 0;
@@ -576,6 +595,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '>' for double")
public void case07_doubleOperation03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>1.23");
int count = 0;
@@ -587,6 +607,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '>=' for double")
public void case07_doubleOperation04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'>=1.232");
int count = 0;
@@ -598,6 +619,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '!=' for double")
public void case07_doubleOperation05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=1.232");
int count = 0;
@@ -609,6 +631,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '!=' for double")
public void case07_doubleOperation06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=3.232");
int count = 0;
@@ -620,16 +643,19 @@ public class JsonTagTest {
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when denominator is zero")
public void case07_doubleOperation07() throws SQLException {
statement.executeQuery("select * from jsons1 where jtag->'tag1'/0=3");
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when invalid operation")
public void case07_doubleOperation08() throws SQLException {
statement.executeQuery("select * from jsons1 where jtag->'tag1'/5=1");
}
@Test
+ @Description("where condition support '=' for boolean")
public void case08_boolOperation01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=true");
int count = 0;
@@ -641,6 +667,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '=' for boolean")
public void case08_boolOperation02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false");
int count = 0;
@@ -652,6 +679,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support '!=' for boolean")
public void case08_boolOperation03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'!=false");
int count = 0;
@@ -663,12 +691,13 @@ public class JsonTagTest {
}
@Test(expected = SQLException.class)
+ @Description("exception will throw when '>' operation for boolean")
public void case08_boolOperation04() throws SQLException {
statement.executeQuery("select * from jsons1 where jtag->'tag1'>false");
}
- // where json value is null
@Test
+ @Description("where conditional support '=null'")
public void case09_select01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=null");
int count = 0;
@@ -680,6 +709,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where conditional support 'is null'")
public void case09_select02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag is null");
int count = 0;
@@ -691,6 +721,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support 'is not null'")
public void case09_select03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag is not null");
int count = 0;
@@ -702,6 +733,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support one tag '='")
public void case09_select04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag_no_exist'=3");
int count = 0;
@@ -713,6 +745,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support one tag 'is null'")
public void case09_select05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' is null");
int count = 0;
@@ -724,6 +757,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support one tag 'is null'")
public void case09_select06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag4' is null");
int count = 0;
@@ -735,6 +769,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition support one tag 'is not null'")
public void case09_select07() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag3' is not null");
int count = 0;
@@ -745,8 +780,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test ?
@Test
+ @Description("contains")
public void case09_select10() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag1'");
int count = 0;
@@ -758,6 +793,7 @@ public class JsonTagTest {
}
@Test
+ @Description("contains")
public void case09_select11() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag3'");
int count = 0;
@@ -769,6 +805,7 @@ public class JsonTagTest {
}
@Test
+ @Description("contains with no exist tag")
public void case09_select12() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag contains 'tag_no_exist'");
int count = 0;
@@ -779,8 +816,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test json tag in where condition with and/or
@Test
+ @Description("where condition with and")
public void case10_selectAndOr01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'");
int count = 0;
@@ -792,6 +829,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition with 'or'")
public void case10_selectAndOr02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'");
int count = 0;
@@ -803,6 +841,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition with 'and'")
public void case10_selectAndOr03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'");
int count = 0;
@@ -814,6 +853,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition with 'or'")
public void case10_selectAndOr04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35");
int count = 0;
@@ -825,6 +865,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition with 'or' and contains")
public void case10_selectAndOr05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' is not null and jtag contains 'tag3'");
int count = 0;
@@ -836,6 +877,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition with 'and' and contains")
public void case10_selectAndOr06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1'='femail' and jtag contains 'tag3'");
int count = 0;
@@ -846,8 +888,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test with tbname/normal column
@Test
+ @Description("test with tbname/normal column")
public void case11_selectTbName01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1'");
int count = 0;
@@ -859,6 +901,7 @@ public class JsonTagTest {
}
@Test
+ @Description("test with tbname/normal column")
public void case11_selectTbName02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3'");
int count = 0;
@@ -870,6 +913,7 @@ public class JsonTagTest {
}
@Test
+ @Description("test with tbname/normal column")
public void case11_selectTbName03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=3");
int count = 0;
@@ -881,6 +925,7 @@ public class JsonTagTest {
}
@Test
+ @Description("test with tbname/normal column")
public void case11_selectTbName04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=23");
int count = 0;
@@ -891,8 +936,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test where condition like
@Test
+ @Description("where condition like")
public void case12_selectWhere01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select *,tbname from jsons1 where jtag->'tag2' like 'bei%'");
int count = 0;
@@ -904,6 +949,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition like")
public void case12_selectWhere02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null");
int count = 0;
@@ -914,14 +960,14 @@ public class JsonTagTest {
close(resultSet);
}
- // test where condition in no support in
@Test(expected = SQLException.class)
+ @Description("where condition in no support in")
public void case12_selectWhere03() throws SQLException {
statement.executeQuery("select * from jsons1 where jtag->'tag1' in ('beijing')");
}
- // test where condition match
@Test
+ @Description("where condition match")
public void case12_selectWhere04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match 'ma'");
int count = 0;
@@ -933,6 +979,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition match")
public void case12_selectWhere05() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match 'ma$'");
int count = 0;
@@ -944,6 +991,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition match")
public void case12_selectWhere06() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag2' match 'jing$'");
int count = 0;
@@ -955,6 +1003,7 @@ public class JsonTagTest {
}
@Test
+ @Description("where condition match")
public void case12_selectWhere07() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from jsons1 where jtag->'tag1' match '收到'");
int count = 0;
@@ -965,13 +1014,14 @@ public class JsonTagTest {
close(resultSet);
}
- // test distinct
@Test
+ @Description("insert distinct")
public void case13_selectDistinct01() throws SQLException {
statement.execute("insert into jsons1_14 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '你就会', 'dws')");
}
@Test
+ @Description("distinct json tag")
public void case13_selectDistinct02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select distinct jtag->'tag1' from jsons1");
int count = 0;
@@ -983,6 +1033,7 @@ public class JsonTagTest {
}
@Test
+ @Description("distinct json tag")
public void case13_selectDistinct03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select distinct jtag from jsons1");
int count = 0;
@@ -993,13 +1044,14 @@ public class JsonTagTest {
close(resultSet);
}
- // test dumplicate key with normal colomn
@Test
+ @Description("insert json tag")
public void case14_selectDump01() throws SQLException {
statement.execute("INSERT INTO jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"datastr\":\"是是是\"}') values(1591060828000, 4, false, 'jjsf', \"你就会\")");
}
@Test
+ @Description("test duplicate key with normal column")
public void case14_selectDump02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select *,tbname,jtag from jsons1 where jtag->'datastr' match '是' and datastr match 'js'");
int count = 0;
@@ -1011,6 +1063,7 @@ public class JsonTagTest {
}
@Test
+ @Description("test duplicate key with normal column")
public void case14_selectDump03() throws SQLException {
ResultSet resultSet = statement.executeQuery("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'");
int count = 0;
@@ -1021,8 +1074,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test join
@Test
+ @Description("insert json tag for join test")
public void case15_selectJoin01() throws SQLException {
statement.execute("create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)");
statement.execute("insert into jsons2_1 using jsons2 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 2, false, 'json2', '你是2')");
@@ -1033,17 +1086,17 @@ public class JsonTagTest {
statement.execute("insert into jsons3_2 using jsons3 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060638000, 2, true, 'json3', 'sss')");
}
- // TODO check result
@Test
+ @Description("select json tag from join")
public void case15_selectJoin02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select 'sss',33,a.jtag->'tag3' from jsons2 a,jsons3 b where a.ts=b.ts and a.jtag->'tag1'=b.jtag->'tag1'");
-
+ resultSet.next();
+ Assert.assertEquals("sss", resultSet.getString(1));
close(resultSet);
}
- // test group by & order by json tag
- // TODO check other result
@Test
+ @Description("group by and order by json tag desc")
public void case16_selectGroupOrder01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc");
int count = 0;
@@ -1055,6 +1108,7 @@ public class JsonTagTest {
}
@Test
+ @Description("group by and order by json tag asc")
public void case16_selectGroupOrder02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc");
int count = 0;
@@ -1065,9 +1119,8 @@ public class JsonTagTest {
close(resultSet);
}
- // test stddev with group by json tag
- // TODO check result
@Test
+ @Description("stddev with group by json tag")
public void case17_selectStddev01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select stddev(dataint) from jsons1 group by jtag->'tag1'");
String s = "";
@@ -1082,8 +1135,8 @@ public class JsonTagTest {
close(resultSet);
}
- // subquery with json tag
@Test
+ @Description("subquery json tag")
public void case18_selectSubquery01() throws SQLException {
ResultSet resultSet = statement.executeQuery("select * from (select jtag, dataint from jsons1)");
int count = 0;
@@ -1095,8 +1148,14 @@ public class JsonTagTest {
}
@Test
+ @Description("subquery some json tags")
public void case18_selectSubquery02() throws SQLException {
ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)");
+
+ ResultSetMetaData metaData = resultSet.getMetaData();
+ String columnName = metaData.getColumnName(1);
+ Assert.assertEquals("jtag->'tag1'", columnName);
+
int count = 0;
while (resultSet.next()) {
count++;
@@ -1106,15 +1165,7 @@ public class JsonTagTest {
}
@Test
- public void case18_selectSubquery03() throws SQLException {
- ResultSet resultSet = statement.executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)");
- ResultSetMetaData metaData = resultSet.getMetaData();
- String columnName = metaData.getColumnName(1);
- Assert.assertEquals("jtag->'tag1'", columnName);
- close(resultSet);
- }
-
- @Test
+ @Description("query some json tags from subquery")
public void case18_selectSubquery04() throws SQLException {
ResultSet resultSet = statement.executeQuery("select ts,tbname,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)");
int count = 0;
@@ -1142,9 +1193,9 @@ public class JsonTagTest {
try {
connection = DriverManager.getConnection(url);
statement = connection.createStatement();
- statement.execute("drop database if exists " + dbname);
- statement.execute("create database if not exists " + dbname);
- statement.execute("use " + dbname);
+ statement.execute("drop database if exists " + dbName);
+ statement.execute("create database if not exists " + dbName);
+ statement.execute("use " + dbName);
statement.execute(superSql);
} catch (SQLException e) {
e.printStackTrace();
@@ -1155,7 +1206,7 @@ public class JsonTagTest {
public static void afterClass() {
try {
if (null != statement) {
- statement.execute("drop database " + dbname);
+ statement.execute("drop database " + dbName);
statement.close();
}
if (null != connection) {
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/ParameterBindTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/ParameterBindTest.java
index 46f201d1c0a525f52014d133e25fc0db4741050c..63c3a6318a611f7159c0ac16dc85cd5e05de47c0 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/ParameterBindTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/ParameterBindTest.java
@@ -128,8 +128,8 @@ public class ParameterBindTest {
@After
public void after() {
try {
-// Statement stmt = conn.createStatement();
-// stmt.execute("drop database if exists test_pd");
+ Statement stmt = conn.createStatement();
+ stmt.execute("drop database if exists test_pd");
if (conn != null)
conn.close();
} catch (SQLException e) {
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java
index a090dd10e3564d498ab807909f97aefb3b2f3466..cc47a47f1cd2f0a0c8efdde5ab7afa39b395a16d 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/SchemalessInsertTest.java
@@ -2,17 +2,23 @@ package com.taosdata.jdbc;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.taosdata.jdbc.annotation.CatalogRunner;
+import com.taosdata.jdbc.annotation.Description;
+import com.taosdata.jdbc.annotation.TestTarget;
import com.taosdata.jdbc.enums.SchemalessProtocolType;
import com.taosdata.jdbc.enums.SchemalessTimestampType;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
+@RunWith(CatalogRunner.class)
+@TestTarget(alias = "Schemaless",author = "huolibo", version = "2.0.36")
public class SchemalessInsertTest {
private final String dbname = "test_schemaless_insert";
private Connection conn;
@@ -23,6 +29,7 @@ public class SchemalessInsertTest {
* @throws SQLException execute error
*/
@Test
+ @Description("line insert")
public void schemalessInsert() throws SQLException {
// given
String[] lines = new String[]{
@@ -53,6 +60,7 @@ public class SchemalessInsertTest {
* @throws SQLException execute error
*/
@Test
+ @Description("telnet insert")
public void telnetInsert() throws SQLException {
// given
String[] lines = new String[]{
@@ -87,6 +95,7 @@ public class SchemalessInsertTest {
* @throws SQLException execute error
*/
@Test
+ @Description("json insert")
public void jsonInsert() throws SQLException {
// given
String json = "[\n" +
@@ -178,7 +187,6 @@ public class SchemalessInsertTest {
public void after() {
try (Statement stmt = conn.createStatement()) {
stmt.execute("drop database if exists " + dbname);
- stmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java
index 64b7ab1cabe2c5815ff87d9881873150f21049c6..c69a556ae4e6c6b31dbb106c7ff4a3e2352296ee 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBConnectionTest.java
@@ -380,8 +380,12 @@ public class TSDBConnectionTest {
@AfterClass
public static void afterClass() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists test");
+ statement.close();
conn.close();
+ }
}
}
\ No newline at end of file
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDriverTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDriverTest.java
index 9f297955d687f3cfcc3acef626e1f905ecee6bdf..609523f522724a9bf49e7ded76d2855cbdda6ac1 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDriverTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDriverTest.java
@@ -1,6 +1,5 @@
package com.taosdata.jdbc;
-import org.junit.BeforeClass;
import org.junit.Test;
import java.sql.*;
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java
index f44d647595e99ae00a355ca25f702cf2e0c1cc36..f508fbdeed5bf617cf81330985981b5715678472 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBJNIConnectorTest.java
@@ -7,6 +7,7 @@ import org.junit.Test;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.sql.SQLException;
+import java.sql.SQLWarning;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -19,115 +20,111 @@ public class TSDBJNIConnectorTest {
private static TSDBResultSetRowData rowData;
@Test
- public void test() {
+ public void test() throws SQLException {
try {
- try {
- //change sleepSeconds when debugging with attach to process to find PID
- int sleepSeconds = -1;
- if (sleepSeconds > 0) {
- RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
- String jvmName = runtimeBean.getName();
- long pid = Long.valueOf(jvmName.split("@")[0]);
- System.out.println("JVM PID = " + pid);
-
- Thread.sleep(sleepSeconds * 1000);
- }
- } catch (Exception e) {
- e.printStackTrace();
+ //change sleepSeconds when debugging with attach to process to find PID
+ int sleepSeconds = -1;
+ if (sleepSeconds > 0) {
+ RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
+ String jvmName = runtimeBean.getName();
+ long pid = Long.valueOf(jvmName.split("@")[0]);
+ System.out.println("JVM PID = " + pid);
+
+ Thread.sleep(sleepSeconds * 1000);
}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
- // init
- Properties properties = new Properties();
- properties.setProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR, "/etc/taos");
- TSDBJNIConnector.init(properties);
-
- // connect
- TSDBJNIConnector connector = new TSDBJNIConnector();
- connector.connect("127.0.0.1", 6030, null, "root", "taosdata");
-
- // setup
- String setupSqlStrs[] = {"create database if not exists d precision \"us\"",
- "create table if not exists d.t(ts timestamp, f int)",
- "create database if not exists d2",
- "create table if not exists d2.t2(ts timestamp, f int)",
- "insert into d.t values(now+100s, 100)",
- "insert into d2.t2 values(now+200s, 200)"
- };
- for (String setupSqlStr : setupSqlStrs) {
- long setupSql = connector.executeQuery(setupSqlStr);
-
- assertEquals(0, connector.getResultTimePrecision(setupSql));
- if (connector.isUpdateQuery(setupSql)) {
- connector.freeResultSet(setupSql);
- }
+ // init
+ Properties properties = new Properties();
+ properties.setProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR, "/etc/taos");
+ TSDBJNIConnector.init(properties);
+
+ // connect
+ TSDBJNIConnector connector = new TSDBJNIConnector();
+ connector.connect("127.0.0.1", 6030, null, "root", "taosdata");
+
+ // setup
+ String setupSqlStrs[] = {"create database if not exists d precision \"us\"",
+ "create table if not exists d.t(ts timestamp, f int)",
+ "create database if not exists d2",
+ "create table if not exists d2.t2(ts timestamp, f int)",
+ "insert into d.t values(now+100s, 100)",
+ "insert into d2.t2 values(now+200s, 200)"
+ };
+ for (String setupSqlStr : setupSqlStrs) {
+ long setupSql = connector.executeQuery(setupSqlStr);
+
+ assertEquals(0, connector.getResultTimePrecision(setupSql));
+ if (connector.isUpdateQuery(setupSql)) {
+ connector.freeResultSet(setupSql);
}
+ }
- {
- long sqlObj1 = connector.executeQuery("select * from d2.t2");
- assertEquals(0, connector.getResultTimePrecision(sqlObj1));
- List columnMetaDataList = new ArrayList<>();
- int code = connector.getSchemaMetaData(sqlObj1, columnMetaDataList);
- rowData = new TSDBResultSetRowData(columnMetaDataList.size());
- assertTrue(next(connector, sqlObj1));
- assertEquals(0, connector.getResultTimePrecision(sqlObj1));
- connector.freeResultSet(sqlObj1);
- }
+ {
+ long sqlObj1 = connector.executeQuery("select * from d2.t2");
+ assertEquals(0, connector.getResultTimePrecision(sqlObj1));
+ List columnMetaDataList = new ArrayList<>();
+ int code = connector.getSchemaMetaData(sqlObj1, columnMetaDataList);
+ rowData = new TSDBResultSetRowData(columnMetaDataList.size());
+ assertTrue(next(connector, sqlObj1));
+ assertEquals(0, connector.getResultTimePrecision(sqlObj1));
+ connector.freeResultSet(sqlObj1);
+ }
- // executeQuery
- long pSql = connector.executeQuery("select * from d.t");
+ // executeQuery
+ long pSql = connector.executeQuery("select * from d.t");
- if (connector.isUpdateQuery(pSql)) {
- connector.freeResultSet(pSql);
- throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_WITH_EXECUTEQUERY);
- }
+ if (connector.isUpdateQuery(pSql)) {
+ connector.freeResultSet(pSql);
+ throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_INVALID_WITH_EXECUTEQUERY);
+ }
- assertEquals(1, connector.getResultTimePrecision(pSql));
+ assertEquals(1, connector.getResultTimePrecision(pSql));
- // get schema
- List columnMetaDataList = new ArrayList<>();
- int code = connector.getSchemaMetaData(pSql, columnMetaDataList);
- if (code == TSDBConstants.JNI_CONNECTION_NULL) {
- throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
- }
- if (code == TSDBConstants.JNI_RESULT_SET_NULL) {
- throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL);
- }
- if (code == TSDBConstants.JNI_NUM_OF_FIELDS_0) {
- throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_NUM_OF_FIELDS_0);
- }
+ // get schema
+ List columnMetaDataList = new ArrayList<>();
+ int code = connector.getSchemaMetaData(pSql, columnMetaDataList);
+ if (code == TSDBConstants.JNI_CONNECTION_NULL) {
+ throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
+ }
+ if (code == TSDBConstants.JNI_RESULT_SET_NULL) {
+ throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL);
+ }
+ if (code == TSDBConstants.JNI_NUM_OF_FIELDS_0) {
+ throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_NUM_OF_FIELDS_0);
+ }
+ assertEquals(1, connector.getResultTimePrecision(pSql));
+ int columnSize = columnMetaDataList.size();
+ // print metadata
+ for (int i = 0; i < columnSize; i++) {
+// System.out.println(columnMetaDataList.get(i));
+ }
+ rowData = new TSDBResultSetRowData(columnSize);
+ // iterate resultSet
+ for (int i = 0; next(connector, pSql); i++) {
assertEquals(1, connector.getResultTimePrecision(pSql));
- int columnSize = columnMetaDataList.size();
- // print metadata
- for (int i = 0; i < columnSize; i++) {
- System.out.println(columnMetaDataList.get(i));
- }
- rowData = new TSDBResultSetRowData(columnSize);
- // iterate resultSet
- for (int i = 0; next(connector, pSql); i++) {
- assertEquals(1, connector.getResultTimePrecision(pSql));
- System.out.println();
- }
- // close resultSet
- code = connector.freeResultSet(pSql);
- if (code == TSDBConstants.JNI_CONNECTION_NULL) {
- throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
- } else if (code == TSDBConstants.JNI_RESULT_SET_NULL) {
- throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL);
- }
- // close statement
- connector.executeQuery("use d");
- String[] lines = new String[]{
- "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000",
- "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000"};
- connector.insertLines(lines, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO_SECONDS);
-
- // close connection
- connector.closeConnection();
-
- } catch (SQLException e) {
- e.printStackTrace();
}
+ // close resultSet
+ code = connector.freeResultSet(pSql);
+ if (code == TSDBConstants.JNI_CONNECTION_NULL) {
+ throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL);
+ } else if (code == TSDBConstants.JNI_RESULT_SET_NULL) {
+ throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_RESULT_SET_NULL);
+ }
+ // close statement
+ connector.executeQuery("use d");
+ String[] lines = new String[]{
+ "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000",
+ "st,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1626006833640000000"};
+ connector.insertLines(lines, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO_SECONDS);
+
+ // close connection
+ connector.executeQuery("drop database if exists d");
+ connector.executeQuery("drop database if exists d2");
+ connector.closeConnection();
}
private static boolean next(TSDBJNIConnector connector, long pSql) throws SQLException {
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java
index dc41d85cf38c5fbedb6e5f5c26d593c8c9d5c4d7..56e8b96bbd9dee496969a010b0385c4ecd7f1145 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBParameterMetaDataTest.java
@@ -17,6 +17,7 @@ public class TSDBParameterMetaDataTest {
private static PreparedStatement pstmt_select;
private static ParameterMetaData parameterMetaData_insert;
private static ParameterMetaData parameterMetaData_select;
+ private static final String dbname = "test_pstmt";
@Test
public void getParameterCount() throws SQLException {
@@ -152,9 +153,9 @@ public class TSDBParameterMetaDataTest {
try {
conn = DriverManager.getConnection("jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata");
try (Statement stmt = conn.createStatement()) {
- stmt.execute("drop database if exists test_pstmt");
- stmt.execute("create database if not exists test_pstmt");
- stmt.execute("use test_pstmt");
+ stmt.execute("drop database if exists " + dbname);
+ stmt.execute("create database if not exists " + dbname);
+ stmt.execute("use " + dbname);
stmt.execute("create table weather(ts timestamp, f1 int, f2 bigint, f3 float, f4 double, f5 smallint, f6 tinyint, f7 bool, f8 binary(64), f9 nchar(64)) tags(loc nchar(64))");
stmt.execute("create table t1 using weather tags('beijing')");
}
@@ -190,8 +191,12 @@ public class TSDBParameterMetaDataTest {
pstmt_insert.close();
if (pstmt_select != null)
pstmt_select.close();
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java
index 3d76e1f98d4f8aa1d0ba3d68395e4036c5b069e6..8cb4628884fdd85c1bfd6f24ac311d82687da5ab 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBPreparedStatementTest.java
@@ -1233,6 +1233,7 @@ public class TSDBPreparedStatementTest {
try {
Statement statement = conn.createStatement();
statement.execute("drop database if exists " + dbname);
+ statement.execute("drop database if exists dbtest");
statement.close();
if (conn != null)
conn.close();
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java
index f72cbbec8c1b4c0acad1c83ffcbcb35c1fb8ea7b..7b9083bf9be242f8bcb21565a47d6092675e2d6e 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBResultSetTest.java
@@ -668,8 +668,12 @@ public class TSDBResultSetTest {
rs.close();
if (stmt != null)
stmt.close();
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists restful_test");
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..490346e401dba956c8743abb452bcc943df67904
--- /dev/null
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogClass.java
@@ -0,0 +1,86 @@
+package com.taosdata.jdbc.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test class
+ */
+public class CatalogClass {
+
+ private String name;
+ private String alias;
+ private String author;
+ private String version;
+ private List methods = new ArrayList<>();
+ private int total;
+ private int failure;
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public void setFailure(int failure) {
+ this.failure = failure;
+ }
+
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ public void setMethods(List methods) {
+ this.methods = methods;
+ }
+
+ @Override
+ public String toString() {
+ if (methods.size() < 1)
+ return null;
+ StringBuilder sb = new StringBuilder();
+ sb.append("ClassName: ").append(name);
+ String msg = trim(alias);
+ if (null != msg)
+ sb.append("\tAlias:").append(alias);
+ sb.append("\tTotal:").append(total)
+ .append("\tFailure:").append(failure).append("\n");
+ for (CatalogMethod method : methods) {
+ sb.append("\t").append(method.getName());
+ sb.append("\t").append(method.isSuccess());
+ sb.append("\t").append(method.getMessage());
+ String mAuthor = trim(method.getAuthor());
+ if (null == mAuthor) {
+ sb.append("\t").append(author);
+ } else {
+ sb.append("\t").append(method.getAuthor());
+ }
+ String mVersion = trim(method.getVersion());
+ if (null == mVersion) {
+ sb.append("\t").append(version);
+ } else {
+ sb.append("\t").append(mVersion);
+ }
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+
+ private String trim(String s) {
+ if (null == s || s.trim().equals("")) {
+ return null;
+ } else {
+ return s.trim();
+ }
+ }
+}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d22302d02f531eca055fa76dea18d8de9f7371f
--- /dev/null
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogListener.java
@@ -0,0 +1,104 @@
+package com.taosdata.jdbc.annotation;
+
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.LinkedList;
+
+public class CatalogListener extends RunListener {
+ public static final String CATALOG_FILE = "target/TestCaseCatalog.txt";
+ CatalogClass catalogClass = null;
+ private final LinkedList methods = new LinkedList<>();
+
+ @Override
+ public void testRunStarted(Description description) throws Exception {
+ catalogClass = new CatalogClass();
+ TestTarget target = description.getAnnotation(TestTarget.class);
+ if (target != null) {
+ catalogClass.setAlias(target.alias());
+ catalogClass.setAuthor(target.author());
+ catalogClass.setVersion(target.version());
+ }
+ catalogClass.setName(getClassName(description.getClassName()));
+ }
+
+ private String getClassName(String name) {
+ if (null == name || name.trim().equals("")) {
+ return null;
+ }
+ name = name.trim();
+ int pos = name.lastIndexOf(".");
+ if (-1 == pos) {
+ return name;
+ }
+ return name.substring(pos + 1);
+ }
+
+ @Override
+ public void testRunFinished(Result result) throws Exception {
+ catalogClass.setMethods(methods);
+ catalogClass.setTotal(result.getRunCount());
+ catalogClass.setFailure(result.getFailureCount());
+ File file = new File(CATALOG_FILE);
+ if (!file.exists()) {
+ synchronized (CatalogListener.class) {
+ if (!file.exists()) {
+ file.createNewFile();
+ try (FileWriter writer = new FileWriter(file, true)) {
+ writer.write("\tName\tPass\tMessage\tAuthor\tVersion\n");
+ writer.write(catalogClass.toString());
+ }
+ }
+ }
+ } else {
+ try (FileWriter writer = new FileWriter(file, true)) {
+ writer.write(catalogClass.toString());
+ }
+ }
+ }
+
+ @Override
+ public void testStarted(Description description) throws Exception {
+ }
+
+ @Override
+ public void testFinished(Description description) throws Exception {
+ com.taosdata.jdbc.annotation.Description annotation
+ = description.getAnnotation(com.taosdata.jdbc.annotation.Description.class);
+ if (annotation != null) {
+ CatalogMethod method = new CatalogMethod();
+ method.setMessage(annotation.value());
+ method.setAuthor(annotation.author());
+ method.setVersion(annotation.version());
+ method.setSuccess(true);
+ method.setName(description.getMethodName());
+ methods.addLast(method);
+ }
+ }
+
+ @Override
+ public void testFailure(Failure failure) throws Exception {
+ com.taosdata.jdbc.annotation.Description annotation
+ = failure.getDescription().getAnnotation(com.taosdata.jdbc.annotation.Description.class);
+ CatalogMethod method = new CatalogMethod();
+ method.setMessage(annotation.value());
+ method.setAuthor(annotation.author());
+ method.setVersion(annotation.version());
+ method.setSuccess(false);
+ method.setName(failure.getDescription().getMethodName());
+ methods.addFirst(method);
+ }
+
+ @Override
+ public void testAssumptionFailure(Failure failure) {
+ }
+
+ @Override
+ public void testIgnored(Description description) throws Exception {
+ super.testIgnored(description);
+ }
+}
\ No newline at end of file
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java
new file mode 100644
index 0000000000000000000000000000000000000000..1dd074df2d1298781bbbfa7e7709113db2c6ca01
--- /dev/null
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogMethod.java
@@ -0,0 +1,52 @@
+package com.taosdata.jdbc.annotation;
+
+/**
+ * Test method
+ */
+public class CatalogMethod {
+ private String name;
+ private boolean success;
+ private String message;
+ private String author;
+ private String version;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java
new file mode 100644
index 0000000000000000000000000000000000000000..08e5f9212287d517838448d0122ab0876812cc1d
--- /dev/null
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/CatalogRunner.java
@@ -0,0 +1,36 @@
+package com.taosdata.jdbc.annotation;
+
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.internal.runners.model.EachTestNotifier;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runner.notification.StoppedByUserException;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+public class CatalogRunner extends BlockJUnit4ClassRunner {
+
+ public CatalogRunner(Class> testClass) throws InitializationError {
+ super(testClass);
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ //add user-defined listener
+ notifier.addListener(new CatalogListener());
+ EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription());
+
+ notifier.fireTestRunStarted(getDescription());
+
+ try {
+ Statement statement = classBlock(notifier);
+ statement.evaluate();
+ } catch (AssumptionViolatedException av) {
+ testNotifier.addFailedAssumption(av);
+ } catch (StoppedByUserException exception) {
+ throw exception;
+ } catch (Throwable e) {
+ testNotifier.addFailure(e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java
new file mode 100644
index 0000000000000000000000000000000000000000..669b0a088656c030281e82620117469b3a375c75
--- /dev/null
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/Description.java
@@ -0,0 +1,19 @@
+package com.taosdata.jdbc.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+public @interface Description {
+
+ String value();
+
+ // git blame author
+ String author() default "";
+
+ // since which version;
+ String version() default "";
+}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java
new file mode 100644
index 0000000000000000000000000000000000000000..3d1db681647d3b23818143156ffd513c46a6e495
--- /dev/null
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/annotation/TestTarget.java
@@ -0,0 +1,18 @@
+package com.taosdata.jdbc.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
+public @interface TestTarget {
+
+ String alias() default "";
+
+ String author();
+
+ String version() default "";
+
+}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java
index 05c7b0feca21f3f5b9062f9cbc26921aa607732a..60edcc506e9fea7bc055322b7b00d0f9e9d75591 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertDbwithoutUseDbTest.java
@@ -1,9 +1,6 @@
package com.taosdata.jdbc.cases;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
+import org.junit.*;
import org.junit.runners.MethodSorters;
import java.sql.*;
@@ -16,36 +13,32 @@ public class InsertDbwithoutUseDbTest {
private static final String host = "127.0.0.1";
private static Properties properties;
private static final Random random = new Random(System.currentTimeMillis());
+ private static final String dbname = "inWithoutDb";
@Test
public void case001() throws SQLException {
// prepare schema
String url = "jdbc:TAOS://127.0.0.1:6030/?user=root&password=taosdata";
Connection conn = DriverManager.getConnection(url, properties);
- try (Statement stmt = conn.createStatement()) {
- stmt.execute("drop database if exists inWithoutDb");
- stmt.execute("create database if not exists inWithoutDb");
- stmt.execute("create table inWithoutDb.weather(ts timestamp, f1 int)");
- }
+ Statement stmt = conn.createStatement();
+ stmt.execute("drop database if exists " + dbname);
+ stmt.execute("create database if not exists " + dbname);
+ stmt.execute("create table " + dbname + ".weather(ts timestamp, f1 int)");
+
conn.close();
// execute insert
- url = "jdbc:TAOS://127.0.0.1:6030/inWithoutDb?user=root&password=taosdata";
+ url = "jdbc:TAOS://127.0.0.1:6030/" + dbname + "?user=root&password=taosdata";
conn = DriverManager.getConnection(url, properties);
- try (Statement stmt = conn.createStatement()) {
- int affectedRow = stmt.executeUpdate("insert into weather(ts, f1) values(now," + random.nextInt(100) + ")");
- Assert.assertEquals(1, affectedRow);
- boolean flag = stmt.execute("insert into weather(ts, f1) values(now + 10s," + random.nextInt(100) + ")");
- Assert.assertEquals(false, flag);
- ResultSet rs = stmt.executeQuery("select count(*) from weather");
- rs.next();
- int count = rs.getInt("count(*)");
- Assert.assertEquals(2, count);
-
- } catch (SQLException e) {
- e.printStackTrace();
- }
-
+ stmt = conn.createStatement();
+ int affectedRow = stmt.executeUpdate("insert into weather(ts, f1) values(now," + random.nextInt(100) + ")");
+ Assert.assertEquals(1, affectedRow);
+ boolean flag = stmt.execute("insert into weather(ts, f1) values(now + 10s," + random.nextInt(100) + ")");
+ Assert.assertEquals(false, flag);
+ ResultSet rs = stmt.executeQuery("select count(*) from weather");
+ rs.next();
+ int count = rs.getInt("count(*)");
+ Assert.assertEquals(2, count);
conn.close();
}
@@ -54,28 +47,25 @@ public class InsertDbwithoutUseDbTest {
// prepare the schema
final String url = "jdbc:TAOS-RS://" + host + ":6041/inWithoutDb?user=root&password=taosdata";
Connection conn = DriverManager.getConnection(url, properties);
- try (Statement stmt = conn.createStatement()) {
- stmt.execute("drop database if exists inWithoutDb");
- stmt.execute("create database if not exists inWithoutDb");
- stmt.execute("create table inWithoutDb.weather(ts timestamp, f1 int)");
- }
- conn.close();
+ Statement stmt = conn.createStatement();
+ stmt.execute("drop database if exists " + dbname);
+ stmt.execute("create database if not exists " + dbname);
+ stmt.execute("create table " + dbname + ".weather(ts timestamp, f1 int)");
+ stmt.close();
// execute
- conn = DriverManager.getConnection(url, properties);
- try (Statement stmt = conn.createStatement()) {
- int affectedRow = stmt.executeUpdate("insert into weather(ts, f1) values(now," + random.nextInt(100) + ")");
- Assert.assertEquals(1, affectedRow);
- boolean flag = stmt.execute("insert into weather(ts, f1) values(now + 10s," + random.nextInt(100) + ")");
- Assert.assertEquals(false, flag);
- ResultSet rs = stmt.executeQuery("select count(*) from weather");
- rs.next();
- int count = rs.getInt("count(*)");
- Assert.assertEquals(2, count);
-
- } catch (SQLException e) {
- e.printStackTrace();
- }
+ stmt = conn.createStatement();
+ int affectedRow = stmt.executeUpdate("insert into weather(ts, f1) values(now," + random.nextInt(100) + ")");
+ Assert.assertEquals(1, affectedRow);
+ boolean flag = stmt.execute("insert into weather(ts, f1) values(now + 10s," + random.nextInt(100) + ")");
+ Assert.assertEquals(false, flag);
+ ResultSet rs = stmt.executeQuery("select count(*) from weather");
+ rs.next();
+ int count = rs.getInt("count(*)");
+ Assert.assertEquals(2, count);
+ stmt.execute("drop database if exists " + dbname);
+ stmt.close();
+ conn.close();
}
@BeforeClass
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java
index ac254bebf39f55b358883716e23ba72b695703f7..7cc1c811d136a974a8cd9b8d4b990fe206c9e98d 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java
@@ -427,8 +427,12 @@ public class InsertSpecialCharacterJniTest {
@AfterClass
public static void afterClass() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbName);
+ statement.close();
conn.close();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
index eedccec6f1ad3aecbaebbd525788a68e7c236511..81e424971c90e75a0ca3e8d14b82eefc45e417c8 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
@@ -391,8 +391,12 @@ public class InsertSpecialCharacterRestfulTest {
@AfterClass
public static void afterClass() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists "+ dbName);
+ statement.close();
conn.close();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java
index eb3b2985dfaff1b956909a50ca23470279cb48ca..38e8d99afe4a9fbca8d7167df482b6c2ac6976d8 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/JDBCTypeAndTypeCompareTest.java
@@ -1,19 +1,22 @@
package com.taosdata.jdbc.cases;
+import org.junit.AfterClass;
import org.junit.Test;
import java.sql.*;
public class JDBCTypeAndTypeCompareTest {
+ private static Connection conn;
+ private static final String dbname = "test";
@Test
public void test() throws SQLException {
- Connection conn = DriverManager.getConnection("jdbc:TAOS://192.168.17.156:6030/", "root", "taosdata");
+ conn = DriverManager.getConnection("jdbc:TAOS://127.0.0.1:6030/", "root", "taosdata");
Statement stmt = conn.createStatement();
- stmt.execute("drop database if exists test");
- stmt.execute("create database if not exists test");
- stmt.execute("use test");
+ stmt.execute("drop database if exists " + dbname);
+ stmt.execute("create database if not exists " + dbname);
+ stmt.execute("use " + dbname);
stmt.execute("create table weather(ts timestamp, f1 int, f2 bigint, f3 float, f4 double, f5 smallint, f6 tinyint, f7 bool, f8 binary(10), f9 nchar(10) )");
stmt.execute("insert into weather values(now, 1, 2, 3.0, 4.0, 5, 6, true, 'test','test')");
@@ -29,6 +32,19 @@ public class JDBCTypeAndTypeCompareTest {
}
stmt.close();
- conn.close();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ try {
+ if (null != conn) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
+ conn.close();
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionJNITest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionJNITest.java
index eb8f134227713e4c41224dc6a561916427290864..0889170e656910181fe39f844e585c11f0d78d5e 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionJNITest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionJNITest.java
@@ -47,7 +47,7 @@ public class MicroSecondPrecisionJNITest {
Assert.assertEquals(timestamp2 % 1000_000l * 1000, nanos);
ts = rs.getLong(1);
- Assert.assertEquals(timestamp1, ts);
+ Assert.assertEquals(timestamp2, ts);
} catch (SQLException e) {
e.printStackTrace();
}
@@ -79,8 +79,13 @@ public class MicroSecondPrecisionJNITest {
@AfterClass
public static void afterClass() {
try {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database " + ms_timestamp_db);
+ statement.execute("drop database " + us_timestamp_db);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionRestfulTest.java
index f418436a4afac5f16b27789eb43081f131bf1f92..48c5ef8a463452dc205c43247678bfd0f3e761a2 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionRestfulTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MicroSecondPrecisionRestfulTest.java
@@ -47,7 +47,7 @@ public class MicroSecondPrecisionRestfulTest {
Assert.assertEquals(timestamp2 % 1000_000l * 1000, nanos);
ts = rs.getLong(1);
- Assert.assertEquals(timestamp1, ts);
+ Assert.assertEquals(timestamp2, ts);
}
}
@@ -77,7 +77,7 @@ public class MicroSecondPrecisionRestfulTest {
Assert.assertEquals(timestamp2 % 1000_000l * 1000, nanos);
ts = rs.getLong(1);
- Assert.assertEquals(timestamp1, ts);
+ Assert.assertEquals(timestamp2, ts);
}
}
@@ -107,7 +107,7 @@ public class MicroSecondPrecisionRestfulTest {
Assert.assertEquals(timestamp2 % 1000_000l * 1000, nanos);
ts = rs.getLong(1);
- Assert.assertEquals(timestamp1, ts);
+ Assert.assertEquals(timestamp2, ts);
}
}
@@ -142,12 +142,21 @@ public class MicroSecondPrecisionRestfulTest {
}
@AfterClass
- public static void afterClass() throws SQLException {
- if (conn1 != null)
- conn1.close();
- if (conn2 != null)
- conn2.close();
- if (conn3 != null)
- conn3.close();
+ public static void afterClass() {
+ try {
+ if (conn1 != null) {
+ Statement statement = conn1.createStatement();
+ statement.execute("drop database if exists " + ms_timestamp_db);
+ statement.execute("drop database if exists " + us_timestamp_db);
+ statement.close();
+ conn1.close();
+ }
+ if (conn2 != null)
+ conn2.close();
+ if (conn3 != null)
+ conn3.close();
+ }catch (SQLException e){
+ e.printStackTrace();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiConnectionWithDifferentDbTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiConnectionWithDifferentDbTest.java
index 0bf8334079e630bf61b7955a37c74401da24a947..220ac0e7ce023229c1e897b9125a4ebb2cae3687 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiConnectionWithDifferentDbTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/MultiConnectionWithDifferentDbTest.java
@@ -1,5 +1,6 @@
package com.taosdata.jdbc.cases;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -90,4 +91,16 @@ public class MultiConnectionWithDifferentDbTest {
}
}
+ @After
+ public void after() {
+ String url = "jdbc:TAOS-RS://" + host + ":6041/?user=root&password=taosdata";
+ try (Connection connection = DriverManager.getConnection(url);
+ Statement statement = connection.createStatement()) {
+ statement.execute("drop database if exists " + db1);
+ statement.execute("drop database if exists " + db2);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampJNITest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampJNITest.java
index a84f5233974e9bd9acdbbe3ca8ae0404c11b34a1..c85c6f95a93df565cd5ff8eca91c0beeac3b3c02 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampJNITest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampJNITest.java
@@ -1,9 +1,6 @@
package com.taosdata.jdbc.cases;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
import java.sql.*;
import java.time.Instant;
@@ -83,9 +80,9 @@ public class NanoSecondTimestampJNITest {
// then
long actual = rs.getLong(1);
- Assert.assertEquals(ms, actual);
+ Assert.assertEquals(ns, actual);
actual = rs.getLong("ts");
- Assert.assertEquals(ms, actual);
+ Assert.assertEquals(ns, actual);
}
@Test
@@ -160,4 +157,18 @@ public class NanoSecondTimestampJNITest {
}
}
+ @AfterClass
+ public static void afterClass(){
+ try {
+ if (null != conn){
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
+ conn.close();
+ }
+ }catch (SQLException e){
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampRestfulTest.java
index c8aaf5c6788d18e782e431ba4ed97fb69f4702ab..796f21ed21bb69e952042e89f61e0eb98fcf4273 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampRestfulTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NanoSecondTimestampRestfulTest.java
@@ -1,9 +1,6 @@
package com.taosdata.jdbc.cases;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
import java.sql.*;
import java.time.Instant;
@@ -83,9 +80,9 @@ public class NanoSecondTimestampRestfulTest {
// then
long actual = rs.getLong(1);
- Assert.assertEquals(ms, actual);
+ Assert.assertEquals(ns, actual);
actual = rs.getLong("ts");
- Assert.assertEquals(ms, actual);
+ Assert.assertEquals(ns, actual);
}
@Test
@@ -160,4 +157,14 @@ public class NanoSecondTimestampRestfulTest {
}
}
+ @AfterClass
+ public static void afterClass() throws SQLException {
+ if (conn != null){
+ try (Statement stmt = conn.createStatement()) {
+ stmt.execute("drop database if exists " + dbname);
+ }
+ conn.close();
+ }
+ }
+
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetJNITest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetJNITest.java
index 6efd9f5ebee29a122c2106439117738c44241597..8bbc2fe077a1292b24ee7cb67158620c96f9a605 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetJNITest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetJNITest.java
@@ -45,7 +45,11 @@ public class NullValueInResultSetJNITest {
@After
public void after() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists test_null");
+ statement.close();
conn.close();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetRestfulTest.java
index f331a58583db832124465492d07f24f1772348ce..08f641b96e86398d72d9ab42ccaed57e2227ecdc 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetRestfulTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetRestfulTest.java
@@ -47,7 +47,11 @@ public class NullValueInResultSetRestfulTest {
@After
public void after() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists test_null");
+ statement.close();
conn.close();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetTest.java
index 61d767b5cf2bcd2e478de74e5f4bb8d66ad21678..890505ac65cf02deb85dd362ebd700291317e849 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/NullValueInResultSetTest.java
@@ -85,7 +85,11 @@ public class NullValueInResultSetTest {
public static void afterClass() throws SQLException {
if (conn_restful != null)
conn_restful.close();
- if (conn_jni != null)
+ if (conn_jni != null) {
+ Statement statement = conn_jni.createStatement();
+ statement.execute("drop database if exists test_null");
+ statement.close();
conn_jni.close();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java
index 2d336135e5d1dc28db010387ab838f17d9b9a9cc..76053ccc41895fcdc00ffe9da2252bf63313894e 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java
@@ -62,8 +62,12 @@ public class TimestampPrecisionInNanoInJniTest {
@AfterClass
public static void afterClass() {
try {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + ns_timestamp_db);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
@@ -83,7 +87,7 @@ public class TimestampPrecisionInNanoInJniTest {
int nanos = rs.getTimestamp(1).getNanos();
Assert.assertEquals(ts % 1000_000_000l, nanos);
long test_ts = rs.getLong(1);
- Assert.assertEquals(ts / 1000_000l, test_ts);
+ Assert.assertEquals(ts, test_ts);
}
@Test
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisonInNanoRestTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisonInNanoRestTest.java
index cfd6a066acc2c2abd94e525fb69d4027a317134c..4aedf867d408536fde6896e01f61ef13873d1624 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisonInNanoRestTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisonInNanoRestTest.java
@@ -62,8 +62,12 @@ public class TimestampPrecisonInNanoRestTest {
@AfterClass
public static void afterClass() {
try {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + ns_timestamp_db);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
@@ -83,7 +87,7 @@ public class TimestampPrecisonInNanoRestTest {
int nanos = rs.getTimestamp(1).getNanos();
Assert.assertEquals(ts % 1000_000_000l, nanos);
long test_ts = rs.getLong(1);
- Assert.assertEquals(ts / 1000_000l, test_ts);
+ Assert.assertEquals(ts, test_ts);
}
@Test
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java
index 0be6b90e7a9b5e1e7707b88c1c60d2751b7d245b..cff353093aca6772e96a88f1083bc428a49ab9b2 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberJniTest.java
@@ -156,8 +156,12 @@ public class UnsignedNumberJniTest {
@AfterClass
public static void afterClass() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists unsign_jni");
+ statement.close();
conn.close();
+ }
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java
index 842dbfeff8478115df93b48cfe29fe376c4cff05..b3ca6871db7cbf0888737856e66d236c4cc80d49 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UnsignedNumberRestfulTest.java
@@ -14,6 +14,7 @@ public class UnsignedNumberRestfulTest {
private static final String host = "127.0.0.1";
private static Connection conn;
private static long ts;
+ private static final String dbname = "unsign_restful";
@Test
public void testCase001() throws SQLException {
@@ -148,9 +149,9 @@ public class UnsignedNumberRestfulTest {
final String url = "jdbc:TAOS-RS://" + host + ":6041/?user=root&password=taosdata";
conn = DriverManager.getConnection(url, properties);
Statement stmt = conn.createStatement();
- stmt.execute("drop database if exists unsign_restful");
- stmt.execute("create database if not exists unsign_restful");
- stmt.execute("use unsign_restful");
+ stmt.execute("drop database if exists " + dbname);
+ stmt.execute("create database if not exists " + dbname);
+ stmt.execute("use " + dbname);
stmt.execute("create table us_table(ts timestamp, f1 tinyint unsigned, f2 smallint unsigned, f3 int unsigned, f4 bigint unsigned)");
stmt.executeUpdate("insert into us_table(ts,f1,f2,f3,f4) values(" + ts + ", 127, 32767,2147483647, 9223372036854775807)");
stmt.close();
@@ -162,8 +163,12 @@ public class UnsignedNumberRestfulTest {
@AfterClass
public static void afterClass() {
try {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UseNowInsertTimestampTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UseNowInsertTimestampTest.java
index 2e0448bc248bb2a962466e632443d4e6d918ab9f..c4f2cba446e6138679ae9f8b8efff3666c056deb 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UseNowInsertTimestampTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/UseNowInsertTimestampTest.java
@@ -1,5 +1,6 @@
package com.taosdata.jdbc.cases;
+import org.junit.AfterClass;
import org.junit.Test;
import java.sql.*;
@@ -8,7 +9,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class UseNowInsertTimestampTest {
- String url = "jdbc:TAOS://127.0.0.1:6030/?user=root&password=taosdata";
+ private static String url = "jdbc:TAOS://127.0.0.1:6030/?user=root&password=taosdata";
@Test
public void millisec() throws SQLException {
@@ -55,13 +56,14 @@ public class UseNowInsertTimestampTest {
@Test
public void nanosec() throws SQLException {
+ long now_time = System.currentTimeMillis() * 1000_000L + System.nanoTime() % 1000_000L;
try (Connection conn = DriverManager.getConnection(url)) {
Statement stmt = conn.createStatement();
stmt.execute("drop database if exists test");
stmt.execute("create database if not exists test precision 'ns'");
stmt.execute("use test");
stmt.execute("create table weather(ts timestamp, f1 int)");
- stmt.execute("insert into weather values(now, 1)");
+ stmt.execute("insert into weather values(" + now_time + ", 1)");
ResultSet rs = stmt.executeQuery("select * from weather");
rs.next();
@@ -74,4 +76,15 @@ public class UseNowInsertTimestampTest {
stmt.execute("drop database if exists test");
}
}
+
+ @AfterClass
+ public static void afterClass() {
+ try (Connection conn = DriverManager.getConnection(url);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute("drop database if exists test");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ }
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BadLocaleSettingTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BadLocaleSettingTest.java
index bbf71349b85c7bdc51fde30f293c7cd724de3699..7ad7c23136f8e24b0c7139e97fb4b46c04a98abb 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BadLocaleSettingTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BadLocaleSettingTest.java
@@ -45,7 +45,11 @@ public class BadLocaleSettingTest {
@AfterClass
public static void afterClass() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database " + dbName);
+ statement.close();
conn.close();
+ }
}
}
\ No newline at end of file
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BatchFetchTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BatchFetchTest.java
index e8c799e86c61c6b4a7cb8b3396c6c3e09548ee0e..94a5382410ba05c1fbf3afb4f8bb73d6c5271c3a 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BatchFetchTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/BatchFetchTest.java
@@ -79,4 +79,15 @@ public class BatchFetchTest {
}
return builder.toString();
}
+
+ @AfterClass
+ public static void afterClass(){
+ String url = "jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata";
+ try (Connection conn = DriverManager.getConnection(url);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute("drop database if exists test");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/CharsetTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/CharsetTest.java
index e28faeb280a9f9f9ae931e7b610910fb912278b3..41629189aea4658514bd317c90bc055340397a23 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/CharsetTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/CharsetTest.java
@@ -1,6 +1,7 @@
package com.taosdata.jdbc.confprops;
import com.taosdata.jdbc.TSDBDriver;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
@@ -37,4 +38,18 @@ public class CharsetTest {
}
}
+ @AfterClass
+ public static void afterClass(){
+ String url = "jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata";
+ Properties props = new Properties();
+ props.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
+
+ try (Connection conn = DriverManager.getConnection(url, props);
+ Statement stmt = conn.createStatement()) {
+ stmt.execute("drop database if exists test");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimeZoneTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimeZoneTest.java
index 6569aa5f085f5d389144a9e8ddc0787786f9fff3..bc19e63ba6e05c8170366de4375148ebde0138d0 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimeZoneTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimeZoneTest.java
@@ -29,7 +29,7 @@ public class TimeZoneTest {
}
@Test
- public void taosTimeZone() {
+ public void taosTimeZone() throws SQLException {
// given
Properties props = new Properties();
props.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
@@ -39,7 +39,7 @@ public class TimeZoneTest {
Statement stmt = connection.createStatement();
stmt.execute("drop database if exists timezone_test");
- stmt.execute("create database if not exists timezone_test keep 365000");
+ stmt.execute("create database if not exists timezone_test keep 36500");
stmt.execute("use timezone_test");
stmt.execute("create table weather(ts timestamp, temperature float)");
@@ -51,7 +51,7 @@ public class TimeZoneTest {
System.out.println("ts: " + ts.getTime() + "," + ts);
}
- stmt.execute("insert into timezone_test.weather(ts, temperature, humidity) values('1970-01-02 00:00:00', 1.0, 2.0)");
+ stmt.execute("insert into timezone_test.weather(ts, temperature) values('1970-01-02 00:00:00', 1.0)");
rs = stmt.executeQuery("select * from timezone_test.weather");
while (rs.next()) {
@@ -63,8 +63,6 @@ public class TimeZoneTest {
stmt.execute("drop database if exists timezone_test");
stmt.close();
- } catch (SQLException e) {
- e.printStackTrace();
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimestampFormatTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimestampFormatTest.java
index 7e3701c153fa3f45852dd1a5860cf30910dc906d..a6f8cf7c0ad79d1a046a5075f05f6930ea1d19ce 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimestampFormatTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/confprops/TimestampFormatTest.java
@@ -1,17 +1,17 @@
package com.taosdata.jdbc.confprops;
import com.taosdata.jdbc.TSDBDriver;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.*;
import java.sql.*;
import java.time.Instant;
+import java.util.Calendar;
import java.util.Properties;
public class TimestampFormatTest {
private static final String host = "127.0.0.1";
private long ts = Instant.now().toEpochMilli();
+ private Connection conn;
@Test
public void string() throws SQLException {
@@ -154,13 +154,27 @@ public class TimestampFormatTest {
@Before
public void before() throws SQLException {
String url = "jdbc:TAOS-RS://" + host + ":6041/?user=root&password=taosdata";
- try (Connection conn = DriverManager.getConnection(url);
- Statement stmt = conn.createStatement()) {
- stmt.execute("drop database if exists test");
- stmt.execute("create database if not exists test");
- stmt.execute("use test");
- stmt.execute("create table weather(ts timestamp, temperature nchar(10))");
- stmt.execute("insert into weather values(" + ts + ", '北京')");
+ conn = DriverManager.getConnection(url);
+ Statement stmt = conn.createStatement();
+ stmt.execute("drop database if exists test");
+ stmt.execute("create database if not exists test");
+ stmt.execute("use test");
+ stmt.execute("create table weather(ts timestamp, temperature nchar(10))");
+ stmt.execute("insert into weather values(" + ts + ", '北京')");
+ stmt.close();
+ }
+
+ @After
+ public void after() {
+ try {
+ if (null != conn) {
+ Statement stmt = conn.createStatement();
+ stmt.execute("drop database if exists test");
+ stmt.close();
+ conn.close();
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
}
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/DatabaseSpecifiedTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/DatabaseSpecifiedTest.java
index 9fe51e7203fac7133783e47fd5b0cc07f33b2494..0a37e255a4ac8e8db2b07fc915ab7ba6dd54397c 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/DatabaseSpecifiedTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/DatabaseSpecifiedTest.java
@@ -33,7 +33,6 @@ public class DatabaseSpecifiedTest {
String loc = rs.getString("loc");
assertEquals("beijing", loc);
}
- connection.close();
}
@Before
@@ -59,8 +58,12 @@ public class DatabaseSpecifiedTest {
@After
public void after() {
try {
- if (connection != null)
+ if (connection != null) {
+ Statement statement = connection.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
connection.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulConnectionTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulConnectionTest.java
index e7ce1d76f123a043d49eb64931c0d537d09664df..e4785a197e659977ae22745e14e664fd803464f7 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulConnectionTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulConnectionTest.java
@@ -383,8 +383,12 @@ public class RestfulConnectionTest {
@AfterClass
public static void afterClass() throws SQLException {
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists test");
+ statement.close();
conn.close();
+ }
}
}
\ No newline at end of file
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulParameterMetaDataTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulParameterMetaDataTest.java
index 81d7f5b56c4b4e67b9573522ee031006a7e11a2b..c8ca1a5de7ac870c01d248a8b042cffefa4857b7 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulParameterMetaDataTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulParameterMetaDataTest.java
@@ -18,6 +18,7 @@ public class RestfulParameterMetaDataTest {
private static PreparedStatement pstmt_select;
private static ParameterMetaData parameterMetaData_insert;
private static ParameterMetaData parameterMetaData_select;
+ private static final String dbname = "test_pstmt";
@Test
public void getParameterCount() throws SQLException {
@@ -148,9 +149,9 @@ public class RestfulParameterMetaDataTest {
Class.forName("com.taosdata.jdbc.rs.RestfulDriver");
conn = DriverManager.getConnection("jdbc:TAOS-RS://" + host + ":6041/?user=root&password=taosdata");
try (Statement stmt = conn.createStatement()) {
- stmt.execute("drop database if exists test_pstmt");
- stmt.execute("create database if not exists test_pstmt");
- stmt.execute("use test_pstmt");
+ stmt.execute("drop database if exists " + dbname);
+ stmt.execute("create database if not exists " + dbname);
+ stmt.execute("use " + dbname);
stmt.execute("create table weather(ts timestamp, f1 int, f2 bigint, f3 float, f4 double, f5 smallint, f6 tinyint, f7 bool, f8 binary(64), f9 nchar(64)) tags(loc nchar(64))");
stmt.execute("create table t1 using weather tags('beijing')");
}
@@ -186,8 +187,12 @@ public class RestfulParameterMetaDataTest {
pstmt_insert.close();
if (pstmt_select != null)
pstmt_select.close();
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java
index 4760a723e4b4e662326987290c2c630803f8f470..40d0e0214fe1016df8d42e9dfd8d31472165c798 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulPreparedStatementTest.java
@@ -400,8 +400,12 @@ public class RestfulPreparedStatementTest {
pstmt_select.close();
if (pstmt_without_parameters != null)
pstmt_without_parameters.close();
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists test_pstmt");
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetMetaDataTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetMetaDataTest.java
index f3011af799c987ed399920875ae512fd8533ec77..6e5851474f2697022eef5dc62be3f69ca5878df9 100644
--- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetMetaDataTest.java
+++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulResultSetMetaDataTest.java
@@ -15,6 +15,7 @@ public class RestfulResultSetMetaDataTest {
private static Statement stmt;
private static ResultSet rs;
private static ResultSetMetaData meta;
+ private static final String dbname = "restful_test";
@Test
public void getColumnCount() throws SQLException {
@@ -206,8 +207,12 @@ public class RestfulResultSetMetaDataTest {
rs.close();
if (stmt != null)
stmt.close();
- if (conn != null)
+ if (conn != null) {
+ Statement statement = conn.createStatement();
+ statement.execute("drop database if exists " + dbname);
+ statement.close();
conn.close();
+ }
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/connector/nodejs/nodetaos/cinterface.js b/src/connector/nodejs/nodetaos/cinterface.js
index fa0eb20055df38c2a8092637e30ae807e473fa30..2403ffa4c68ca9571f2ec583fa263765208bfb2b 100644
--- a/src/connector/nodejs/nodetaos/cinterface.js
+++ b/src/connector/nodejs/nodetaos/cinterface.js
@@ -14,7 +14,12 @@ const _ = require('lodash')
const TaosObjects = require('./taosobjects');
module.exports = CTaosInterface;
-
+const TAOSFIELD = {
+ NAME_LENGTH: 65,
+ TYPE_OFFSET: 65,
+ BYTES_OFFSET: 66,
+ STRUCT_SIZE: 68,
+}
function convertTimestamp(data, num_of_rows, nbytes = 0, offset = 0, precision = 0) {
data = ref.reinterpret(data.deref(), nbytes * num_of_rows, offset);
let res = [];
@@ -195,6 +200,24 @@ function convertNchar(data, num_of_rows, nbytes = 0, offset = 0, precision = 0)
return res;
}
+function convertJsonTag(data, num_of_rows, nbytes = 0, offset = 0, precision = 0) {
+ data = ref.reinterpret(data.deref(), nbytes * num_of_rows, offset);
+ let res = [];
+
+ let currOffset = 0;
+ while (currOffset < data.length) {
+ let len = data.readIntLE(currOffset, 2);
+ let dataEntry = data.slice(currOffset + 2, currOffset + len + 2); //one entry in a row under a column;
+ if (dataEntry[0] == 255 && dataEntry[1] == 255) {
+ res.push(null)
+ } else {
+ res.push(dataEntry.toString("utf-8"));
+ }
+ currOffset += nbytes;
+ }
+ return res;
+}
+
// Object with all the relevant converters from pblock data to javascript readable data
let convertFunctions = {
[FieldTypes.C_BOOL]: convertBool,
@@ -210,7 +233,8 @@ let convertFunctions = {
[FieldTypes.C_TINYINT_UNSIGNED]: convertTinyintUnsigned,
[FieldTypes.C_SMALLINT_UNSIGNED]: convertSmallintUnsigned,
[FieldTypes.C_INT_UNSIGNED]: convertIntUnsigned,
- [FieldTypes.C_BIGINT_UNSIGNED]: convertBigintUnsigned
+ [FieldTypes.C_BIGINT_UNSIGNED]: convertBigintUnsigned,
+ [FieldTypes.C_JSON_TAG]: convertJsonTag,
}
// Define TaosField structure
@@ -219,8 +243,8 @@ var TaosField = Struct({
'name': char_arr,
});
TaosField.fields.name.type.size = 65;
-TaosField.defineProperty('type', ref.types.char);
-TaosField.defineProperty('bytes', ref.types.short);
+TaosField.defineProperty('type', ref.types.uint8);
+TaosField.defineProperty('bytes', ref.types.int16);
//define schemaless line array
var smlLine = ArrayType(ref.coerceType('char *'))
@@ -390,14 +414,14 @@ CTaosInterface.prototype.useResult = function useResult(result) {
let fields = [];
let pfields = this.fetchFields(result);
+
if (ref.isNull(pfields) == false) {
- pfields = ref.reinterpret(pfields, this.fieldsCount(result) * 68, 0);
- for (let i = 0; i < pfields.length; i += 68) {
- //0 - 63 = name //64 - 65 = bytes, 66 - 67 = type
+ pfields = ref.reinterpret(pfields, this.fieldsCount(result) * TAOSFIELD.STRUCT_SIZE, 0);
+ for (let i = 0; i < pfields.length; i += TAOSFIELD.STRUCT_SIZE) {
fields.push({
- name: ref.readCString(ref.reinterpret(pfields, 65, i)),
- type: pfields[i + 65],
- bytes: pfields[i + 66]
+ name: ref.readCString(ref.reinterpret(pfields, TAOSFIELD.NAME_LENGTH, i)),
+ type: pfields[i + TAOSFIELD.TYPE_OFFSET],
+ bytes: pfields[i + TAOSFIELD.BYTES_OFFSET] + pfields[i + TAOSFIELD.BYTES_OFFSET + 1] * 256
})
}
}
@@ -532,13 +556,12 @@ CTaosInterface.prototype.fetchFields_a = function fetchFields_a(result) {
let pfieldscount = this.numFields(result);
let fields = [];
if (ref.isNull(pfields) == false) {
- pfields = ref.reinterpret(pfields, 68 * pfieldscount, 0);
- for (let i = 0; i < pfields.length; i += 68) {
- //0 - 64 = name //65 = type, 66 - 67 = bytes
+ pfields = ref.reinterpret(pfields, pfieldscount * TAOSFIELD.STRUCT_SIZE, 0);
+ for (let i = 0; i < pfields.length; i += TAOSFIELD.STRUCT_SIZE) {
fields.push({
- name: ref.readCString(ref.reinterpret(pfields, 65, i)),
- type: pfields[i + 65],
- bytes: pfields[i + 66]
+ name: ref.readCString(ref.reinterpret(pfields, TAOSFIELD.NAME_LENGTH, i)),
+ type: pfields[i + TAOSFIELD.TYPE_OFFSET],
+ bytes: pfields[i + TAOSFIELD.BYTES_OFFSET] + pfields[i + TAOSFIELD.BYTES_OFFSET + 1] * 256
})
}
}
@@ -594,13 +617,12 @@ CTaosInterface.prototype.consume = function consume(subscription) {
let fields = [];
let pfields = this.fetchFields(result);
if (ref.isNull(pfields) == false) {
- pfields = ref.reinterpret(pfields, this.numFields(result) * 68, 0);
- for (let i = 0; i < pfields.length; i += 68) {
- //0 - 63 = name //64 - 65 = bytes, 66 - 67 = type
+ pfields = ref.reinterpret(pfields, this.numFields(result) * TAOSFIELD.STRUCT_SIZE, 0);
+ for (let i = 0; i < pfields.length; i += TAOSFIELD.STRUCT_SIZE) {
fields.push({
- name: ref.readCString(ref.reinterpret(pfields, 64, i)),
- bytes: pfields[i + 64],
- type: pfields[i + 66]
+ name: ref.readCString(ref.reinterpret(pfields, TAOSFIELD.NAME_LENGTH, i)),
+ bytes: pfields[TAOSFIELD.TYPE_OFFSET],
+ type: pfields[i + TAOSFIELD.BYTES_OFFSET] + pfields[i + TAOSFIELD.BYTES_OFFSET + 1] * 256
})
}
}
@@ -684,23 +706,23 @@ CTaosInterface.prototype.closeStream = function closeStream(stream) {
* @returns TAOS_RES
*
*/
-CTaosInterface.prototype.schemalessInsert = function schemalessInsert(connection,lines, protocal, precision) {
+CTaosInterface.prototype.schemalessInsert = function schemalessInsert(connection, lines, protocal, precision) {
let _numLines = null;
let _lines = null;
-
- if(_.isString(lines)){
+
+ if (_.isString(lines)) {
_numLines = 1;
_lines = Buffer.alloc(_numLines * ref.sizeof.pointer);
- ref.set(_lines,0,ref.allocCString(lines),ref.types.char_ptr);
+ ref.set(_lines, 0, ref.allocCString(lines), ref.types.char_ptr);
}
- else if(_.isArray(lines)){
+ else if (_.isArray(lines)) {
_numLines = lines.length;
_lines = Buffer.alloc(_numLines * ref.sizeof.pointer);
- for(let i = 0; i < _numLines ; i++){
- ref.set(_lines,i*ref.sizeof.pointer,ref.allocCString(lines[i]),ref.types.char_ptr)
+ for (let i = 0; i < _numLines; i++) {
+ ref.set(_lines, i * ref.sizeof.pointer, ref.allocCString(lines[i]), ref.types.char_ptr)
}
}
- else{
+ else {
throw new errors.InterfaceError("Unsupport lines input")
}
return this.libtaos.taos_schemaless_insert(connection, _lines, _numLines, protocal, precision);
diff --git a/src/connector/nodejs/nodetaos/constants.js b/src/connector/nodejs/nodetaos/constants.js
index 551cfce71677fbd6635a76884474e1b1aeac7ab9..b055e0ed01522348556475fa72e8bf34a9d3fe70 100644
--- a/src/connector/nodejs/nodetaos/constants.js
+++ b/src/connector/nodejs/nodetaos/constants.js
@@ -6,13 +6,13 @@ const SCHEMALESS_PROTOCOL = {
TSDB_SML_JSON_PROTOCOL: 3
}
const SCHEMALESS_PRECISION = {
- TSDB_SML_TIMESTAMP_NOT_CONFIGURED : 0,
- TSDB_SML_TIMESTAMP_HOURS : 1,
- TSDB_SML_TIMESTAMP_MINUTES : 2,
- TSDB_SML_TIMESTAMP_SECONDS : 3,
- TSDB_SML_TIMESTAMP_MILLI_SECONDS : 4,
- TSDB_SML_TIMESTAMP_MICRO_SECONDS : 5,
- TSDB_SML_TIMESTAMP_NANO_SECONDS : 6
+ TSDB_SML_TIMESTAMP_NOT_CONFIGURED: 0,
+ TSDB_SML_TIMESTAMP_HOURS: 1,
+ TSDB_SML_TIMESTAMP_MINUTES: 2,
+ TSDB_SML_TIMESTAMP_SECONDS: 3,
+ TSDB_SML_TIMESTAMP_MILLI_SECONDS: 4,
+ TSDB_SML_TIMESTAMP_MICRO_SECONDS: 5,
+ TSDB_SML_TIMESTAMP_NANO_SECONDS: 6
}
const typeCodesToName = {
0: 'Null',
@@ -30,6 +30,7 @@ const typeCodesToName = {
12: 'Smallint Unsigned',
13: 'Int Unsigned',
14: 'Bigint Unsigned',
+ 15: 'Json',
}
/**
@@ -80,6 +81,7 @@ module.exports = {
C_SMALLINT_UNSIGNED: 12,
C_INT_UNSIGNED: 13,
C_BIGINT_UNSIGNED: 14,
+ C_JSON_TAG: 15,
// NULL value definition
// NOTE: These values should change according to C definition in tsdb.h
C_BOOL_NULL: 2,
diff --git a/src/connector/nodejs/nodetaos/taosresult.js b/src/connector/nodejs/nodetaos/taosresult.js
index 4138ebbec6e1b792691d17a25b7c18d35b6a922a..1ea5abee9f6c3c2754081ad82ecdb51c3b5bd4d3 100644
--- a/src/connector/nodejs/nodetaos/taosresult.js
+++ b/src/connector/nodejs/nodetaos/taosresult.js
@@ -29,19 +29,19 @@ function TaosResult(data, fields) {
TaosResult.prototype.pretty = function pretty() {
let fieldsStr = "";
let sizing = [];
- this.fields.forEach((field,i) => {
- if (field._field.type == 8 || field._field.type == 10){
+ this.fields.forEach((field, i) => {
+ if (field._field.type == 8 || field._field.type == 10 ) {
sizing.push(Math.max(field.name.length, field._field.bytes));
}
else {
sizing.push(Math.max(field.name.length, suggestedMinWidths[field._field.type]));
}
- fieldsStr += fillEmpty(Math.floor(sizing[i]/2 - field.name.length / 2)) + field.name + fillEmpty(Math.ceil(sizing[i]/2 - field.name.length / 2)) + " | ";
+ fieldsStr += fillEmpty(Math.floor(sizing[i] / 2 - field.name.length / 2)) + field.name + fillEmpty(Math.ceil(sizing[i] / 2 - field.name.length / 2)) + " | ";
});
- var sumLengths = sizing.reduce((a,b)=> a+=b,(0)) + sizing.length * 3;
+ var sumLengths = sizing.reduce((a, b) => a += b, (0)) + sizing.length * 3;
console.log("\n" + fieldsStr);
- console.log(printN("=",sumLengths));
+ console.log(printN("=", sumLengths));
this.data.forEach(row => {
let rowStr = "";
row.data.forEach((entry, i) => {
@@ -62,16 +62,21 @@ const suggestedMinWidths = {
2: 4,
3: 6,
4: 11,
- 5: 12,
+ 5: 20,
6: 24,
7: 24,
8: 10,
9: 25,
10: 10,
+ 11: 4,
+ 12: 6,
+ 13: 11,
+ 14: 20,
+ 15: 20,
}
function printN(s, n) {
let f = "";
- for (let i = 0; i < n; i ++) {
+ for (let i = 0; i < n; i++) {
f += s;
}
return f;
diff --git a/src/connector/nodejs/package.json b/src/connector/nodejs/package.json
index d7eba48a463643dd293960251f6eebcb253d93c4..3d8dfc7e0135d8d5e8ba0eacf110d527f9e3f7bf 100644
--- a/src/connector/nodejs/package.json
+++ b/src/connector/nodejs/package.json
@@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
- "test": "node test/test.js && node test/testMicroseconds.js && node test/testNanoseconds.js && node test/testUnsignedType.js && node test/testSchemalessInsert.js "
+ "test": "node test/test.js && node test/testMicroseconds.js && node test/testNanoseconds.js && node test/testUnsignedType.js && node test/testSchemalessInsert.js && node test/testJsonTag.js"
},
"repository": {
"type": "git",
diff --git a/src/connector/nodejs/test/testJsonTag.js b/src/connector/nodejs/test/testJsonTag.js
new file mode 100644
index 0000000000000000000000000000000000000000..a922afb8e6b6614b208a6ba7cd82a8d00f983282
--- /dev/null
+++ b/src/connector/nodejs/test/testJsonTag.js
@@ -0,0 +1,280 @@
+const taos = require('../tdengine');
+var conn = taos.connect({ host: "127.0.0.1", user: "root", password: "taosdata", config: "/etc/taos", port: 10 });
+var c1 = conn.cursor();
+
+function executeUpdate(sql) {
+ console.log(sql);
+ c1.execute(sql);
+}
+function executeQuery(sql, flag = "all") {
+ console.log(sql);
+ c1.execute(sql)
+ var data = c1.fetchall();
+ if (flag == "metadata" || flag == "all") {
+ // Latest query's Field metadata is stored in cursor.fields
+ console.log(c1.fields);
+ } 2
+ if (flag == "data" || flag == "all") {
+ // Latest query's result data is stored in cursor.data, also returned by fetchall.
+ console.log(c1.data);
+ }
+ console.log("");
+}
+
+function prettyQuery(sql) {
+ try {
+ c1.query(sql).execute().then(function (result) {
+ result.pretty();
+ });
+ }
+ catch (err) {
+ conn.close();
+ throw err;
+ }
+}
+
+function executeError(sql) {
+ console.log(sql);
+ try {
+ c1.execute(sql)
+ } catch (e) {
+ console.log(e.message);
+ console.log("");
+ }
+}
+
+executeUpdate("create database if not exists nodedb keep 36500;");
+executeUpdate("use nodedb;");
+console.log("# STEP 1 prepare data & validate json string");
+executeUpdate("create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json);");
+executeUpdate("insert into jsons1_1 using jsons1 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 1, false, 'json1', '涛思数据') (1591060608000, 23, true, '涛思数据', 'json')");
+executeUpdate("insert into jsons1_2 using jsons1 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060628000, 2, true, 'json2', 'sss')");
+executeUpdate("insert into jsons1_3 using jsons1 tags('{\"tag1\":false,\"tag2\":\"beijing\"}') values (1591060668000, 3, false, 'json3', 'efwe')");
+executeUpdate("insert into jsons1_4 using jsons1 tags('{\"tag1\":null,\"tag2\":\"shanghai\",\"tag3\":\"hello\"}') values (1591060728000, 4, true, 'json4', '323sd')");
+executeUpdate("insert into jsons1_5 using jsons1 tags('{\"tag1\":1.232, \"tag2\":null}') values(1591060928000, 1, false, '涛思数据', 'ewe')");
+executeUpdate("insert into jsons1_6 using jsons1 tags('{\"tag1\":11,\"tag2\":\"\",\"tag2\":null}') values(1591061628000, 11, false, '涛思数据','')");
+executeUpdate("insert into jsons1_7 using jsons1 tags('{\"tag1\":\"涛思数据\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '涛思数据', 'dws')");
+
+console.log("## test duplicate key using the first one. elimate empty key");
+executeUpdate("CREATE TABLE if not exists jsons1_8 using jsons1 tags('{\"tag1\":null, \"tag1\":true, \"tag1\":45, \"1tag$\":2, \" \":90}')");
+
+console.log("## test empty json string, save as jtag is NULL");
+executeUpdate("insert into jsons1_9 using jsons1 tags('\t') values (1591062328000, 24, NULL, '涛思数据', '2sdw')");
+executeUpdate("CREATE TABLE if not exists jsons1_10 using jsons1 tags('')");
+executeUpdate("CREATE TABLE if not exists jsons1_11 using jsons1 tags(' ')");
+executeUpdate("CREATE TABLE if not exists jsons1_12 using jsons1 tags('{}')");
+executeUpdate("CREATE TABLE if not exists jsons1_13 using jsons1 tags('null')");
+
+console.log("## test invalidate json");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('\"efwewf\"')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('3333')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('33.33')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('false')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('[1,true]')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{222}')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"fe\"}')");
+executeQuery("select * from jsons1;", "data");
+
+console.log("## test invalidate json key, key must can be printed assic char=");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":[1,true]}')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"tag1\":{}}')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"。loc\":\"fff\"}')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\":\"fff\"}')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\t\":\"fff\"}')");
+executeError("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"涛思数据\":\"fff\"}')");
+
+console.log("# STEP 2 alter table json tag");
+executeError("ALTER STABLE jsons1 add tag tag2 nchar(20)");
+executeError("ALTER STABLE jsons1 drop tag jtag");
+executeError("ALTER TABLE jsons1_1 SET TAG jtag=4");
+executeUpdate("ALTER TABLE jsons1_1 SET TAG jtag='{\"tag1\":\"femail\",\"tag2\":35,\"tag3\":true}'")
+
+console.log("# STEP 3 query table");
+console.log("## test error syntax");
+executeError("select * from jsons1 where jtag->tag1='beijing'");
+executeError("select * from jsons1 where jtag->'location'");
+executeError("select * from jsons1 where jtag->''");
+executeError("select * from jsons1 where jtag->''=9");
+executeError("select -> from jsons1");
+executeError("select * from jsons1 where contains");
+executeError("select * from jsons1 where jtag->");
+executeError("select jtag->location from jsons1");
+executeError("select jtag contains location from jsons1");
+executeError("select * from jsons1 where jtag contains location");
+executeError("select * from jsons1 where jtag contains''");
+executeError("select * from jsons1 where jtag contains 'location'='beijing'");
+
+console.log("## test select normal column");
+executeQuery("select dataint from jsons1");
+
+console.log("## test select json tag");
+executeQuery("select * from jsons1", "data")
+executeQuery("select jtag from jsons1", "data");
+executeQuery("select jtag from jsons1 where jtag is null", "data");
+executeQuery("select jtag from jsons1 where jtag is not null", "data");
+executeQuery("select jtag from jsons1_8", "data");
+executeQuery("select jtag from jsons1_1", "data");
+
+console.log("## test jtag is NULL");
+executeQuery("select jtag from jsons1_9", "data");
+
+console.log("## test select json tag->'key', value is string");
+executeQuery("select jtag->'tag1' from jsons1_1", "data");
+executeQuery("select jtag->'tag2' from jsons1_6", "data");
+
+console.log("### test select json tag->'key', value is int");
+executeQuery("select jtag->'tag2' from jsons1_1", "data");
+
+console.log("### test select json tag->'key', value is bool");
+executeQuery("select jtag->'tag3' from jsons1_1", "data");
+
+console.log("### test select json tag->'key', value is null");
+executeQuery("select jtag->'tag1' from jsons1_4", "data");
+
+console.log("### test select json tag->'key', value is double");
+executeQuery("select jtag->'tag1' from jsons1_5", "data");
+
+console.log("### test select json tag->'key', key is not exist");
+executeQuery("select jtag->'tag10' from jsons1_4", "data");
+executeQuery("select jtag->'tag1' from jsons1", "data");
+
+console.log("### test header name");
+executeQuery("select jtag->'tag1' from jsons1", "metadata");
+
+console.log("## test where with json tag");
+executeError("select * from jsons1_1 where jtag is not null");
+executeError("select * from jsons1 where jtag='{\"tag1\":11,\"tag2\":\"\"}'");
+executeError("select * from jsons1 where jtag->'tag1'={}");
+
+console.log("### where json value is string");
+executeQuery("select * from jsons1 where jtag->'tag2'='beijing'", "data");
+executeQuery("select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'");
+executeQuery("select * from jsons1 where jtag->'tag1'='beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'='涛思数据'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2'>'beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2'>='beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2'<'beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2'<='beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2'!='beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2'=''", "data");
+
+console.log("### where json value is int");
+executeQuery("select * from jsons1 where jtag->'tag1'=5", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=10", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'<54", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'<=11", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'>4", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'>=5", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'!=5", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'!=55", "data");
+
+console.log("### where json value is double");
+executeQuery("select * from jsons1 where jtag->'tag1'=1.232", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'<1.232", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'<=1.232", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'>1.23", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'>=1.232", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'!=1.232", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'!=3.232", "data");
+executeError("select * from jsons1 where jtag->'tag1'/0=3", "data");
+executeError("select * from jsons1 where jtag->'tag1'/5=1", "data");
+
+console.log("### where json value is bool");
+executeQuery("select * from jsons1 where jtag->'tag1'=true", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=false", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'!=false", "data");
+executeError("select * from jsons1 where jtag->'tag1'>false");
+
+console.log("### where json value is null");
+executeQuery("select * from jsons1 where jtag->'tag1'=null"); //only json suport =null. This synatx will change later.
+
+console.log("### where json is null");
+executeQuery("select * from jsons1 where jtag is null", "data");
+executeQuery("select * from jsons1 where jtag is not null", "data");
+
+console.log("### where json key is null");
+executeQuery("select * from jsons1 where jtag->'tag_no_exist'=3", "data")
+
+console.log("### where json value is not exist");
+executeQuery("select * from jsons1 where jtag->'tag1' is null", "data");
+executeQuery("select * from jsons1 where jtag->'tag4' is null", "data");
+executeQuery("select * from jsons1 where jtag->'tag3' is not null", "data")
+
+console.log("### test contains");
+executeQuery("select * from jsons1 where jtag contains 'tag1'", "data")
+executeQuery("select * from jsons1 where jtag contains 'tag3'", "data")
+executeQuery("select * from jsons1 where jtag contains 'tag_no_exist'", "data")
+
+console.log("### test json tag in where condition with and/or");
+executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35", "data");
+executeQuery("select * from jsons1 where jtag->'tag1' is not null and jtag contains 'tag3'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1'='femail' and jtag contains 'tag3'", "data");
+
+console.log("### test with tbname/normal column");
+executeQuery("select * from jsons1 where tbname = 'jsons1_1'", "data")
+executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3'", "data")
+executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=3", "data")
+executeQuery("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=23", "data")
+
+console.log("### test where condition like");
+executeQuery("select *,tbname from jsons1 where jtag->'tag2' like 'bei%'", "data");
+executeQuery("select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null", "data");
+
+console.log("### test where condition in no support in");
+executeError("select * from jsons1 where jtag->'tag1' in ('beijing')");
+
+console.log("### test where condition match");
+executeQuery("select * from jsons1 where jtag->'tag1' match 'ma'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1' match 'ma$'", "data");
+executeQuery("select * from jsons1 where jtag->'tag2' match 'jing$'", "data");
+executeQuery("select * from jsons1 where jtag->'tag1' match '收到'", "data");
+
+console.log("### test distinct");
+executeUpdate("insert into jsons1_14 using jsons1 tags('{\"tag1\":\"涛思数据\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '涛思数据', 'dws')", "data");
+executeQuery("select distinct jtag->'tag1' from jsons1", "data");
+executeQuery("select distinct jtag from jsons1", "data");
+
+console.log("### test dumplicate key with normal colomn");
+executeUpdate("INSERT INTO jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"datastr\":\"涛思数据\"}') values(1591060828000, 4, false, 'jjsf', \"涛思数据\")");
+executeQuery("select *,tbname,jtag from jsons1 where jtag->'datastr' match '涛思' and datastr match 'js'", "data");
+executeQuery("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'", "data");
+
+console.log("## test join");
+executeUpdate("create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
+executeUpdate("insert into jsons2_1 using jsons2 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 2, false, 'json2', '你是2')")
+executeUpdate("insert into jsons2_2 using jsons2 tags('{\"tag1\":5,\"tag2\":null}') values (1591060628000, 2, true, 'json2', 'sss')")
+executeUpdate("create table if not exists jsons3(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)")
+executeUpdate("insert into jsons3_1 using jsons3 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 3, false, 'json3', '你是3')")
+executeUpdate("insert into jsons3_2 using jsons3 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060638000, 2, true, 'json3', 'sss')")
+
+executeQuery("select 'sss',33,a.jtag->'tag3' from jsons2 a,jsons3 b where a.ts=b.ts and a.jtag->'tag1'=b.jtag->'tag1'", "data");
+executeQuery("select 'sss',33,a.jtag->'tag3' from jsons2 a,jsons3 b where a.ts=b.ts and a.jtag->'tag1'=b.jtag->'tag1'", "metadata");
+
+console.log("## test group by & order by json tag");
+
+executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc", "data");
+executeQuery("select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc", "data");
+
+console.log("## test stddev with group by json tag");
+executeQuery("select stddev(dataint) from jsons1 group by jtag->'tag1'", "data");
+executeQuery("select stddev(dataint) from jsons1 group by jsons1.jtag->'tag1'", "metadata");
+
+console.log("## test top/bottom with group by json tag");
+executeQuery("select top(dataint,100) from jsons1 group by jtag->'tag1'", "metadata");
+
+console.log("## subquery with json tag");
+executeQuery("select * from (select jtag, dataint from jsons1)", "metadata");
+executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)", "metadata");
+executeQuery("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)", "metada");
+executeQuery("select ts,tbname,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)", "data")
+
+
+executeUpdate("drop database nodedb;");
+
+
+setTimeout(() => conn.close(), 2000);
diff --git a/src/connector/nodejs/test/testNanoseconds.js b/src/connector/nodejs/test/testNanoseconds.js
index 85a7600b01f2c908f22e621488f22678083149ea..c3089aab3eaa4621b36297a70f2698dd08ed5988 100644
--- a/src/connector/nodejs/test/testNanoseconds.js
+++ b/src/connector/nodejs/test/testNanoseconds.js
@@ -3,7 +3,6 @@ var conn = taos.connect();
var c1 = conn.cursor();
let stime = new Date();
let interval = 1000;
-
function convertDateToTS(date) {
let tsArr = date.toISOString().split("T")
return "\"" + tsArr[0] + " " + tsArr[1].substring(0, tsArr[1].length - 1) + "\"";
diff --git a/src/connector/nodejs/test/testUnsignedType.js b/src/connector/nodejs/test/testUnsignedType.js
index 82413afebad0b75116fe3ea46e50716843d87c84..3f0b0c20459959fe7ea863757220ea77fe377694 100644
--- a/src/connector/nodejs/test/testUnsignedType.js
+++ b/src/connector/nodejs/test/testUnsignedType.js
@@ -1,15 +1,6 @@
const taos = require('../tdengine');
var conn = taos.connect({ host: "127.0.0.1", user: "root", password: "taosdata", config: "/etc/taos", port: 10 });
var c1 = conn.cursor();
-executeUpdate("create database nodedb;");
-executeUpdate("use nodedb;");
-executeUpdate("create table unsigntest(ts timestamp,ut tinyint unsigned,us smallint unsigned,ui int unsigned,ub bigint unsigned,bi bigint);");
-executeUpdate("insert into unsigntest values (now, 254,65534,4294967294,18446744073709551614,9223372036854775807);");
-executeUpdate("insert into unsigntest values (now, 0,0,0,0,-9223372036854775807);");
-executeQuery("select * from unsigntest;");
-executeUpdate("drop database nodedb;");
-
-
function executeUpdate(sql) {
console.log(sql);
c1.execute(sql);
@@ -22,5 +13,28 @@ function executeQuery(sql) {
// Latest query's result data is stored in cursor.data, also returned by fetchall.
console.log(c1.data);
}
+
+function prettyQuery(sql){
+ try {
+ c1.query(sql).execute().then(function(result){
+ result.pretty();
+ });
+ }
+ catch (err) {
+ conn.close();
+ throw err;
+ }
+}
+
+executeUpdate("create database nodedb;");
+executeUpdate("use nodedb;");
+executeUpdate("create table unsigntest(ts timestamp,ut tinyint unsigned,us smallint unsigned,ui int unsigned,ub bigint unsigned,bi bigint);");
+executeUpdate("insert into unsigntest values (now, 254,65534,4294967294,18446744073709551614,9223372036854775807);");
+executeUpdate("insert into unsigntest values (now, 0,0,0,0,-9223372036854775807);");
+executeQuery("select * from unsigntest;");
+prettyQuery("select * from unsigntest;");
+executeUpdate("drop database nodedb;");
+
+
setTimeout(()=>conn.close(),2000);
diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h
index 5d73f48eb6378573bbecc8261790a18a147f2133..7d721d21a0b85bb3e7119977f74f3e05e69cc361 100644
--- a/src/inc/ttokendef.h
+++ b/src/inc/ttokendef.h
@@ -16,7 +16,6 @@
#ifndef TDENGINE_TTOKENDEF_H
#define TDENGINE_TTOKENDEF_H
-
#define TK_ID 1
#define TK_BOOL 2
#define TK_TINYINT 3
@@ -139,12 +138,12 @@
#define TK_USING 120
#define TK_NULL 121
#define TK_NOW 122
-#define TK_SELECT 123
-#define TK_UNION 124
-#define TK_ALL 125
-#define TK_DISTINCT 126
-#define TK_FROM 127
-#define TK_VARIABLE 128
+#define TK_VARIABLE 123
+#define TK_SELECT 124
+#define TK_UNION 125
+#define TK_ALL 126
+#define TK_DISTINCT 127
+#define TK_FROM 128
#define TK_RANGE 129
#define TK_INTERVAL 130
#define TK_EVERY 131
@@ -219,7 +218,6 @@
#define TK_FILE 200
-
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_ILLEGAL 302
diff --git a/src/kit/taos-tools b/src/kit/taos-tools
index 78519c0c90a261b6a559c6bbe7f3d3b5a7b630b4..dca4059d87c3f5c678a5e946978d40daec204e27 160000
--- a/src/kit/taos-tools
+++ b/src/kit/taos-tools
@@ -1 +1 @@
-Subproject commit 78519c0c90a261b6a559c6bbe7f3d3b5a7b630b4
+Subproject commit dca4059d87c3f5c678a5e946978d40daec204e27
diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c
index 838aa577ae0fe396f3e80d2fca9066de10d3bc7a..fd6d60c034c702e12a5d996f5b130e54bf3c6a4f 100644
--- a/src/mnode/src/mnodeVgroup.c
+++ b/src/mnode/src/mnodeVgroup.c
@@ -298,7 +298,7 @@ void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t o
if (have) continue;
- if (pVgroup->status == TAOS_VG_STATUS_CREATING || pVgroup->status == TAOS_VG_STATUS_DROPPING) {
+ if (/*pVgroup->status == TAOS_VG_STATUS_CREATING ||*/ pVgroup->status == TAOS_VG_STATUS_DROPPING) {
mDebug("vgId:%d, not exist in dnode:%d and status is %s, do nothing", pVgroup->vgId, pDnode->dnodeId,
vgroupStatus[pVgroup->status]);
} else {
diff --git a/src/plugins/taosadapter b/src/plugins/taosadapter
index 88346a2e4e2e9282d2ec8b8c5264ca1ec23698a1..826f3d3b7820a5c007d301854d56db003b424d0a 160000
--- a/src/plugins/taosadapter
+++ b/src/plugins/taosadapter
@@ -1 +1 @@
-Subproject commit 88346a2e4e2e9282d2ec8b8c5264ca1ec23698a1
+Subproject commit 826f3d3b7820a5c007d301854d56db003b424d0a
diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y
index b435722d2093ce6434fe38f1af2f743885b46249..7f0ca21c7a616198cbbf9956d373b3712ecbe1ec 100644
--- a/src/query/inc/sql.y
+++ b/src/query/inc/sql.y
@@ -253,7 +253,7 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K
intitemlist(A) ::= intitemlist(X) COMMA intitem(Y). { A = tVariantListAppend(X, &Y, -1); }
intitemlist(A) ::= intitem(X). { A = tVariantListAppend(NULL, &X, -1); }
-intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
+intitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
%type keep {SArray*}
%destructor keep {taosArrayDestroy($$);}
@@ -438,39 +438,49 @@ column(A) ::= ids(X) typename(Y). {
tagitemlist(A) ::= tagitemlist(X) COMMA tagitem(Y). { A = tVariantListAppend(X, &Y, -1); }
tagitemlist(A) ::= tagitem(X). { A = tVariantListAppend(NULL, &X, -1); }
-tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
-tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
-tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
-tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X, true); }
-tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X, true); }
-tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X, true);}
+tagitem(A) ::= INTEGER(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
+tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
+tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
+tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); }
+tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); }
+tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreateExt(&A, &X, TK_NOW, true);}
+
+tagitem(A) ::= NOW PLUS VARIABLE(X).{
+ X.type = TSDB_DATA_TYPE_TIMESTAMP;
+ tVariantCreateExt(&A, &X, TK_PLUS, true);
+}
+
+tagitem(A) ::= NOW MINUS VARIABLE(X).{
+ X.type = TSDB_DATA_TYPE_TIMESTAMP;
+ tVariantCreateExt(&A, &X, TK_MINUS, true);
+}
tagitem(A) ::= MINUS(X) INTEGER(Y).{
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
- tVariantCreate(&A, &X, true);
+ tVariantCreate(&A, &X);
}
tagitem(A) ::= MINUS(X) FLOAT(Y). {
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
- tVariantCreate(&A, &X, true);
+ tVariantCreate(&A, &X);
}
tagitem(A) ::= PLUS(X) INTEGER(Y). {
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
- tVariantCreate(&A, &X, true);
+ tVariantCreate(&A, &X);
}
tagitem(A) ::= PLUS(X) FLOAT(Y). {
X.n += Y.n;
X.type = Y.type;
toTSDBType(X.type);
- tVariantCreate(&A, &X, true);
+ tVariantCreate(&A, &X);
}
//////////////////////// The SELECT statement /////////////////////////////////
@@ -609,7 +619,7 @@ fill_opt(N) ::= . { N = 0; }
fill_opt(N) ::= FILL LP ID(Y) COMMA tagitemlist(X) RP. {
tVariant A = {0};
toTSDBType(Y.type);
- tVariantCreate(&A, &Y, true);
+ tVariantCreate(&A, &Y);
tVariantListInsert(X, &A, -1, 0);
N = X;
@@ -652,12 +662,12 @@ sortlist(A) ::= arrow(Y) sortorder(Z). {
%type item {tVariant}
item(A) ::= ID(X). {
toTSDBType(X.type);
- tVariantCreate(&A, &X, true);
+ tVariantCreate(&A, &X);
}
item(A) ::= ID(X) DOT ID(Y). {
toTSDBType(X.type);
X.n += (1+Y.n);
- tVariantCreate(&A, &X, true);
+ tVariantCreate(&A, &X);
}
%type sortorder {int}
diff --git a/src/query/inc/tdigest.h b/src/query/inc/tdigest.h
index 625311eaabebec1f3d3b8303f34a361ba0129094..f9b615318f5c33f0cf386653367ddfe36ae759f8 100644
--- a/src/query/inc/tdigest.h
+++ b/src/query/inc/tdigest.h
@@ -29,7 +29,7 @@
#define DOUBLE_MAX 1.79e+308
#define ADDITION_CENTROID_NUM 2
-#define COMPRESSION 400
+#define COMPRESSION 300
#define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM)
#define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2))
#define TDIGEST_SIZE(compression) (sizeof(TDigest) + sizeof(SCentroid)*GET_CENTROID(compression) + sizeof(SPt)*GET_THRESHOLD(compression))
diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c
index 4c61cbb0f730780c6c7106a02c765974b2d21706..6a19ca5c8d1e0c7f30da30c37c24c008ea34b2ee 100644
--- a/src/query/src/qPlan.c
+++ b/src/query/src/qPlan.c
@@ -588,6 +588,12 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
op = OP_Fill;
taosArrayPush(plan, &op);
}
+ // outer query order by support
+ int32_t orderColId = pQueryAttr->order.orderColId;
+ if (pQueryAttr->vgId == 0 && orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX && orderColId != INT32_MIN) {
+ op = OP_Order;
+ taosArrayPush(plan, &op);
+ }
}
} else if (pQueryAttr->groupbyColumn) {
diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c
index f34f54710dfd259a338ad43e5d299eb0e6e2283d..166881346fb4bae0bcf97d0c325c52a03c44cb85 100644
--- a/src/query/src/qSqlParser.c
+++ b/src/query/src/qSqlParser.c
@@ -143,14 +143,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr
if (optrType == TK_NULL) {
if (pToken){
pToken->type = TSDB_DATA_TYPE_NULL;
- tVariantCreate(&pSqlExpr->value, pToken, true);
+ tVariantCreate(&pSqlExpr->value, pToken);
}
pSqlExpr->tokenId = optrType;
pSqlExpr->type = SQL_NODE_VALUE;
} else if (optrType == TK_INTEGER || optrType == TK_STRING || optrType == TK_FLOAT || optrType == TK_BOOL) {
if (pToken) {
toTSDBType(pToken->type);
- tVariantCreate(&pSqlExpr->value, pToken, true);
+ tVariantCreate(&pSqlExpr->value, pToken);
}
pSqlExpr->tokenId = optrType;
pSqlExpr->type = SQL_NODE_VALUE;
@@ -211,7 +211,7 @@ tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType) {
if (optrType == TK_INTEGER || optrType == TK_STRING) {
if (pToken) {
toTSDBType(pToken->type);
- tVariantCreate(&pSqlExpr->value, pToken, true);
+ tVariantCreate(&pSqlExpr->value, pToken);
}
pSqlExpr->tokenId = optrType;
pSqlExpr->type = SQL_NODE_VALUE;
@@ -599,7 +599,7 @@ SArray *tVariantListAppendToken(SArray *pList, SStrToken *pToken, uint8_t order,
if (pToken) {
tVariantListItem item;
- tVariantCreate(&item.pVar, pToken, needRmquoteEscape);
+ tVariantCreateExt(&item.pVar, pToken, TK_ID, needRmquoteEscape);
item.sortOrder = order;
taosArrayPush(pList, &item);
diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c
index 2a2ccf9cae0f9e2aab60bddca7c27a8ceb719239..9bdb0efc4d3ed7769aa99ded02e460fe0624ae27 100644
--- a/src/query/src/queryMain.c
+++ b/src/query/src/queryMain.c
@@ -279,6 +279,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
if (isQueryKilled(pQInfo)) {
qDebug("QInfo:0x%"PRIx64" it is already killed, abort", pQInfo->qId);
+ setQueryKilled(pQInfo);
pQInfo->runtimeEnv.outputBuf = NULL;
return doBuildResCheck(pQInfo);
}
diff --git a/src/query/src/sql.c b/src/query/src/sql.c
index 0b8e9542742b9ab8b04d265c7cd6da0e482b7c92..c2d150911dc694ae6b9ab6e35f34207e86219a85 100644
--- a/src/query/src/sql.c
+++ b/src/query/src/sql.c
@@ -162,12 +162,12 @@
#define TK_USING 120
#define TK_NULL 121
#define TK_NOW 122
-#define TK_SELECT 123
-#define TK_UNION 124
-#define TK_ALL 125
-#define TK_DISTINCT 126
-#define TK_FROM 127
-#define TK_VARIABLE 128
+#define TK_VARIABLE 123
+#define TK_SELECT 124
+#define TK_UNION 125
+#define TK_ALL 126
+#define TK_DISTINCT 127
+#define TK_FROM 128
#define TK_RANGE 129
#define TK_INTERVAL 130
#define TK_EVERY 131
@@ -338,18 +338,18 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 390
-#define YYNRULE 313
-#define YYNRULE_WITH_ACTION 313
+#define YYNSTATE 393
+#define YYNRULE 315
+#define YYNRULE_WITH_ACTION 315
#define YYNTOKEN 201
-#define YY_MAX_SHIFT 389
-#define YY_MIN_SHIFTREDUCE 613
-#define YY_MAX_SHIFTREDUCE 925
-#define YY_ERROR_ACTION 926
-#define YY_ACCEPT_ACTION 927
-#define YY_NO_ACTION 928
-#define YY_MIN_REDUCE 929
-#define YY_MAX_REDUCE 1241
+#define YY_MAX_SHIFT 392
+#define YY_MIN_SHIFTREDUCE 617
+#define YY_MAX_SHIFTREDUCE 931
+#define YY_ERROR_ACTION 932
+#define YY_ACCEPT_ACTION 933
+#define YY_NO_ACTION 934
+#define YY_MIN_REDUCE 935
+#define YY_MAX_REDUCE 1249
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -416,94 +416,94 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (854)
+#define YY_ACTTAB_COUNT (858)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 102, 664, 664, 1158, 161, 1159, 311, 804, 260, 665,
- /* 10 */ 665, 807, 388, 241, 37, 38, 24, 41, 42, 1078,
- /* 20 */ 1070, 263, 31, 30, 29, 1083, 1215, 40, 343, 45,
- /* 30 */ 43, 46, 44, 1067, 1068, 55, 1071, 36, 35, 297,
- /* 40 */ 298, 34, 33, 32, 37, 38, 213, 41, 42, 250,
- /* 50 */ 84, 263, 31, 30, 29, 214, 1215, 40, 343, 45,
- /* 60 */ 43, 46, 44, 927, 389, 1215, 256, 36, 35, 211,
- /* 70 */ 215, 34, 33, 32, 292, 291, 128, 122, 133, 1215,
- /* 80 */ 1215, 1218, 1217, 132, 1069, 138, 141, 131, 37, 38,
- /* 90 */ 85, 41, 42, 977, 135, 263, 31, 30, 29, 664,
- /* 100 */ 196, 40, 343, 45, 43, 46, 44, 665, 339, 286,
- /* 110 */ 13, 36, 35, 1097, 101, 34, 33, 32, 37, 38,
+ /* 0 */ 102, 668, 668, 1166, 161, 1167, 312, 810, 260, 669,
+ /* 10 */ 669, 813, 391, 241, 37, 38, 24, 41, 42, 1084,
+ /* 20 */ 1076, 263, 31, 30, 29, 1089, 1223, 40, 344, 45,
+ /* 30 */ 43, 46, 44, 1073, 1074, 55, 1077, 36, 35, 298,
+ /* 40 */ 299, 34, 33, 32, 37, 38, 213, 41, 42, 250,
+ /* 50 */ 84, 263, 31, 30, 29, 214, 1223, 40, 344, 45,
+ /* 60 */ 43, 46, 44, 933, 392, 1223, 256, 36, 35, 211,
+ /* 70 */ 215, 34, 33, 32, 293, 292, 128, 122, 133, 1223,
+ /* 80 */ 1223, 1226, 1225, 132, 1075, 138, 141, 131, 37, 38,
+ /* 90 */ 85, 41, 42, 983, 135, 263, 31, 30, 29, 668,
+ /* 100 */ 196, 40, 344, 45, 43, 46, 44, 669, 340, 287,
+ /* 110 */ 13, 36, 35, 1105, 101, 34, 33, 32, 37, 38,
/* 120 */ 58, 41, 42, 60, 246, 263, 31, 30, 29, 220,
- /* 130 */ 285, 40, 343, 45, 43, 46, 44, 315, 97, 1215,
- /* 140 */ 96, 36, 35, 664, 104, 34, 33, 32, 339, 37,
- /* 150 */ 39, 665, 41, 42, 1097, 176, 263, 31, 30, 29,
- /* 160 */ 1106, 856, 40, 343, 45, 43, 46, 44, 34, 33,
- /* 170 */ 32, 244, 36, 35, 301, 221, 34, 33, 32, 206,
- /* 180 */ 204, 202, 376, 59, 51, 1215, 201, 148, 147, 146,
- /* 190 */ 145, 614, 615, 616, 617, 618, 619, 620, 621, 622,
- /* 200 */ 623, 624, 625, 626, 627, 159, 987, 242, 38, 277,
- /* 210 */ 41, 42, 59, 196, 263, 31, 30, 29, 281, 280,
- /* 220 */ 40, 343, 45, 43, 46, 44, 978, 222, 243, 1103,
- /* 230 */ 36, 35, 1081, 196, 34, 33, 32, 1215, 41, 42,
- /* 240 */ 384, 1015, 263, 31, 30, 29, 1, 184, 40, 343,
- /* 250 */ 45, 43, 46, 44, 387, 386, 641, 253, 36, 35,
- /* 260 */ 700, 1081, 34, 33, 32, 67, 337, 383, 382, 336,
- /* 270 */ 335, 334, 381, 333, 332, 331, 380, 330, 379, 378,
- /* 280 */ 1046, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042,
- /* 290 */ 1043, 1044, 1045, 1047, 1048, 234, 871, 25, 862, 860,
- /* 300 */ 865, 863, 1237, 866, 772, 59, 59, 769, 1207, 770,
- /* 310 */ 861, 771, 864, 1206, 219, 1205, 234, 871, 1215, 59,
- /* 320 */ 860, 227, 863, 1215, 866, 1215, 59, 144, 143, 142,
- /* 330 */ 226, 239, 240, 788, 351, 91, 5, 62, 186, 268,
- /* 340 */ 269, 3, 197, 185, 111, 116, 107, 115, 266, 91,
- /* 350 */ 254, 355, 239, 240, 1081, 1081, 345, 45, 43, 46,
- /* 360 */ 44, 59, 326, 271, 356, 36, 35, 785, 1081, 34,
- /* 370 */ 33, 32, 68, 1229, 67, 1080, 383, 382, 36, 35,
- /* 380 */ 47, 381, 34, 33, 32, 380, 68, 379, 378, 1054,
- /* 390 */ 259, 1052, 1053, 10, 293, 284, 1055, 83, 264, 1169,
- /* 400 */ 1056, 47, 1057, 1058, 235, 59, 357, 59, 59, 342,
- /* 410 */ 1081, 158, 156, 155, 748, 872, 867, 1097, 792, 59,
- /* 420 */ 130, 869, 868, 773, 774, 267, 100, 265, 59, 354,
- /* 430 */ 353, 341, 376, 870, 245, 294, 872, 867, 88, 237,
- /* 440 */ 273, 86, 270, 868, 361, 360, 366, 365, 262, 1215,
- /* 450 */ 358, 215, 362, 363, 1081, 238, 1081, 1081, 1156, 215,
- /* 460 */ 1157, 1215, 217, 1218, 364, 1215, 218, 105, 1081, 1215,
- /* 470 */ 6, 1218, 1215, 368, 223, 288, 1215, 1081, 836, 216,
- /* 480 */ 224, 225, 229, 230, 1215, 99, 231, 98, 228, 1215,
- /* 490 */ 1215, 1215, 1215, 1215, 212, 248, 1215, 89, 1215, 1084,
- /* 500 */ 272, 255, 257, 1072, 1215, 1084, 1084, 816, 817, 272,
- /* 510 */ 272, 182, 272, 296, 295, 813, 823, 824, 341, 76,
- /* 520 */ 183, 344, 79, 1082, 758, 318, 760, 320, 759, 163,
- /* 530 */ 71, 48, 54, 347, 288, 314, 835, 900, 60, 60,
- /* 540 */ 71, 103, 71, 873, 261, 348, 663, 15, 82, 14,
- /* 550 */ 282, 9, 121, 1168, 120, 346, 17, 9, 16, 251,
- /* 560 */ 9, 1165, 77, 80, 777, 321, 778, 19, 775, 18,
- /* 570 */ 776, 160, 127, 21, 126, 20, 140, 139, 1164, 252,
- /* 580 */ 747, 1105, 367, 26, 859, 1116, 1113, 178, 1114, 1118,
- /* 590 */ 162, 1098, 167, 289, 307, 1079, 179, 1148, 1077, 1147,
- /* 600 */ 1146, 1145, 180, 181, 992, 157, 323, 324, 325, 300,
- /* 610 */ 328, 329, 803, 169, 69, 209, 65, 340, 986, 352,
- /* 620 */ 1095, 247, 1236, 118, 302, 304, 81, 1235, 1232, 187,
- /* 630 */ 359, 78, 168, 316, 1228, 124, 1227, 1224, 188, 1012,
- /* 640 */ 28, 312, 172, 170, 171, 66, 61, 70, 210, 310,
- /* 650 */ 876, 974, 134, 308, 972, 136, 137, 970, 969, 306,
- /* 660 */ 274, 199, 299, 200, 966, 303, 965, 964, 963, 962,
- /* 670 */ 961, 960, 203, 205, 327, 956, 954, 952, 207, 27,
- /* 680 */ 949, 208, 945, 377, 129, 287, 87, 92, 305, 369,
- /* 690 */ 370, 371, 372, 373, 374, 236, 375, 258, 322, 385,
- /* 700 */ 925, 276, 924, 275, 232, 278, 279, 923, 173, 233,
- /* 710 */ 991, 990, 112, 906, 113, 905, 283, 288, 317, 11,
- /* 720 */ 290, 90, 968, 967, 780, 149, 959, 191, 190, 1013,
- /* 730 */ 189, 192, 193, 195, 194, 2, 52, 150, 1014, 4,
- /* 740 */ 1050, 151, 958, 951, 53, 152, 174, 177, 175, 950,
- /* 750 */ 93, 812, 74, 1060, 810, 809, 806, 805, 75, 166,
- /* 760 */ 814, 164, 249, 825, 165, 22, 819, 94, 63, 821,
- /* 770 */ 95, 309, 346, 313, 12, 64, 23, 49, 319, 50,
- /* 780 */ 104, 106, 109, 56, 108, 678, 713, 711, 710, 57,
- /* 790 */ 110, 709, 707, 706, 705, 702, 668, 338, 114, 7,
- /* 800 */ 897, 895, 875, 898, 874, 896, 8, 877, 350, 117,
- /* 810 */ 72, 60, 349, 119, 73, 123, 750, 125, 749, 746,
- /* 820 */ 694, 692, 684, 690, 686, 688, 682, 680, 716, 715,
- /* 830 */ 714, 712, 708, 704, 703, 198, 666, 631, 929, 928,
- /* 840 */ 928, 928, 928, 928, 928, 928, 928, 928, 928, 928,
- /* 850 */ 928, 928, 153, 154,
+ /* 130 */ 286, 40, 344, 45, 43, 46, 44, 316, 97, 1223,
+ /* 140 */ 96, 36, 35, 668, 104, 34, 33, 32, 340, 37,
+ /* 150 */ 39, 669, 41, 42, 1105, 176, 263, 31, 30, 29,
+ /* 160 */ 1114, 862, 40, 344, 45, 43, 46, 44, 34, 33,
+ /* 170 */ 32, 244, 36, 35, 302, 221, 34, 33, 32, 206,
+ /* 180 */ 204, 202, 379, 59, 51, 1223, 201, 148, 147, 146,
+ /* 190 */ 145, 618, 619, 620, 621, 622, 623, 624, 625, 626,
+ /* 200 */ 627, 628, 629, 630, 631, 159, 993, 242, 38, 278,
+ /* 210 */ 41, 42, 59, 196, 263, 31, 30, 29, 282, 281,
+ /* 220 */ 40, 344, 45, 43, 46, 44, 984, 222, 243, 1111,
+ /* 230 */ 36, 35, 1087, 196, 34, 33, 32, 1223, 41, 42,
+ /* 240 */ 387, 1021, 263, 31, 30, 29, 822, 823, 40, 344,
+ /* 250 */ 45, 43, 46, 44, 390, 389, 645, 253, 36, 35,
+ /* 260 */ 704, 1087, 34, 33, 32, 67, 338, 386, 385, 337,
+ /* 270 */ 336, 335, 384, 334, 333, 332, 383, 331, 382, 381,
+ /* 280 */ 1052, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048,
+ /* 290 */ 1049, 1050, 1051, 1053, 1054, 234, 877, 25, 1215, 866,
+ /* 300 */ 1164, 869, 1165, 872, 776, 59, 59, 773, 1223, 774,
+ /* 310 */ 868, 775, 871, 867, 219, 870, 234, 877, 59, 1245,
+ /* 320 */ 866, 227, 869, 1214, 872, 342, 266, 144, 143, 142,
+ /* 330 */ 226, 239, 240, 1223, 352, 91, 5, 62, 186, 268,
+ /* 340 */ 269, 259, 315, 185, 111, 116, 107, 115, 272, 59,
+ /* 350 */ 254, 356, 239, 240, 1087, 1087, 346, 45, 43, 46,
+ /* 360 */ 44, 67, 327, 386, 385, 36, 35, 1086, 384, 34,
+ /* 370 */ 33, 32, 383, 68, 382, 381, 100, 59, 264, 1060,
+ /* 380 */ 47, 1058, 1059, 36, 35, 1237, 1061, 34, 33, 32,
+ /* 390 */ 1062, 86, 1063, 1064, 357, 285, 343, 83, 1087, 59,
+ /* 400 */ 752, 47, 215, 267, 235, 265, 248, 355, 354, 59,
+ /* 410 */ 1090, 59, 1223, 294, 1226, 878, 873, 874, 342, 59,
+ /* 420 */ 59, 91, 358, 777, 270, 274, 1087, 271, 875, 364,
+ /* 430 */ 363, 876, 369, 368, 273, 262, 878, 873, 874, 215,
+ /* 440 */ 158, 156, 155, 255, 359, 182, 257, 1090, 1087, 1223,
+ /* 450 */ 1090, 1226, 1213, 237, 365, 130, 366, 6, 1087, 68,
+ /* 460 */ 1087, 238, 1223, 1223, 367, 371, 217, 379, 1087, 1087,
+ /* 470 */ 218, 1223, 223, 216, 224, 225, 1223, 1105, 105, 794,
+ /* 480 */ 1223, 229, 1223, 1223, 1223, 1223, 230, 273, 842, 231,
+ /* 490 */ 228, 1223, 791, 212, 245, 273, 1223, 88, 183, 1223,
+ /* 500 */ 1223, 273, 99, 1223, 98, 89, 345, 1, 184, 819,
+ /* 510 */ 3, 197, 1088, 829, 1078, 297, 296, 830, 76, 10,
+ /* 520 */ 762, 79, 319, 163, 764, 349, 321, 71, 763, 261,
+ /* 530 */ 54, 48, 348, 906, 60, 289, 60, 879, 71, 667,
+ /* 540 */ 103, 295, 71, 289, 1177, 82, 841, 9, 15, 1176,
+ /* 550 */ 14, 9, 251, 9, 347, 121, 17, 120, 16, 361,
+ /* 560 */ 360, 77, 80, 322, 783, 798, 784, 1173, 781, 865,
+ /* 570 */ 782, 19, 1172, 18, 127, 252, 126, 751, 21, 370,
+ /* 580 */ 20, 140, 139, 283, 160, 1113, 26, 1124, 1121, 1122,
+ /* 590 */ 1106, 290, 1126, 162, 1156, 167, 308, 1155, 1154, 1153,
+ /* 600 */ 178, 1085, 179, 1083, 180, 181, 998, 324, 157, 809,
+ /* 610 */ 325, 1103, 326, 301, 329, 330, 69, 209, 65, 341,
+ /* 620 */ 168, 169, 992, 247, 303, 317, 353, 305, 1244, 81,
+ /* 630 */ 882, 28, 118, 78, 1243, 1240, 170, 187, 171, 362,
+ /* 640 */ 313, 172, 311, 1236, 309, 124, 1235, 307, 1232, 173,
+ /* 650 */ 188, 1018, 66, 304, 61, 175, 70, 210, 980, 134,
+ /* 660 */ 978, 136, 300, 137, 976, 975, 275, 199, 200, 972,
+ /* 670 */ 971, 970, 969, 968, 967, 966, 203, 205, 962, 960,
+ /* 680 */ 958, 27, 207, 955, 208, 951, 328, 174, 288, 87,
+ /* 690 */ 92, 380, 306, 373, 129, 372, 374, 375, 236, 376,
+ /* 700 */ 258, 323, 377, 378, 388, 931, 276, 232, 277, 930,
+ /* 710 */ 233, 279, 997, 996, 112, 113, 280, 929, 912, 284,
+ /* 720 */ 911, 318, 289, 11, 90, 291, 786, 52, 974, 973,
+ /* 730 */ 1019, 191, 149, 189, 190, 192, 193, 195, 150, 194,
+ /* 740 */ 965, 2, 1056, 151, 964, 4, 152, 1020, 957, 53,
+ /* 750 */ 177, 956, 93, 818, 74, 816, 815, 812, 1066, 811,
+ /* 760 */ 75, 166, 820, 164, 249, 831, 165, 22, 825, 94,
+ /* 770 */ 63, 827, 95, 310, 347, 314, 12, 64, 49, 23,
+ /* 780 */ 320, 50, 104, 106, 56, 682, 108, 109, 57, 110,
+ /* 790 */ 717, 715, 714, 713, 711, 710, 709, 706, 672, 339,
+ /* 800 */ 114, 7, 903, 901, 881, 904, 880, 902, 8, 883,
+ /* 810 */ 350, 351, 72, 754, 780, 117, 119, 60, 73, 123,
+ /* 820 */ 125, 779, 753, 750, 698, 696, 688, 694, 690, 692,
+ /* 830 */ 686, 684, 720, 719, 718, 716, 712, 708, 707, 198,
+ /* 840 */ 670, 635, 935, 934, 934, 934, 934, 934, 934, 934,
+ /* 850 */ 934, 934, 934, 934, 934, 934, 153, 154,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 211, 1, 1, 279, 203, 281, 282, 5, 210, 9,
@@ -530,68 +530,68 @@ static const YYCODETYPE yy_lookahead[] = {
/* 210 */ 17, 18, 203, 216, 21, 22, 23, 24, 156, 157,
/* 220 */ 27, 28, 29, 30, 31, 32, 209, 271, 248, 272,
/* 230 */ 37, 38, 252, 216, 41, 42, 43, 281, 17, 18,
- /* 240 */ 225, 226, 21, 22, 23, 24, 212, 213, 27, 28,
+ /* 240 */ 225, 226, 21, 22, 23, 24, 130, 131, 27, 28,
/* 250 */ 29, 30, 31, 32, 69, 70, 71, 248, 37, 38,
/* 260 */ 5, 252, 41, 42, 43, 102, 103, 104, 105, 106,
/* 270 */ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
/* 280 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
- /* 290 */ 237, 238, 239, 240, 241, 1, 2, 48, 5, 5,
- /* 300 */ 7, 7, 253, 9, 2, 203, 203, 5, 271, 7,
- /* 310 */ 5, 9, 7, 271, 65, 271, 1, 2, 281, 203,
- /* 320 */ 5, 72, 7, 281, 9, 281, 203, 78, 79, 80,
- /* 330 */ 81, 37, 38, 41, 85, 86, 66, 67, 68, 37,
- /* 340 */ 38, 207, 208, 73, 74, 75, 76, 77, 72, 86,
+ /* 290 */ 237, 238, 239, 240, 241, 1, 2, 48, 271, 5,
+ /* 300 */ 279, 7, 281, 9, 2, 203, 203, 5, 281, 7,
+ /* 310 */ 5, 9, 7, 5, 65, 7, 1, 2, 203, 253,
+ /* 320 */ 5, 72, 7, 271, 9, 47, 72, 78, 79, 80,
+ /* 330 */ 81, 37, 38, 281, 85, 86, 66, 67, 68, 37,
+ /* 340 */ 38, 210, 64, 73, 74, 75, 76, 77, 72, 203,
/* 350 */ 248, 248, 37, 38, 252, 252, 41, 29, 30, 31,
- /* 360 */ 32, 203, 92, 72, 248, 37, 38, 101, 252, 41,
- /* 370 */ 42, 43, 123, 253, 102, 252, 104, 105, 37, 38,
- /* 380 */ 86, 109, 41, 42, 43, 113, 123, 115, 116, 227,
- /* 390 */ 210, 229, 230, 127, 276, 146, 234, 148, 210, 243,
- /* 400 */ 238, 86, 240, 241, 155, 203, 248, 203, 203, 25,
- /* 410 */ 252, 66, 67, 68, 5, 121, 122, 251, 126, 203,
- /* 420 */ 82, 128, 128, 121, 122, 149, 254, 151, 203, 153,
- /* 430 */ 154, 47, 94, 128, 268, 276, 121, 122, 87, 271,
- /* 440 */ 149, 269, 151, 128, 153, 154, 37, 38, 64, 281,
- /* 450 */ 248, 271, 248, 248, 252, 271, 252, 252, 279, 271,
- /* 460 */ 281, 281, 271, 283, 248, 281, 271, 211, 252, 281,
- /* 470 */ 86, 283, 281, 248, 271, 124, 281, 252, 80, 271,
- /* 480 */ 271, 271, 271, 271, 281, 279, 271, 281, 271, 281,
- /* 490 */ 281, 281, 281, 281, 271, 249, 281, 87, 281, 253,
- /* 500 */ 203, 249, 249, 247, 281, 253, 253, 130, 131, 203,
- /* 510 */ 203, 214, 203, 37, 38, 87, 87, 87, 47, 101,
- /* 520 */ 214, 214, 101, 214, 87, 87, 87, 87, 87, 101,
- /* 530 */ 101, 101, 86, 25, 124, 64, 138, 87, 101, 101,
- /* 540 */ 101, 101, 101, 87, 1, 16, 87, 150, 86, 152,
- /* 550 */ 203, 101, 150, 243, 152, 47, 150, 101, 152, 243,
- /* 560 */ 101, 243, 144, 142, 5, 119, 7, 150, 5, 152,
- /* 570 */ 7, 203, 150, 150, 152, 152, 82, 83, 243, 243,
- /* 580 */ 118, 203, 243, 270, 41, 203, 203, 255, 203, 203,
- /* 590 */ 203, 251, 203, 251, 203, 251, 203, 280, 203, 280,
- /* 600 */ 280, 280, 203, 203, 203, 64, 203, 203, 203, 275,
- /* 610 */ 203, 203, 128, 265, 203, 203, 203, 203, 203, 203,
- /* 620 */ 267, 275, 203, 203, 275, 275, 141, 203, 203, 203,
- /* 630 */ 203, 143, 266, 136, 203, 203, 203, 203, 203, 203,
- /* 640 */ 140, 139, 262, 264, 263, 203, 203, 203, 203, 134,
- /* 650 */ 121, 203, 203, 133, 203, 203, 203, 203, 203, 132,
- /* 660 */ 203, 203, 129, 203, 203, 135, 203, 203, 203, 203,
- /* 670 */ 203, 203, 203, 203, 93, 203, 203, 203, 203, 145,
- /* 680 */ 203, 203, 203, 117, 100, 205, 205, 205, 205, 99,
- /* 690 */ 55, 96, 98, 59, 97, 205, 95, 205, 205, 88,
- /* 700 */ 5, 5, 5, 158, 205, 158, 5, 5, 261, 205,
- /* 710 */ 215, 215, 211, 104, 211, 103, 147, 124, 119, 86,
- /* 720 */ 101, 125, 205, 205, 87, 206, 205, 218, 222, 224,
- /* 730 */ 223, 221, 219, 217, 220, 212, 86, 206, 226, 207,
- /* 740 */ 242, 206, 205, 205, 257, 206, 260, 256, 259, 205,
- /* 750 */ 101, 87, 101, 242, 128, 128, 5, 5, 86, 101,
- /* 760 */ 87, 86, 1, 87, 86, 137, 87, 86, 101, 87,
- /* 770 */ 86, 86, 47, 1, 86, 101, 137, 86, 119, 86,
- /* 780 */ 120, 82, 74, 91, 90, 5, 9, 5, 5, 91,
- /* 790 */ 90, 5, 5, 5, 5, 5, 89, 16, 82, 86,
- /* 800 */ 9, 9, 87, 9, 87, 9, 86, 121, 63, 152,
- /* 810 */ 17, 101, 28, 152, 17, 152, 5, 152, 5, 87,
- /* 820 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- /* 830 */ 5, 5, 5, 5, 5, 101, 89, 64, 0, 284,
- /* 840 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
- /* 850 */ 284, 284, 22, 22, 284, 284, 284, 284, 284, 284,
+ /* 360 */ 32, 102, 92, 104, 105, 37, 38, 252, 109, 41,
+ /* 370 */ 42, 43, 113, 124, 115, 116, 254, 203, 210, 227,
+ /* 380 */ 86, 229, 230, 37, 38, 253, 234, 41, 42, 43,
+ /* 390 */ 238, 269, 240, 241, 248, 146, 25, 148, 252, 203,
+ /* 400 */ 5, 86, 271, 149, 155, 151, 249, 153, 154, 203,
+ /* 410 */ 253, 203, 281, 276, 283, 121, 122, 123, 47, 203,
+ /* 420 */ 203, 86, 248, 121, 122, 149, 252, 151, 123, 153,
+ /* 430 */ 154, 123, 37, 38, 203, 64, 121, 122, 123, 271,
+ /* 440 */ 66, 67, 68, 249, 248, 214, 249, 253, 252, 281,
+ /* 450 */ 253, 283, 271, 271, 248, 82, 248, 86, 252, 124,
+ /* 460 */ 252, 271, 281, 281, 248, 248, 271, 94, 252, 252,
+ /* 470 */ 271, 281, 271, 271, 271, 271, 281, 251, 211, 41,
+ /* 480 */ 281, 271, 281, 281, 281, 281, 271, 203, 80, 271,
+ /* 490 */ 271, 281, 101, 271, 268, 203, 281, 87, 214, 281,
+ /* 500 */ 281, 203, 279, 281, 281, 87, 214, 212, 213, 87,
+ /* 510 */ 207, 208, 214, 87, 247, 37, 38, 87, 101, 128,
+ /* 520 */ 87, 101, 87, 101, 87, 16, 87, 101, 87, 1,
+ /* 530 */ 86, 101, 25, 87, 101, 125, 101, 87, 101, 87,
+ /* 540 */ 101, 276, 101, 125, 243, 86, 138, 101, 150, 243,
+ /* 550 */ 152, 101, 243, 101, 47, 150, 150, 152, 152, 37,
+ /* 560 */ 38, 144, 142, 119, 5, 127, 7, 243, 5, 41,
+ /* 570 */ 7, 150, 243, 152, 150, 243, 152, 118, 150, 243,
+ /* 580 */ 152, 82, 83, 203, 203, 203, 270, 203, 203, 203,
+ /* 590 */ 251, 251, 203, 203, 280, 203, 203, 280, 280, 280,
+ /* 600 */ 255, 251, 203, 203, 203, 203, 203, 203, 64, 123,
+ /* 610 */ 203, 267, 203, 275, 203, 203, 203, 203, 203, 203,
+ /* 620 */ 266, 265, 203, 275, 275, 136, 203, 275, 203, 141,
+ /* 630 */ 121, 140, 203, 143, 203, 203, 264, 203, 263, 203,
+ /* 640 */ 139, 262, 134, 203, 133, 203, 203, 132, 203, 261,
+ /* 650 */ 203, 203, 203, 135, 203, 259, 203, 203, 203, 203,
+ /* 660 */ 203, 203, 129, 203, 203, 203, 203, 203, 203, 203,
+ /* 670 */ 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
+ /* 680 */ 203, 145, 203, 203, 203, 203, 93, 260, 205, 205,
+ /* 690 */ 205, 117, 205, 55, 100, 99, 96, 98, 205, 59,
+ /* 700 */ 205, 205, 97, 95, 88, 5, 158, 205, 5, 5,
+ /* 710 */ 205, 158, 215, 215, 211, 211, 5, 5, 104, 147,
+ /* 720 */ 103, 119, 125, 86, 126, 101, 87, 86, 205, 205,
+ /* 730 */ 224, 218, 206, 223, 222, 221, 219, 217, 206, 220,
+ /* 740 */ 205, 212, 242, 206, 205, 207, 206, 226, 205, 257,
+ /* 750 */ 256, 205, 101, 87, 101, 123, 123, 5, 242, 5,
+ /* 760 */ 86, 101, 87, 86, 1, 87, 86, 137, 87, 86,
+ /* 770 */ 101, 87, 86, 86, 47, 1, 86, 101, 86, 137,
+ /* 780 */ 119, 86, 120, 82, 91, 5, 90, 74, 91, 90,
+ /* 790 */ 9, 5, 5, 5, 5, 5, 5, 5, 89, 16,
+ /* 800 */ 82, 86, 9, 9, 87, 9, 87, 9, 86, 121,
+ /* 810 */ 28, 63, 17, 5, 123, 152, 152, 101, 17, 152,
+ /* 820 */ 152, 123, 5, 87, 5, 5, 5, 5, 5, 5,
+ /* 830 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 101,
+ /* 840 */ 89, 64, 0, 284, 284, 284, 284, 284, 284, 284,
+ /* 850 */ 284, 284, 284, 284, 284, 284, 22, 22, 284, 284,
/* 860 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
/* 870 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
/* 880 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
@@ -611,119 +611,121 @@ static const YYCODETYPE yy_lookahead[] = {
/* 1020 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
/* 1030 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
/* 1040 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
- /* 1050 */ 284, 284, 284, 284, 284,
+ /* 1050 */ 284, 284, 284, 284, 284, 284, 284, 284, 284,
};
-#define YY_SHIFT_COUNT (389)
+#define YY_SHIFT_COUNT (392)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (838)
+#define YY_SHIFT_MAX (842)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 249, 163, 163, 272, 272, 60, 315, 294, 294, 294,
+ /* 0 */ 249, 163, 163, 259, 259, 60, 315, 294, 294, 294,
/* 10 */ 98, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 20 */ 1, 1, 48, 48, 0, 142, 294, 294, 294, 294,
/* 30 */ 294, 294, 294, 294, 294, 294, 294, 294, 294, 294,
/* 40 */ 294, 294, 294, 294, 294, 294, 294, 294, 302, 302,
- /* 50 */ 302, 263, 263, 377, 1, 20, 1, 1, 1, 1,
- /* 60 */ 1, 338, 60, 48, 48, 88, 88, 255, 854, 854,
- /* 70 */ 854, 302, 302, 302, 2, 2, 409, 409, 409, 409,
- /* 80 */ 409, 409, 409, 1, 1, 1, 292, 1, 1, 1,
- /* 90 */ 263, 263, 1, 1, 1, 1, 398, 398, 398, 398,
- /* 100 */ 266, 263, 1, 1, 1, 1, 1, 1, 1, 1,
+ /* 50 */ 302, 335, 335, 116, 1, 20, 1, 1, 1, 1,
+ /* 60 */ 1, 373, 60, 48, 48, 88, 88, 255, 858, 858,
+ /* 70 */ 858, 302, 302, 302, 2, 2, 395, 395, 395, 395,
+ /* 80 */ 395, 395, 395, 1, 1, 1, 438, 1, 1, 1,
+ /* 90 */ 335, 335, 1, 1, 1, 1, 408, 408, 408, 408,
+ /* 100 */ 391, 335, 1, 1, 1, 1, 1, 1, 1, 1,
/* 110 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 120 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 130 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 140 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 150 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- /* 160 */ 541, 541, 541, 484, 484, 484, 484, 541, 485, 488,
- /* 170 */ 497, 500, 502, 515, 520, 527, 530, 533, 534, 541,
- /* 180 */ 541, 541, 581, 581, 566, 60, 60, 541, 541, 584,
- /* 190 */ 590, 635, 595, 594, 634, 597, 601, 566, 255, 541,
- /* 200 */ 541, 611, 611, 541, 611, 541, 611, 541, 541, 854,
- /* 210 */ 854, 30, 74, 104, 104, 104, 135, 193, 221, 270,
- /* 220 */ 328, 328, 328, 328, 328, 328, 10, 113, 341, 341,
- /* 230 */ 341, 341, 276, 291, 384, 62, 24, 127, 127, 293,
- /* 240 */ 305, 185, 345, 22, 351, 410, 476, 428, 429, 430,
- /* 250 */ 471, 418, 421, 437, 438, 439, 440, 441, 446, 450,
- /* 260 */ 456, 508, 543, 529, 459, 397, 402, 406, 559, 563,
- /* 270 */ 417, 422, 462, 423, 494, 695, 545, 696, 697, 547,
- /* 280 */ 701, 702, 609, 612, 569, 593, 599, 633, 596, 637,
- /* 290 */ 650, 619, 649, 664, 651, 626, 627, 751, 752, 672,
- /* 300 */ 673, 675, 676, 678, 679, 658, 681, 682, 684, 761,
- /* 310 */ 685, 667, 628, 725, 772, 674, 639, 688, 599, 691,
- /* 320 */ 659, 693, 660, 699, 692, 694, 708, 780, 698, 700,
- /* 330 */ 777, 782, 783, 786, 787, 788, 789, 790, 707, 781,
- /* 340 */ 716, 791, 792, 713, 715, 717, 794, 796, 686, 720,
- /* 350 */ 784, 745, 793, 657, 661, 710, 710, 710, 710, 797,
- /* 360 */ 663, 665, 710, 710, 710, 811, 813, 732, 710, 815,
- /* 370 */ 816, 817, 818, 819, 820, 821, 822, 823, 824, 825,
- /* 380 */ 826, 827, 828, 829, 734, 747, 830, 831, 773, 838,
+ /* 160 */ 544, 544, 544, 486, 486, 486, 486, 544, 488, 490,
+ /* 170 */ 489, 491, 501, 508, 511, 515, 518, 533, 536, 544,
+ /* 180 */ 544, 544, 593, 593, 574, 60, 60, 544, 544, 594,
+ /* 190 */ 596, 638, 600, 599, 640, 605, 608, 574, 255, 544,
+ /* 200 */ 544, 616, 616, 544, 616, 544, 616, 544, 544, 858,
+ /* 210 */ 858, 30, 74, 104, 104, 104, 135, 193, 221, 270,
+ /* 220 */ 328, 328, 328, 328, 328, 328, 10, 113, 346, 346,
+ /* 230 */ 346, 346, 254, 276, 371, 62, 24, 127, 127, 305,
+ /* 240 */ 308, 185, 374, 22, 410, 418, 478, 422, 426, 430,
+ /* 250 */ 278, 417, 420, 433, 435, 437, 439, 441, 444, 446,
+ /* 260 */ 450, 507, 528, 509, 452, 398, 405, 406, 559, 563,
+ /* 270 */ 522, 421, 424, 459, 428, 499, 700, 548, 703, 704,
+ /* 280 */ 553, 711, 712, 614, 617, 572, 597, 602, 637, 598,
+ /* 290 */ 639, 641, 624, 651, 666, 653, 632, 633, 752, 754,
+ /* 300 */ 674, 675, 677, 678, 680, 681, 660, 683, 684, 686,
+ /* 310 */ 763, 687, 669, 630, 727, 774, 676, 642, 690, 602,
+ /* 320 */ 692, 661, 695, 662, 701, 693, 696, 713, 780, 697,
+ /* 330 */ 699, 781, 786, 787, 788, 789, 790, 791, 792, 709,
+ /* 340 */ 783, 718, 793, 794, 715, 717, 719, 796, 798, 688,
+ /* 350 */ 722, 782, 748, 795, 663, 664, 716, 716, 716, 716,
+ /* 360 */ 691, 698, 801, 667, 668, 716, 716, 716, 808, 817,
+ /* 370 */ 736, 716, 819, 820, 821, 822, 823, 824, 825, 826,
+ /* 380 */ 827, 828, 829, 830, 831, 832, 833, 738, 751, 834,
+ /* 390 */ 835, 777, 842,
};
#define YY_REDUCE_COUNT (210)
#define YY_REDUCE_MIN (-276)
-#define YY_REDUCE_MAX (544)
+#define YY_REDUCE_MAX (546)
static const short yy_reduce_ofst[] = {
- /* 0 */ -138, 53, 53, 162, 162, -211, -202, 180, 188, -201,
- /* 10 */ -199, -20, 9, 102, 103, 116, 158, 202, 204, 205,
- /* 20 */ 216, 225, -276, -141, -43, -191, -255, -225, -216, -142,
- /* 30 */ -96, -44, 37, 42, 44, 168, 184, 191, 195, 203,
- /* 40 */ 208, 209, 210, 211, 212, 215, 217, 223, 246, 252,
- /* 50 */ 253, -97, 166, -103, -184, 256, 297, 306, 307, 309,
- /* 60 */ 123, -116, -161, 179, 206, -3, 17, 15, 172, 34,
- /* 70 */ 134, -228, 49, 120, 118, 159, 156, 310, 316, 318,
- /* 80 */ 335, 336, 339, 347, 368, 378, 313, 382, 383, 385,
- /* 90 */ 340, 342, 386, 387, 389, 391, 317, 319, 320, 321,
- /* 100 */ 332, 344, 393, 395, 399, 400, 401, 403, 404, 405,
- /* 110 */ 407, 408, 411, 412, 413, 414, 415, 416, 419, 420,
- /* 120 */ 424, 425, 426, 427, 431, 432, 433, 434, 435, 436,
- /* 130 */ 442, 443, 444, 445, 448, 449, 451, 452, 453, 454,
- /* 140 */ 455, 457, 458, 460, 461, 463, 464, 465, 466, 467,
- /* 150 */ 468, 469, 470, 472, 473, 474, 475, 477, 478, 479,
- /* 160 */ 480, 481, 482, 334, 346, 349, 350, 483, 353, 366,
- /* 170 */ 348, 379, 381, 380, 447, 486, 489, 487, 491, 490,
- /* 180 */ 492, 493, 495, 496, 498, 501, 503, 499, 504, 505,
- /* 190 */ 507, 506, 509, 510, 513, 514, 516, 511, 512, 517,
- /* 200 */ 518, 519, 531, 521, 535, 537, 539, 538, 544, 523,
- /* 210 */ 532,
+ /* 0 */ -138, 53, 53, 152, 152, -211, -202, 131, 168, -201,
+ /* 10 */ -199, -20, 9, 102, 103, 146, 174, 196, 206, 208,
+ /* 20 */ 216, 217, -276, -141, -43, -191, -255, -225, -216, -142,
+ /* 30 */ -96, -44, 27, 52, 181, 182, 190, 195, 199, 201,
+ /* 40 */ 202, 203, 204, 210, 215, 218, 219, 222, 157, 194,
+ /* 50 */ 197, -97, 226, -103, -184, 267, 231, 284, 292, 298,
+ /* 60 */ 115, -116, -161, 21, 223, -3, 17, 15, 122, 295,
+ /* 70 */ 303, -228, 66, 132, 137, 265, 301, 306, 309, 324,
+ /* 80 */ 329, 332, 336, 380, 381, 382, 316, 384, 385, 386,
+ /* 90 */ 339, 340, 389, 390, 392, 393, 314, 317, 318, 319,
+ /* 100 */ 345, 350, 399, 400, 401, 402, 403, 404, 407, 409,
+ /* 110 */ 411, 412, 413, 414, 415, 416, 419, 423, 425, 429,
+ /* 120 */ 431, 432, 434, 436, 440, 442, 443, 445, 447, 448,
+ /* 130 */ 449, 451, 453, 454, 455, 456, 457, 458, 460, 461,
+ /* 140 */ 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ /* 150 */ 472, 473, 474, 475, 476, 477, 479, 480, 481, 482,
+ /* 160 */ 483, 484, 485, 338, 348, 349, 352, 487, 344, 354,
+ /* 170 */ 356, 372, 375, 379, 388, 427, 396, 492, 494, 493,
+ /* 180 */ 495, 496, 497, 498, 500, 503, 504, 502, 505, 506,
+ /* 190 */ 510, 512, 513, 514, 517, 519, 520, 516, 521, 523,
+ /* 200 */ 524, 526, 532, 535, 537, 539, 540, 543, 546, 529,
+ /* 210 */ 538,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 926, 1049, 988, 1059, 975, 985, 1220, 1220, 1220, 1220,
- /* 10 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 20 */ 926, 926, 926, 926, 1107, 946, 926, 926, 926, 926,
- /* 30 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 40 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 50 */ 926, 926, 926, 1131, 926, 985, 926, 926, 926, 926,
- /* 60 */ 926, 995, 985, 926, 926, 995, 995, 926, 1102, 1033,
- /* 70 */ 1051, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 80 */ 926, 926, 926, 926, 926, 926, 1109, 1115, 1112, 926,
- /* 90 */ 926, 926, 1117, 926, 926, 926, 1153, 1153, 1153, 1153,
- /* 100 */ 1100, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 110 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 120 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 130 */ 926, 926, 926, 926, 973, 926, 971, 926, 926, 926,
- /* 140 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 150 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 944,
- /* 160 */ 948, 948, 948, 926, 926, 926, 926, 948, 1162, 1166,
- /* 170 */ 1143, 1160, 1154, 1138, 1136, 1134, 1142, 1127, 1170, 948,
- /* 180 */ 948, 948, 993, 993, 989, 985, 985, 948, 948, 1011,
- /* 190 */ 1009, 1007, 999, 1005, 1001, 1003, 997, 976, 926, 948,
- /* 200 */ 948, 983, 983, 948, 983, 948, 983, 948, 948, 1033,
- /* 210 */ 1051, 1219, 926, 1171, 1161, 1219, 926, 1202, 1201, 926,
- /* 220 */ 1210, 1209, 1208, 1200, 1199, 1198, 926, 926, 1194, 1197,
- /* 230 */ 1196, 1195, 926, 926, 1173, 926, 926, 1204, 1203, 926,
- /* 240 */ 926, 926, 926, 926, 926, 926, 1124, 926, 926, 926,
- /* 250 */ 1149, 1167, 1163, 926, 926, 926, 926, 926, 926, 926,
- /* 260 */ 926, 1174, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 270 */ 926, 926, 1061, 926, 926, 926, 926, 926, 926, 926,
- /* 280 */ 926, 926, 926, 926, 926, 1099, 926, 926, 926, 926,
- /* 290 */ 926, 1111, 1110, 926, 926, 926, 926, 926, 926, 926,
- /* 300 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 310 */ 926, 1155, 926, 1150, 926, 1144, 926, 926, 1073, 926,
- /* 320 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 330 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 340 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 350 */ 926, 926, 926, 926, 926, 1238, 1233, 1234, 1231, 926,
- /* 360 */ 926, 926, 1230, 1225, 1226, 926, 926, 926, 1223, 926,
- /* 370 */ 926, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- /* 380 */ 926, 926, 926, 926, 1017, 926, 955, 953, 926, 926,
+ /* 0 */ 932, 1055, 994, 1065, 981, 991, 1228, 1228, 1228, 1228,
+ /* 10 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 20 */ 932, 932, 932, 932, 1115, 952, 932, 932, 932, 932,
+ /* 30 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 40 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 50 */ 932, 932, 932, 1139, 932, 991, 932, 932, 932, 932,
+ /* 60 */ 932, 1001, 991, 932, 932, 1001, 1001, 932, 1110, 1039,
+ /* 70 */ 1057, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 80 */ 932, 932, 932, 932, 932, 932, 1117, 1123, 1120, 932,
+ /* 90 */ 932, 932, 1125, 932, 932, 932, 1161, 1161, 1161, 1161,
+ /* 100 */ 1108, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 110 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 120 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 130 */ 932, 932, 932, 932, 979, 932, 977, 932, 932, 932,
+ /* 140 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 150 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 950,
+ /* 160 */ 954, 954, 954, 932, 932, 932, 932, 954, 1170, 1174,
+ /* 170 */ 1151, 1168, 1162, 1146, 1144, 1142, 1150, 1135, 1178, 954,
+ /* 180 */ 954, 954, 999, 999, 995, 991, 991, 954, 954, 1017,
+ /* 190 */ 1015, 1013, 1005, 1011, 1007, 1009, 1003, 982, 932, 954,
+ /* 200 */ 954, 989, 989, 954, 989, 954, 989, 954, 954, 1039,
+ /* 210 */ 1057, 1227, 932, 1179, 1169, 1227, 932, 1210, 1209, 932,
+ /* 220 */ 1218, 1217, 1216, 1208, 1207, 1206, 932, 932, 1202, 1205,
+ /* 230 */ 1204, 1203, 932, 932, 1181, 932, 932, 1212, 1211, 932,
+ /* 240 */ 932, 932, 932, 932, 932, 932, 1132, 932, 932, 932,
+ /* 250 */ 1157, 1175, 1171, 932, 932, 932, 932, 932, 932, 932,
+ /* 260 */ 932, 1182, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 270 */ 1096, 932, 932, 1067, 932, 932, 932, 932, 932, 932,
+ /* 280 */ 932, 932, 932, 932, 932, 932, 1107, 932, 932, 932,
+ /* 290 */ 932, 932, 1119, 1118, 932, 932, 932, 932, 932, 932,
+ /* 300 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 310 */ 932, 932, 1163, 932, 1158, 932, 1152, 932, 932, 1079,
+ /* 320 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 330 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 340 */ 932, 932, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 350 */ 932, 932, 932, 932, 932, 932, 1246, 1241, 1242, 1239,
+ /* 360 */ 932, 932, 932, 932, 932, 1238, 1233, 1234, 932, 932,
+ /* 370 */ 932, 1231, 932, 932, 932, 932, 932, 932, 932, 932,
+ /* 380 */ 932, 932, 932, 932, 932, 932, 932, 1023, 932, 961,
+ /* 390 */ 959, 932, 932,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -866,12 +868,12 @@ static const YYCODETYPE yyFallback[] = {
0, /* USING => nothing */
1, /* NULL => ID */
1, /* NOW => ID */
+ 0, /* VARIABLE => nothing */
0, /* SELECT => nothing */
0, /* UNION => nothing */
1, /* ALL => ID */
0, /* DISTINCT => nothing */
0, /* FROM => nothing */
- 0, /* VARIABLE => nothing */
0, /* RANGE => nothing */
0, /* INTERVAL => nothing */
0, /* EVERY => nothing */
@@ -1155,12 +1157,12 @@ static const char *const yyTokenName[] = {
/* 120 */ "USING",
/* 121 */ "NULL",
/* 122 */ "NOW",
- /* 123 */ "SELECT",
- /* 124 */ "UNION",
- /* 125 */ "ALL",
- /* 126 */ "DISTINCT",
- /* 127 */ "FROM",
- /* 128 */ "VARIABLE",
+ /* 123 */ "VARIABLE",
+ /* 124 */ "SELECT",
+ /* 125 */ "UNION",
+ /* 126 */ "ALL",
+ /* 127 */ "DISTINCT",
+ /* 128 */ "FROM",
/* 129 */ "RANGE",
/* 130 */ "INTERVAL",
/* 131 */ "EVERY",
@@ -1485,157 +1487,159 @@ static const char *const yyRuleName[] = {
/* 159 */ "tagitem ::= BOOL",
/* 160 */ "tagitem ::= NULL",
/* 161 */ "tagitem ::= NOW",
- /* 162 */ "tagitem ::= MINUS INTEGER",
- /* 163 */ "tagitem ::= MINUS FLOAT",
- /* 164 */ "tagitem ::= PLUS INTEGER",
- /* 165 */ "tagitem ::= PLUS FLOAT",
- /* 166 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt",
- /* 167 */ "select ::= LP select RP",
- /* 168 */ "union ::= select",
- /* 169 */ "union ::= union UNION ALL select",
- /* 170 */ "cmd ::= union",
- /* 171 */ "select ::= SELECT selcollist",
- /* 172 */ "sclp ::= selcollist COMMA",
- /* 173 */ "sclp ::=",
- /* 174 */ "selcollist ::= sclp distinct expr as",
- /* 175 */ "selcollist ::= sclp STAR",
- /* 176 */ "as ::= AS ids",
- /* 177 */ "as ::= ids",
- /* 178 */ "as ::=",
- /* 179 */ "distinct ::= DISTINCT",
- /* 180 */ "distinct ::=",
- /* 181 */ "from ::= FROM tablelist",
- /* 182 */ "from ::= FROM sub",
- /* 183 */ "sub ::= LP union RP",
- /* 184 */ "sub ::= LP union RP ids",
- /* 185 */ "sub ::= sub COMMA LP union RP ids",
- /* 186 */ "tablelist ::= ids cpxName",
- /* 187 */ "tablelist ::= ids cpxName ids",
- /* 188 */ "tablelist ::= tablelist COMMA ids cpxName",
- /* 189 */ "tablelist ::= tablelist COMMA ids cpxName ids",
- /* 190 */ "tmvar ::= VARIABLE",
- /* 191 */ "timestamp ::= INTEGER",
- /* 192 */ "timestamp ::= MINUS INTEGER",
- /* 193 */ "timestamp ::= PLUS INTEGER",
- /* 194 */ "timestamp ::= STRING",
- /* 195 */ "timestamp ::= NOW",
- /* 196 */ "timestamp ::= NOW PLUS VARIABLE",
- /* 197 */ "timestamp ::= NOW MINUS VARIABLE",
- /* 198 */ "range_option ::=",
- /* 199 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP",
- /* 200 */ "interval_option ::= intervalKey LP tmvar RP",
- /* 201 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP",
- /* 202 */ "interval_option ::=",
- /* 203 */ "intervalKey ::= INTERVAL",
- /* 204 */ "intervalKey ::= EVERY",
- /* 205 */ "session_option ::=",
- /* 206 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP",
- /* 207 */ "windowstate_option ::=",
- /* 208 */ "windowstate_option ::= STATE_WINDOW LP ids RP",
- /* 209 */ "fill_opt ::=",
- /* 210 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
- /* 211 */ "fill_opt ::= FILL LP ID RP",
- /* 212 */ "sliding_opt ::= SLIDING LP tmvar RP",
- /* 213 */ "sliding_opt ::=",
- /* 214 */ "orderby_opt ::=",
- /* 215 */ "orderby_opt ::= ORDER BY sortlist",
- /* 216 */ "sortlist ::= sortlist COMMA item sortorder",
- /* 217 */ "sortlist ::= sortlist COMMA arrow sortorder",
- /* 218 */ "sortlist ::= item sortorder",
- /* 219 */ "sortlist ::= arrow sortorder",
- /* 220 */ "item ::= ID",
- /* 221 */ "item ::= ID DOT ID",
- /* 222 */ "sortorder ::= ASC",
- /* 223 */ "sortorder ::= DESC",
- /* 224 */ "sortorder ::=",
- /* 225 */ "groupby_opt ::=",
- /* 226 */ "groupby_opt ::= GROUP BY grouplist",
- /* 227 */ "grouplist ::= grouplist COMMA item",
- /* 228 */ "grouplist ::= grouplist COMMA arrow",
- /* 229 */ "grouplist ::= item",
- /* 230 */ "grouplist ::= arrow",
- /* 231 */ "having_opt ::=",
- /* 232 */ "having_opt ::= HAVING expr",
- /* 233 */ "limit_opt ::=",
- /* 234 */ "limit_opt ::= LIMIT signed",
- /* 235 */ "limit_opt ::= LIMIT signed OFFSET signed",
- /* 236 */ "limit_opt ::= LIMIT signed COMMA signed",
- /* 237 */ "slimit_opt ::=",
- /* 238 */ "slimit_opt ::= SLIMIT signed",
- /* 239 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
- /* 240 */ "slimit_opt ::= SLIMIT signed COMMA signed",
- /* 241 */ "where_opt ::=",
- /* 242 */ "where_opt ::= WHERE expr",
- /* 243 */ "expr ::= LP expr RP",
- /* 244 */ "expr ::= ID",
- /* 245 */ "expr ::= ID DOT ID",
- /* 246 */ "expr ::= ID DOT STAR",
- /* 247 */ "expr ::= INTEGER",
- /* 248 */ "expr ::= MINUS INTEGER",
- /* 249 */ "expr ::= PLUS INTEGER",
- /* 250 */ "expr ::= FLOAT",
- /* 251 */ "expr ::= MINUS FLOAT",
- /* 252 */ "expr ::= PLUS FLOAT",
- /* 253 */ "expr ::= STRING",
- /* 254 */ "expr ::= NOW",
- /* 255 */ "expr ::= VARIABLE",
- /* 256 */ "expr ::= PLUS VARIABLE",
- /* 257 */ "expr ::= MINUS VARIABLE",
- /* 258 */ "expr ::= BOOL",
- /* 259 */ "expr ::= NULL",
- /* 260 */ "expr ::= ID LP exprlist RP",
- /* 261 */ "expr ::= ID LP STAR RP",
- /* 262 */ "expr ::= ID LP expr AS typename RP",
- /* 263 */ "expr ::= expr IS NULL",
- /* 264 */ "expr ::= expr IS NOT NULL",
- /* 265 */ "expr ::= expr LT expr",
- /* 266 */ "expr ::= expr GT expr",
- /* 267 */ "expr ::= expr LE expr",
- /* 268 */ "expr ::= expr GE expr",
- /* 269 */ "expr ::= expr NE expr",
- /* 270 */ "expr ::= expr EQ expr",
- /* 271 */ "expr ::= expr BETWEEN expr AND expr",
- /* 272 */ "expr ::= expr AND expr",
- /* 273 */ "expr ::= expr OR expr",
- /* 274 */ "expr ::= expr PLUS expr",
- /* 275 */ "expr ::= expr MINUS expr",
- /* 276 */ "expr ::= expr STAR expr",
- /* 277 */ "expr ::= expr SLASH expr",
- /* 278 */ "expr ::= expr REM expr",
- /* 279 */ "expr ::= expr LIKE expr",
- /* 280 */ "expr ::= expr MATCH expr",
- /* 281 */ "expr ::= expr NMATCH expr",
- /* 282 */ "expr ::= ID CONTAINS STRING",
- /* 283 */ "expr ::= ID DOT ID CONTAINS STRING",
- /* 284 */ "arrow ::= ID ARROW STRING",
- /* 285 */ "arrow ::= ID DOT ID ARROW STRING",
- /* 286 */ "expr ::= arrow",
- /* 287 */ "expr ::= expr IN LP exprlist RP",
- /* 288 */ "exprlist ::= exprlist COMMA expritem",
- /* 289 */ "exprlist ::= expritem",
- /* 290 */ "expritem ::= expr",
- /* 291 */ "expritem ::=",
- /* 292 */ "cmd ::= RESET QUERY CACHE",
- /* 293 */ "cmd ::= SYNCDB ids REPLICA",
- /* 294 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
- /* 295 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
- /* 296 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist",
- /* 297 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
- /* 298 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
- /* 299 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
- /* 300 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
- /* 301 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist",
- /* 302 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
- /* 303 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
- /* 304 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist",
- /* 305 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
- /* 306 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
- /* 307 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
- /* 308 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem",
- /* 309 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist",
- /* 310 */ "cmd ::= KILL CONNECTION INTEGER",
- /* 311 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
- /* 312 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
+ /* 162 */ "tagitem ::= NOW PLUS VARIABLE",
+ /* 163 */ "tagitem ::= NOW MINUS VARIABLE",
+ /* 164 */ "tagitem ::= MINUS INTEGER",
+ /* 165 */ "tagitem ::= MINUS FLOAT",
+ /* 166 */ "tagitem ::= PLUS INTEGER",
+ /* 167 */ "tagitem ::= PLUS FLOAT",
+ /* 168 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt",
+ /* 169 */ "select ::= LP select RP",
+ /* 170 */ "union ::= select",
+ /* 171 */ "union ::= union UNION ALL select",
+ /* 172 */ "cmd ::= union",
+ /* 173 */ "select ::= SELECT selcollist",
+ /* 174 */ "sclp ::= selcollist COMMA",
+ /* 175 */ "sclp ::=",
+ /* 176 */ "selcollist ::= sclp distinct expr as",
+ /* 177 */ "selcollist ::= sclp STAR",
+ /* 178 */ "as ::= AS ids",
+ /* 179 */ "as ::= ids",
+ /* 180 */ "as ::=",
+ /* 181 */ "distinct ::= DISTINCT",
+ /* 182 */ "distinct ::=",
+ /* 183 */ "from ::= FROM tablelist",
+ /* 184 */ "from ::= FROM sub",
+ /* 185 */ "sub ::= LP union RP",
+ /* 186 */ "sub ::= LP union RP ids",
+ /* 187 */ "sub ::= sub COMMA LP union RP ids",
+ /* 188 */ "tablelist ::= ids cpxName",
+ /* 189 */ "tablelist ::= ids cpxName ids",
+ /* 190 */ "tablelist ::= tablelist COMMA ids cpxName",
+ /* 191 */ "tablelist ::= tablelist COMMA ids cpxName ids",
+ /* 192 */ "tmvar ::= VARIABLE",
+ /* 193 */ "timestamp ::= INTEGER",
+ /* 194 */ "timestamp ::= MINUS INTEGER",
+ /* 195 */ "timestamp ::= PLUS INTEGER",
+ /* 196 */ "timestamp ::= STRING",
+ /* 197 */ "timestamp ::= NOW",
+ /* 198 */ "timestamp ::= NOW PLUS VARIABLE",
+ /* 199 */ "timestamp ::= NOW MINUS VARIABLE",
+ /* 200 */ "range_option ::=",
+ /* 201 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP",
+ /* 202 */ "interval_option ::= intervalKey LP tmvar RP",
+ /* 203 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP",
+ /* 204 */ "interval_option ::=",
+ /* 205 */ "intervalKey ::= INTERVAL",
+ /* 206 */ "intervalKey ::= EVERY",
+ /* 207 */ "session_option ::=",
+ /* 208 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP",
+ /* 209 */ "windowstate_option ::=",
+ /* 210 */ "windowstate_option ::= STATE_WINDOW LP ids RP",
+ /* 211 */ "fill_opt ::=",
+ /* 212 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
+ /* 213 */ "fill_opt ::= FILL LP ID RP",
+ /* 214 */ "sliding_opt ::= SLIDING LP tmvar RP",
+ /* 215 */ "sliding_opt ::=",
+ /* 216 */ "orderby_opt ::=",
+ /* 217 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 218 */ "sortlist ::= sortlist COMMA item sortorder",
+ /* 219 */ "sortlist ::= sortlist COMMA arrow sortorder",
+ /* 220 */ "sortlist ::= item sortorder",
+ /* 221 */ "sortlist ::= arrow sortorder",
+ /* 222 */ "item ::= ID",
+ /* 223 */ "item ::= ID DOT ID",
+ /* 224 */ "sortorder ::= ASC",
+ /* 225 */ "sortorder ::= DESC",
+ /* 226 */ "sortorder ::=",
+ /* 227 */ "groupby_opt ::=",
+ /* 228 */ "groupby_opt ::= GROUP BY grouplist",
+ /* 229 */ "grouplist ::= grouplist COMMA item",
+ /* 230 */ "grouplist ::= grouplist COMMA arrow",
+ /* 231 */ "grouplist ::= item",
+ /* 232 */ "grouplist ::= arrow",
+ /* 233 */ "having_opt ::=",
+ /* 234 */ "having_opt ::= HAVING expr",
+ /* 235 */ "limit_opt ::=",
+ /* 236 */ "limit_opt ::= LIMIT signed",
+ /* 237 */ "limit_opt ::= LIMIT signed OFFSET signed",
+ /* 238 */ "limit_opt ::= LIMIT signed COMMA signed",
+ /* 239 */ "slimit_opt ::=",
+ /* 240 */ "slimit_opt ::= SLIMIT signed",
+ /* 241 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
+ /* 242 */ "slimit_opt ::= SLIMIT signed COMMA signed",
+ /* 243 */ "where_opt ::=",
+ /* 244 */ "where_opt ::= WHERE expr",
+ /* 245 */ "expr ::= LP expr RP",
+ /* 246 */ "expr ::= ID",
+ /* 247 */ "expr ::= ID DOT ID",
+ /* 248 */ "expr ::= ID DOT STAR",
+ /* 249 */ "expr ::= INTEGER",
+ /* 250 */ "expr ::= MINUS INTEGER",
+ /* 251 */ "expr ::= PLUS INTEGER",
+ /* 252 */ "expr ::= FLOAT",
+ /* 253 */ "expr ::= MINUS FLOAT",
+ /* 254 */ "expr ::= PLUS FLOAT",
+ /* 255 */ "expr ::= STRING",
+ /* 256 */ "expr ::= NOW",
+ /* 257 */ "expr ::= VARIABLE",
+ /* 258 */ "expr ::= PLUS VARIABLE",
+ /* 259 */ "expr ::= MINUS VARIABLE",
+ /* 260 */ "expr ::= BOOL",
+ /* 261 */ "expr ::= NULL",
+ /* 262 */ "expr ::= ID LP exprlist RP",
+ /* 263 */ "expr ::= ID LP STAR RP",
+ /* 264 */ "expr ::= ID LP expr AS typename RP",
+ /* 265 */ "expr ::= expr IS NULL",
+ /* 266 */ "expr ::= expr IS NOT NULL",
+ /* 267 */ "expr ::= expr LT expr",
+ /* 268 */ "expr ::= expr GT expr",
+ /* 269 */ "expr ::= expr LE expr",
+ /* 270 */ "expr ::= expr GE expr",
+ /* 271 */ "expr ::= expr NE expr",
+ /* 272 */ "expr ::= expr EQ expr",
+ /* 273 */ "expr ::= expr BETWEEN expr AND expr",
+ /* 274 */ "expr ::= expr AND expr",
+ /* 275 */ "expr ::= expr OR expr",
+ /* 276 */ "expr ::= expr PLUS expr",
+ /* 277 */ "expr ::= expr MINUS expr",
+ /* 278 */ "expr ::= expr STAR expr",
+ /* 279 */ "expr ::= expr SLASH expr",
+ /* 280 */ "expr ::= expr REM expr",
+ /* 281 */ "expr ::= expr LIKE expr",
+ /* 282 */ "expr ::= expr MATCH expr",
+ /* 283 */ "expr ::= expr NMATCH expr",
+ /* 284 */ "expr ::= ID CONTAINS STRING",
+ /* 285 */ "expr ::= ID DOT ID CONTAINS STRING",
+ /* 286 */ "arrow ::= ID ARROW STRING",
+ /* 287 */ "arrow ::= ID DOT ID ARROW STRING",
+ /* 288 */ "expr ::= arrow",
+ /* 289 */ "expr ::= expr IN LP exprlist RP",
+ /* 290 */ "exprlist ::= exprlist COMMA expritem",
+ /* 291 */ "exprlist ::= expritem",
+ /* 292 */ "expritem ::= expr",
+ /* 293 */ "expritem ::=",
+ /* 294 */ "cmd ::= RESET QUERY CACHE",
+ /* 295 */ "cmd ::= SYNCDB ids REPLICA",
+ /* 296 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
+ /* 297 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
+ /* 298 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist",
+ /* 299 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
+ /* 300 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
+ /* 301 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
+ /* 302 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 303 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist",
+ /* 304 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
+ /* 305 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
+ /* 306 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist",
+ /* 307 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
+ /* 308 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
+ /* 309 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
+ /* 310 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 311 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist",
+ /* 312 */ "cmd ::= KILL CONNECTION INTEGER",
+ /* 313 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
+ /* 314 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
};
#endif /* NDEBUG */
@@ -2262,157 +2266,159 @@ static const YYCODETYPE yyRuleInfoLhs[] = {
253, /* (159) tagitem ::= BOOL */
253, /* (160) tagitem ::= NULL */
253, /* (161) tagitem ::= NOW */
- 253, /* (162) tagitem ::= MINUS INTEGER */
- 253, /* (163) tagitem ::= MINUS FLOAT */
- 253, /* (164) tagitem ::= PLUS INTEGER */
- 253, /* (165) tagitem ::= PLUS FLOAT */
- 251, /* (166) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
- 251, /* (167) select ::= LP select RP */
- 268, /* (168) union ::= select */
- 268, /* (169) union ::= union UNION ALL select */
- 202, /* (170) cmd ::= union */
- 251, /* (171) select ::= SELECT selcollist */
- 269, /* (172) sclp ::= selcollist COMMA */
- 269, /* (173) sclp ::= */
- 254, /* (174) selcollist ::= sclp distinct expr as */
- 254, /* (175) selcollist ::= sclp STAR */
- 272, /* (176) as ::= AS ids */
- 272, /* (177) as ::= ids */
- 272, /* (178) as ::= */
- 270, /* (179) distinct ::= DISTINCT */
- 270, /* (180) distinct ::= */
- 255, /* (181) from ::= FROM tablelist */
- 255, /* (182) from ::= FROM sub */
- 274, /* (183) sub ::= LP union RP */
- 274, /* (184) sub ::= LP union RP ids */
- 274, /* (185) sub ::= sub COMMA LP union RP ids */
- 273, /* (186) tablelist ::= ids cpxName */
- 273, /* (187) tablelist ::= ids cpxName ids */
- 273, /* (188) tablelist ::= tablelist COMMA ids cpxName */
- 273, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */
- 275, /* (190) tmvar ::= VARIABLE */
- 276, /* (191) timestamp ::= INTEGER */
- 276, /* (192) timestamp ::= MINUS INTEGER */
- 276, /* (193) timestamp ::= PLUS INTEGER */
- 276, /* (194) timestamp ::= STRING */
- 276, /* (195) timestamp ::= NOW */
- 276, /* (196) timestamp ::= NOW PLUS VARIABLE */
- 276, /* (197) timestamp ::= NOW MINUS VARIABLE */
- 257, /* (198) range_option ::= */
- 257, /* (199) range_option ::= RANGE LP timestamp COMMA timestamp RP */
- 258, /* (200) interval_option ::= intervalKey LP tmvar RP */
- 258, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
- 258, /* (202) interval_option ::= */
- 277, /* (203) intervalKey ::= INTERVAL */
- 277, /* (204) intervalKey ::= EVERY */
- 260, /* (205) session_option ::= */
- 260, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
- 261, /* (207) windowstate_option ::= */
- 261, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */
- 262, /* (209) fill_opt ::= */
- 262, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
- 262, /* (211) fill_opt ::= FILL LP ID RP */
- 259, /* (212) sliding_opt ::= SLIDING LP tmvar RP */
- 259, /* (213) sliding_opt ::= */
- 265, /* (214) orderby_opt ::= */
- 265, /* (215) orderby_opt ::= ORDER BY sortlist */
- 278, /* (216) sortlist ::= sortlist COMMA item sortorder */
- 278, /* (217) sortlist ::= sortlist COMMA arrow sortorder */
- 278, /* (218) sortlist ::= item sortorder */
- 278, /* (219) sortlist ::= arrow sortorder */
- 279, /* (220) item ::= ID */
- 279, /* (221) item ::= ID DOT ID */
- 280, /* (222) sortorder ::= ASC */
- 280, /* (223) sortorder ::= DESC */
- 280, /* (224) sortorder ::= */
- 263, /* (225) groupby_opt ::= */
- 263, /* (226) groupby_opt ::= GROUP BY grouplist */
- 282, /* (227) grouplist ::= grouplist COMMA item */
- 282, /* (228) grouplist ::= grouplist COMMA arrow */
- 282, /* (229) grouplist ::= item */
- 282, /* (230) grouplist ::= arrow */
- 264, /* (231) having_opt ::= */
- 264, /* (232) having_opt ::= HAVING expr */
- 267, /* (233) limit_opt ::= */
- 267, /* (234) limit_opt ::= LIMIT signed */
- 267, /* (235) limit_opt ::= LIMIT signed OFFSET signed */
- 267, /* (236) limit_opt ::= LIMIT signed COMMA signed */
- 266, /* (237) slimit_opt ::= */
- 266, /* (238) slimit_opt ::= SLIMIT signed */
- 266, /* (239) slimit_opt ::= SLIMIT signed SOFFSET signed */
- 266, /* (240) slimit_opt ::= SLIMIT signed COMMA signed */
- 256, /* (241) where_opt ::= */
- 256, /* (242) where_opt ::= WHERE expr */
- 271, /* (243) expr ::= LP expr RP */
- 271, /* (244) expr ::= ID */
- 271, /* (245) expr ::= ID DOT ID */
- 271, /* (246) expr ::= ID DOT STAR */
- 271, /* (247) expr ::= INTEGER */
- 271, /* (248) expr ::= MINUS INTEGER */
- 271, /* (249) expr ::= PLUS INTEGER */
- 271, /* (250) expr ::= FLOAT */
- 271, /* (251) expr ::= MINUS FLOAT */
- 271, /* (252) expr ::= PLUS FLOAT */
- 271, /* (253) expr ::= STRING */
- 271, /* (254) expr ::= NOW */
- 271, /* (255) expr ::= VARIABLE */
- 271, /* (256) expr ::= PLUS VARIABLE */
- 271, /* (257) expr ::= MINUS VARIABLE */
- 271, /* (258) expr ::= BOOL */
- 271, /* (259) expr ::= NULL */
- 271, /* (260) expr ::= ID LP exprlist RP */
- 271, /* (261) expr ::= ID LP STAR RP */
- 271, /* (262) expr ::= ID LP expr AS typename RP */
- 271, /* (263) expr ::= expr IS NULL */
- 271, /* (264) expr ::= expr IS NOT NULL */
- 271, /* (265) expr ::= expr LT expr */
- 271, /* (266) expr ::= expr GT expr */
- 271, /* (267) expr ::= expr LE expr */
- 271, /* (268) expr ::= expr GE expr */
- 271, /* (269) expr ::= expr NE expr */
- 271, /* (270) expr ::= expr EQ expr */
- 271, /* (271) expr ::= expr BETWEEN expr AND expr */
- 271, /* (272) expr ::= expr AND expr */
- 271, /* (273) expr ::= expr OR expr */
- 271, /* (274) expr ::= expr PLUS expr */
- 271, /* (275) expr ::= expr MINUS expr */
- 271, /* (276) expr ::= expr STAR expr */
- 271, /* (277) expr ::= expr SLASH expr */
- 271, /* (278) expr ::= expr REM expr */
- 271, /* (279) expr ::= expr LIKE expr */
- 271, /* (280) expr ::= expr MATCH expr */
- 271, /* (281) expr ::= expr NMATCH expr */
- 271, /* (282) expr ::= ID CONTAINS STRING */
- 271, /* (283) expr ::= ID DOT ID CONTAINS STRING */
- 281, /* (284) arrow ::= ID ARROW STRING */
- 281, /* (285) arrow ::= ID DOT ID ARROW STRING */
- 271, /* (286) expr ::= arrow */
- 271, /* (287) expr ::= expr IN LP exprlist RP */
- 210, /* (288) exprlist ::= exprlist COMMA expritem */
- 210, /* (289) exprlist ::= expritem */
- 283, /* (290) expritem ::= expr */
- 283, /* (291) expritem ::= */
- 202, /* (292) cmd ::= RESET QUERY CACHE */
- 202, /* (293) cmd ::= SYNCDB ids REPLICA */
- 202, /* (294) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
- 202, /* (295) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
- 202, /* (296) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
- 202, /* (297) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
- 202, /* (298) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
- 202, /* (299) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
- 202, /* (300) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
- 202, /* (301) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
- 202, /* (302) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
- 202, /* (303) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
- 202, /* (304) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
- 202, /* (305) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
- 202, /* (306) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
- 202, /* (307) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
- 202, /* (308) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
- 202, /* (309) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
- 202, /* (310) cmd ::= KILL CONNECTION INTEGER */
- 202, /* (311) cmd ::= KILL STREAM INTEGER COLON INTEGER */
- 202, /* (312) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ 253, /* (162) tagitem ::= NOW PLUS VARIABLE */
+ 253, /* (163) tagitem ::= NOW MINUS VARIABLE */
+ 253, /* (164) tagitem ::= MINUS INTEGER */
+ 253, /* (165) tagitem ::= MINUS FLOAT */
+ 253, /* (166) tagitem ::= PLUS INTEGER */
+ 253, /* (167) tagitem ::= PLUS FLOAT */
+ 251, /* (168) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
+ 251, /* (169) select ::= LP select RP */
+ 268, /* (170) union ::= select */
+ 268, /* (171) union ::= union UNION ALL select */
+ 202, /* (172) cmd ::= union */
+ 251, /* (173) select ::= SELECT selcollist */
+ 269, /* (174) sclp ::= selcollist COMMA */
+ 269, /* (175) sclp ::= */
+ 254, /* (176) selcollist ::= sclp distinct expr as */
+ 254, /* (177) selcollist ::= sclp STAR */
+ 272, /* (178) as ::= AS ids */
+ 272, /* (179) as ::= ids */
+ 272, /* (180) as ::= */
+ 270, /* (181) distinct ::= DISTINCT */
+ 270, /* (182) distinct ::= */
+ 255, /* (183) from ::= FROM tablelist */
+ 255, /* (184) from ::= FROM sub */
+ 274, /* (185) sub ::= LP union RP */
+ 274, /* (186) sub ::= LP union RP ids */
+ 274, /* (187) sub ::= sub COMMA LP union RP ids */
+ 273, /* (188) tablelist ::= ids cpxName */
+ 273, /* (189) tablelist ::= ids cpxName ids */
+ 273, /* (190) tablelist ::= tablelist COMMA ids cpxName */
+ 273, /* (191) tablelist ::= tablelist COMMA ids cpxName ids */
+ 275, /* (192) tmvar ::= VARIABLE */
+ 276, /* (193) timestamp ::= INTEGER */
+ 276, /* (194) timestamp ::= MINUS INTEGER */
+ 276, /* (195) timestamp ::= PLUS INTEGER */
+ 276, /* (196) timestamp ::= STRING */
+ 276, /* (197) timestamp ::= NOW */
+ 276, /* (198) timestamp ::= NOW PLUS VARIABLE */
+ 276, /* (199) timestamp ::= NOW MINUS VARIABLE */
+ 257, /* (200) range_option ::= */
+ 257, /* (201) range_option ::= RANGE LP timestamp COMMA timestamp RP */
+ 258, /* (202) interval_option ::= intervalKey LP tmvar RP */
+ 258, /* (203) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
+ 258, /* (204) interval_option ::= */
+ 277, /* (205) intervalKey ::= INTERVAL */
+ 277, /* (206) intervalKey ::= EVERY */
+ 260, /* (207) session_option ::= */
+ 260, /* (208) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+ 261, /* (209) windowstate_option ::= */
+ 261, /* (210) windowstate_option ::= STATE_WINDOW LP ids RP */
+ 262, /* (211) fill_opt ::= */
+ 262, /* (212) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ 262, /* (213) fill_opt ::= FILL LP ID RP */
+ 259, /* (214) sliding_opt ::= SLIDING LP tmvar RP */
+ 259, /* (215) sliding_opt ::= */
+ 265, /* (216) orderby_opt ::= */
+ 265, /* (217) orderby_opt ::= ORDER BY sortlist */
+ 278, /* (218) sortlist ::= sortlist COMMA item sortorder */
+ 278, /* (219) sortlist ::= sortlist COMMA arrow sortorder */
+ 278, /* (220) sortlist ::= item sortorder */
+ 278, /* (221) sortlist ::= arrow sortorder */
+ 279, /* (222) item ::= ID */
+ 279, /* (223) item ::= ID DOT ID */
+ 280, /* (224) sortorder ::= ASC */
+ 280, /* (225) sortorder ::= DESC */
+ 280, /* (226) sortorder ::= */
+ 263, /* (227) groupby_opt ::= */
+ 263, /* (228) groupby_opt ::= GROUP BY grouplist */
+ 282, /* (229) grouplist ::= grouplist COMMA item */
+ 282, /* (230) grouplist ::= grouplist COMMA arrow */
+ 282, /* (231) grouplist ::= item */
+ 282, /* (232) grouplist ::= arrow */
+ 264, /* (233) having_opt ::= */
+ 264, /* (234) having_opt ::= HAVING expr */
+ 267, /* (235) limit_opt ::= */
+ 267, /* (236) limit_opt ::= LIMIT signed */
+ 267, /* (237) limit_opt ::= LIMIT signed OFFSET signed */
+ 267, /* (238) limit_opt ::= LIMIT signed COMMA signed */
+ 266, /* (239) slimit_opt ::= */
+ 266, /* (240) slimit_opt ::= SLIMIT signed */
+ 266, /* (241) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ 266, /* (242) slimit_opt ::= SLIMIT signed COMMA signed */
+ 256, /* (243) where_opt ::= */
+ 256, /* (244) where_opt ::= WHERE expr */
+ 271, /* (245) expr ::= LP expr RP */
+ 271, /* (246) expr ::= ID */
+ 271, /* (247) expr ::= ID DOT ID */
+ 271, /* (248) expr ::= ID DOT STAR */
+ 271, /* (249) expr ::= INTEGER */
+ 271, /* (250) expr ::= MINUS INTEGER */
+ 271, /* (251) expr ::= PLUS INTEGER */
+ 271, /* (252) expr ::= FLOAT */
+ 271, /* (253) expr ::= MINUS FLOAT */
+ 271, /* (254) expr ::= PLUS FLOAT */
+ 271, /* (255) expr ::= STRING */
+ 271, /* (256) expr ::= NOW */
+ 271, /* (257) expr ::= VARIABLE */
+ 271, /* (258) expr ::= PLUS VARIABLE */
+ 271, /* (259) expr ::= MINUS VARIABLE */
+ 271, /* (260) expr ::= BOOL */
+ 271, /* (261) expr ::= NULL */
+ 271, /* (262) expr ::= ID LP exprlist RP */
+ 271, /* (263) expr ::= ID LP STAR RP */
+ 271, /* (264) expr ::= ID LP expr AS typename RP */
+ 271, /* (265) expr ::= expr IS NULL */
+ 271, /* (266) expr ::= expr IS NOT NULL */
+ 271, /* (267) expr ::= expr LT expr */
+ 271, /* (268) expr ::= expr GT expr */
+ 271, /* (269) expr ::= expr LE expr */
+ 271, /* (270) expr ::= expr GE expr */
+ 271, /* (271) expr ::= expr NE expr */
+ 271, /* (272) expr ::= expr EQ expr */
+ 271, /* (273) expr ::= expr BETWEEN expr AND expr */
+ 271, /* (274) expr ::= expr AND expr */
+ 271, /* (275) expr ::= expr OR expr */
+ 271, /* (276) expr ::= expr PLUS expr */
+ 271, /* (277) expr ::= expr MINUS expr */
+ 271, /* (278) expr ::= expr STAR expr */
+ 271, /* (279) expr ::= expr SLASH expr */
+ 271, /* (280) expr ::= expr REM expr */
+ 271, /* (281) expr ::= expr LIKE expr */
+ 271, /* (282) expr ::= expr MATCH expr */
+ 271, /* (283) expr ::= expr NMATCH expr */
+ 271, /* (284) expr ::= ID CONTAINS STRING */
+ 271, /* (285) expr ::= ID DOT ID CONTAINS STRING */
+ 281, /* (286) arrow ::= ID ARROW STRING */
+ 281, /* (287) arrow ::= ID DOT ID ARROW STRING */
+ 271, /* (288) expr ::= arrow */
+ 271, /* (289) expr ::= expr IN LP exprlist RP */
+ 210, /* (290) exprlist ::= exprlist COMMA expritem */
+ 210, /* (291) exprlist ::= expritem */
+ 283, /* (292) expritem ::= expr */
+ 283, /* (293) expritem ::= */
+ 202, /* (294) cmd ::= RESET QUERY CACHE */
+ 202, /* (295) cmd ::= SYNCDB ids REPLICA */
+ 202, /* (296) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ 202, /* (297) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ 202, /* (298) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
+ 202, /* (299) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ 202, /* (300) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ 202, /* (301) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ 202, /* (302) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ 202, /* (303) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
+ 202, /* (304) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ 202, /* (305) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ 202, /* (306) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
+ 202, /* (307) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ 202, /* (308) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ 202, /* (309) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ 202, /* (310) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
+ 202, /* (311) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
+ 202, /* (312) cmd ::= KILL CONNECTION INTEGER */
+ 202, /* (313) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ 202, /* (314) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -2580,157 +2586,159 @@ static const signed char yyRuleInfoNRhs[] = {
-1, /* (159) tagitem ::= BOOL */
-1, /* (160) tagitem ::= NULL */
-1, /* (161) tagitem ::= NOW */
- -2, /* (162) tagitem ::= MINUS INTEGER */
- -2, /* (163) tagitem ::= MINUS FLOAT */
- -2, /* (164) tagitem ::= PLUS INTEGER */
- -2, /* (165) tagitem ::= PLUS FLOAT */
- -15, /* (166) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
- -3, /* (167) select ::= LP select RP */
- -1, /* (168) union ::= select */
- -4, /* (169) union ::= union UNION ALL select */
- -1, /* (170) cmd ::= union */
- -2, /* (171) select ::= SELECT selcollist */
- -2, /* (172) sclp ::= selcollist COMMA */
- 0, /* (173) sclp ::= */
- -4, /* (174) selcollist ::= sclp distinct expr as */
- -2, /* (175) selcollist ::= sclp STAR */
- -2, /* (176) as ::= AS ids */
- -1, /* (177) as ::= ids */
- 0, /* (178) as ::= */
- -1, /* (179) distinct ::= DISTINCT */
- 0, /* (180) distinct ::= */
- -2, /* (181) from ::= FROM tablelist */
- -2, /* (182) from ::= FROM sub */
- -3, /* (183) sub ::= LP union RP */
- -4, /* (184) sub ::= LP union RP ids */
- -6, /* (185) sub ::= sub COMMA LP union RP ids */
- -2, /* (186) tablelist ::= ids cpxName */
- -3, /* (187) tablelist ::= ids cpxName ids */
- -4, /* (188) tablelist ::= tablelist COMMA ids cpxName */
- -5, /* (189) tablelist ::= tablelist COMMA ids cpxName ids */
- -1, /* (190) tmvar ::= VARIABLE */
- -1, /* (191) timestamp ::= INTEGER */
- -2, /* (192) timestamp ::= MINUS INTEGER */
- -2, /* (193) timestamp ::= PLUS INTEGER */
- -1, /* (194) timestamp ::= STRING */
- -1, /* (195) timestamp ::= NOW */
- -3, /* (196) timestamp ::= NOW PLUS VARIABLE */
- -3, /* (197) timestamp ::= NOW MINUS VARIABLE */
- 0, /* (198) range_option ::= */
- -6, /* (199) range_option ::= RANGE LP timestamp COMMA timestamp RP */
- -4, /* (200) interval_option ::= intervalKey LP tmvar RP */
- -6, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
- 0, /* (202) interval_option ::= */
- -1, /* (203) intervalKey ::= INTERVAL */
- -1, /* (204) intervalKey ::= EVERY */
- 0, /* (205) session_option ::= */
- -7, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
- 0, /* (207) windowstate_option ::= */
- -4, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */
- 0, /* (209) fill_opt ::= */
- -6, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
- -4, /* (211) fill_opt ::= FILL LP ID RP */
- -4, /* (212) sliding_opt ::= SLIDING LP tmvar RP */
- 0, /* (213) sliding_opt ::= */
- 0, /* (214) orderby_opt ::= */
- -3, /* (215) orderby_opt ::= ORDER BY sortlist */
- -4, /* (216) sortlist ::= sortlist COMMA item sortorder */
- -4, /* (217) sortlist ::= sortlist COMMA arrow sortorder */
- -2, /* (218) sortlist ::= item sortorder */
- -2, /* (219) sortlist ::= arrow sortorder */
- -1, /* (220) item ::= ID */
- -3, /* (221) item ::= ID DOT ID */
- -1, /* (222) sortorder ::= ASC */
- -1, /* (223) sortorder ::= DESC */
- 0, /* (224) sortorder ::= */
- 0, /* (225) groupby_opt ::= */
- -3, /* (226) groupby_opt ::= GROUP BY grouplist */
- -3, /* (227) grouplist ::= grouplist COMMA item */
- -3, /* (228) grouplist ::= grouplist COMMA arrow */
- -1, /* (229) grouplist ::= item */
- -1, /* (230) grouplist ::= arrow */
- 0, /* (231) having_opt ::= */
- -2, /* (232) having_opt ::= HAVING expr */
- 0, /* (233) limit_opt ::= */
- -2, /* (234) limit_opt ::= LIMIT signed */
- -4, /* (235) limit_opt ::= LIMIT signed OFFSET signed */
- -4, /* (236) limit_opt ::= LIMIT signed COMMA signed */
- 0, /* (237) slimit_opt ::= */
- -2, /* (238) slimit_opt ::= SLIMIT signed */
- -4, /* (239) slimit_opt ::= SLIMIT signed SOFFSET signed */
- -4, /* (240) slimit_opt ::= SLIMIT signed COMMA signed */
- 0, /* (241) where_opt ::= */
- -2, /* (242) where_opt ::= WHERE expr */
- -3, /* (243) expr ::= LP expr RP */
- -1, /* (244) expr ::= ID */
- -3, /* (245) expr ::= ID DOT ID */
- -3, /* (246) expr ::= ID DOT STAR */
- -1, /* (247) expr ::= INTEGER */
- -2, /* (248) expr ::= MINUS INTEGER */
- -2, /* (249) expr ::= PLUS INTEGER */
- -1, /* (250) expr ::= FLOAT */
- -2, /* (251) expr ::= MINUS FLOAT */
- -2, /* (252) expr ::= PLUS FLOAT */
- -1, /* (253) expr ::= STRING */
- -1, /* (254) expr ::= NOW */
- -1, /* (255) expr ::= VARIABLE */
- -2, /* (256) expr ::= PLUS VARIABLE */
- -2, /* (257) expr ::= MINUS VARIABLE */
- -1, /* (258) expr ::= BOOL */
- -1, /* (259) expr ::= NULL */
- -4, /* (260) expr ::= ID LP exprlist RP */
- -4, /* (261) expr ::= ID LP STAR RP */
- -6, /* (262) expr ::= ID LP expr AS typename RP */
- -3, /* (263) expr ::= expr IS NULL */
- -4, /* (264) expr ::= expr IS NOT NULL */
- -3, /* (265) expr ::= expr LT expr */
- -3, /* (266) expr ::= expr GT expr */
- -3, /* (267) expr ::= expr LE expr */
- -3, /* (268) expr ::= expr GE expr */
- -3, /* (269) expr ::= expr NE expr */
- -3, /* (270) expr ::= expr EQ expr */
- -5, /* (271) expr ::= expr BETWEEN expr AND expr */
- -3, /* (272) expr ::= expr AND expr */
- -3, /* (273) expr ::= expr OR expr */
- -3, /* (274) expr ::= expr PLUS expr */
- -3, /* (275) expr ::= expr MINUS expr */
- -3, /* (276) expr ::= expr STAR expr */
- -3, /* (277) expr ::= expr SLASH expr */
- -3, /* (278) expr ::= expr REM expr */
- -3, /* (279) expr ::= expr LIKE expr */
- -3, /* (280) expr ::= expr MATCH expr */
- -3, /* (281) expr ::= expr NMATCH expr */
- -3, /* (282) expr ::= ID CONTAINS STRING */
- -5, /* (283) expr ::= ID DOT ID CONTAINS STRING */
- -3, /* (284) arrow ::= ID ARROW STRING */
- -5, /* (285) arrow ::= ID DOT ID ARROW STRING */
- -1, /* (286) expr ::= arrow */
- -5, /* (287) expr ::= expr IN LP exprlist RP */
- -3, /* (288) exprlist ::= exprlist COMMA expritem */
- -1, /* (289) exprlist ::= expritem */
- -1, /* (290) expritem ::= expr */
- 0, /* (291) expritem ::= */
- -3, /* (292) cmd ::= RESET QUERY CACHE */
- -3, /* (293) cmd ::= SYNCDB ids REPLICA */
- -7, /* (294) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
- -7, /* (295) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
- -7, /* (296) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
- -7, /* (297) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
- -7, /* (298) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
- -8, /* (299) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
- -9, /* (300) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
- -7, /* (301) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
- -7, /* (302) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
- -7, /* (303) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
- -7, /* (304) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
- -7, /* (305) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
- -7, /* (306) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
- -8, /* (307) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
- -9, /* (308) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
- -7, /* (309) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
- -3, /* (310) cmd ::= KILL CONNECTION INTEGER */
- -5, /* (311) cmd ::= KILL STREAM INTEGER COLON INTEGER */
- -5, /* (312) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ -3, /* (162) tagitem ::= NOW PLUS VARIABLE */
+ -3, /* (163) tagitem ::= NOW MINUS VARIABLE */
+ -2, /* (164) tagitem ::= MINUS INTEGER */
+ -2, /* (165) tagitem ::= MINUS FLOAT */
+ -2, /* (166) tagitem ::= PLUS INTEGER */
+ -2, /* (167) tagitem ::= PLUS FLOAT */
+ -15, /* (168) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
+ -3, /* (169) select ::= LP select RP */
+ -1, /* (170) union ::= select */
+ -4, /* (171) union ::= union UNION ALL select */
+ -1, /* (172) cmd ::= union */
+ -2, /* (173) select ::= SELECT selcollist */
+ -2, /* (174) sclp ::= selcollist COMMA */
+ 0, /* (175) sclp ::= */
+ -4, /* (176) selcollist ::= sclp distinct expr as */
+ -2, /* (177) selcollist ::= sclp STAR */
+ -2, /* (178) as ::= AS ids */
+ -1, /* (179) as ::= ids */
+ 0, /* (180) as ::= */
+ -1, /* (181) distinct ::= DISTINCT */
+ 0, /* (182) distinct ::= */
+ -2, /* (183) from ::= FROM tablelist */
+ -2, /* (184) from ::= FROM sub */
+ -3, /* (185) sub ::= LP union RP */
+ -4, /* (186) sub ::= LP union RP ids */
+ -6, /* (187) sub ::= sub COMMA LP union RP ids */
+ -2, /* (188) tablelist ::= ids cpxName */
+ -3, /* (189) tablelist ::= ids cpxName ids */
+ -4, /* (190) tablelist ::= tablelist COMMA ids cpxName */
+ -5, /* (191) tablelist ::= tablelist COMMA ids cpxName ids */
+ -1, /* (192) tmvar ::= VARIABLE */
+ -1, /* (193) timestamp ::= INTEGER */
+ -2, /* (194) timestamp ::= MINUS INTEGER */
+ -2, /* (195) timestamp ::= PLUS INTEGER */
+ -1, /* (196) timestamp ::= STRING */
+ -1, /* (197) timestamp ::= NOW */
+ -3, /* (198) timestamp ::= NOW PLUS VARIABLE */
+ -3, /* (199) timestamp ::= NOW MINUS VARIABLE */
+ 0, /* (200) range_option ::= */
+ -6, /* (201) range_option ::= RANGE LP timestamp COMMA timestamp RP */
+ -4, /* (202) interval_option ::= intervalKey LP tmvar RP */
+ -6, /* (203) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
+ 0, /* (204) interval_option ::= */
+ -1, /* (205) intervalKey ::= INTERVAL */
+ -1, /* (206) intervalKey ::= EVERY */
+ 0, /* (207) session_option ::= */
+ -7, /* (208) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+ 0, /* (209) windowstate_option ::= */
+ -4, /* (210) windowstate_option ::= STATE_WINDOW LP ids RP */
+ 0, /* (211) fill_opt ::= */
+ -6, /* (212) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ -4, /* (213) fill_opt ::= FILL LP ID RP */
+ -4, /* (214) sliding_opt ::= SLIDING LP tmvar RP */
+ 0, /* (215) sliding_opt ::= */
+ 0, /* (216) orderby_opt ::= */
+ -3, /* (217) orderby_opt ::= ORDER BY sortlist */
+ -4, /* (218) sortlist ::= sortlist COMMA item sortorder */
+ -4, /* (219) sortlist ::= sortlist COMMA arrow sortorder */
+ -2, /* (220) sortlist ::= item sortorder */
+ -2, /* (221) sortlist ::= arrow sortorder */
+ -1, /* (222) item ::= ID */
+ -3, /* (223) item ::= ID DOT ID */
+ -1, /* (224) sortorder ::= ASC */
+ -1, /* (225) sortorder ::= DESC */
+ 0, /* (226) sortorder ::= */
+ 0, /* (227) groupby_opt ::= */
+ -3, /* (228) groupby_opt ::= GROUP BY grouplist */
+ -3, /* (229) grouplist ::= grouplist COMMA item */
+ -3, /* (230) grouplist ::= grouplist COMMA arrow */
+ -1, /* (231) grouplist ::= item */
+ -1, /* (232) grouplist ::= arrow */
+ 0, /* (233) having_opt ::= */
+ -2, /* (234) having_opt ::= HAVING expr */
+ 0, /* (235) limit_opt ::= */
+ -2, /* (236) limit_opt ::= LIMIT signed */
+ -4, /* (237) limit_opt ::= LIMIT signed OFFSET signed */
+ -4, /* (238) limit_opt ::= LIMIT signed COMMA signed */
+ 0, /* (239) slimit_opt ::= */
+ -2, /* (240) slimit_opt ::= SLIMIT signed */
+ -4, /* (241) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ -4, /* (242) slimit_opt ::= SLIMIT signed COMMA signed */
+ 0, /* (243) where_opt ::= */
+ -2, /* (244) where_opt ::= WHERE expr */
+ -3, /* (245) expr ::= LP expr RP */
+ -1, /* (246) expr ::= ID */
+ -3, /* (247) expr ::= ID DOT ID */
+ -3, /* (248) expr ::= ID DOT STAR */
+ -1, /* (249) expr ::= INTEGER */
+ -2, /* (250) expr ::= MINUS INTEGER */
+ -2, /* (251) expr ::= PLUS INTEGER */
+ -1, /* (252) expr ::= FLOAT */
+ -2, /* (253) expr ::= MINUS FLOAT */
+ -2, /* (254) expr ::= PLUS FLOAT */
+ -1, /* (255) expr ::= STRING */
+ -1, /* (256) expr ::= NOW */
+ -1, /* (257) expr ::= VARIABLE */
+ -2, /* (258) expr ::= PLUS VARIABLE */
+ -2, /* (259) expr ::= MINUS VARIABLE */
+ -1, /* (260) expr ::= BOOL */
+ -1, /* (261) expr ::= NULL */
+ -4, /* (262) expr ::= ID LP exprlist RP */
+ -4, /* (263) expr ::= ID LP STAR RP */
+ -6, /* (264) expr ::= ID LP expr AS typename RP */
+ -3, /* (265) expr ::= expr IS NULL */
+ -4, /* (266) expr ::= expr IS NOT NULL */
+ -3, /* (267) expr ::= expr LT expr */
+ -3, /* (268) expr ::= expr GT expr */
+ -3, /* (269) expr ::= expr LE expr */
+ -3, /* (270) expr ::= expr GE expr */
+ -3, /* (271) expr ::= expr NE expr */
+ -3, /* (272) expr ::= expr EQ expr */
+ -5, /* (273) expr ::= expr BETWEEN expr AND expr */
+ -3, /* (274) expr ::= expr AND expr */
+ -3, /* (275) expr ::= expr OR expr */
+ -3, /* (276) expr ::= expr PLUS expr */
+ -3, /* (277) expr ::= expr MINUS expr */
+ -3, /* (278) expr ::= expr STAR expr */
+ -3, /* (279) expr ::= expr SLASH expr */
+ -3, /* (280) expr ::= expr REM expr */
+ -3, /* (281) expr ::= expr LIKE expr */
+ -3, /* (282) expr ::= expr MATCH expr */
+ -3, /* (283) expr ::= expr NMATCH expr */
+ -3, /* (284) expr ::= ID CONTAINS STRING */
+ -5, /* (285) expr ::= ID DOT ID CONTAINS STRING */
+ -3, /* (286) arrow ::= ID ARROW STRING */
+ -5, /* (287) arrow ::= ID DOT ID ARROW STRING */
+ -1, /* (288) expr ::= arrow */
+ -5, /* (289) expr ::= expr IN LP exprlist RP */
+ -3, /* (290) exprlist ::= exprlist COMMA expritem */
+ -1, /* (291) exprlist ::= expritem */
+ -1, /* (292) expritem ::= expr */
+ 0, /* (293) expritem ::= */
+ -3, /* (294) cmd ::= RESET QUERY CACHE */
+ -3, /* (295) cmd ::= SYNCDB ids REPLICA */
+ -7, /* (296) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ -7, /* (297) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ -7, /* (298) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
+ -7, /* (299) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ -7, /* (300) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ -8, /* (301) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ -9, /* (302) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ -7, /* (303) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
+ -7, /* (304) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ -7, /* (305) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ -7, /* (306) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
+ -7, /* (307) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ -7, /* (308) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ -8, /* (309) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ -9, /* (310) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
+ -7, /* (311) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
+ -3, /* (312) cmd ::= KILL CONNECTION INTEGER */
+ -5, /* (313) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ -5, /* (314) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -2966,7 +2974,7 @@ static YYACTIONTYPE yy_reduce(
break;
case 54: /* ifexists ::= */
case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56);
- case 180: /* distinct ::= */ yytestcase(yyruleno==180);
+ case 182: /* distinct ::= */ yytestcase(yyruleno==182);
{ yymsp[1].minor.yy0.n = 0;}
break;
case 55: /* ifnotexists ::= IF NOT EXISTS */
@@ -3044,7 +3052,7 @@ static YYACTIONTYPE yy_reduce(
case 157: /* tagitem ::= FLOAT */ yytestcase(yyruleno==157);
case 158: /* tagitem ::= STRING */ yytestcase(yyruleno==158);
case 159: /* tagitem ::= BOOL */ yytestcase(yyruleno==159);
-{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true); }
+{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy162 = yylhsminor.yy162;
break;
case 88: /* keep ::= KEEP intitemlist */
@@ -3277,523 +3285,535 @@ static YYACTIONTYPE yy_reduce(
yymsp[-1].minor.yy279 = yylhsminor.yy279;
break;
case 160: /* tagitem ::= NULL */
-{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true); }
+{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy162 = yylhsminor.yy162;
break;
case 161: /* tagitem ::= NOW */
-{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true);}
+{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreateExt(&yylhsminor.yy162, &yymsp[0].minor.yy0, TK_NOW, true);}
yymsp[0].minor.yy162 = yylhsminor.yy162;
break;
- case 162: /* tagitem ::= MINUS INTEGER */
- case 163: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==163);
- case 164: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==164);
- case 165: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==165);
+ case 162: /* tagitem ::= NOW PLUS VARIABLE */
+{
+ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP;
+ tVariantCreateExt(&yymsp[-2].minor.yy162, &yymsp[0].minor.yy0, TK_PLUS, true);
+}
+ break;
+ case 163: /* tagitem ::= NOW MINUS VARIABLE */
+{
+ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP;
+ tVariantCreateExt(&yymsp[-2].minor.yy162, &yymsp[0].minor.yy0, TK_MINUS, true);
+}
+ break;
+ case 164: /* tagitem ::= MINUS INTEGER */
+ case 165: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==165);
+ case 166: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==166);
+ case 167: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==167);
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
toTSDBType(yymsp[-1].minor.yy0.type);
- tVariantCreate(&yylhsminor.yy162, &yymsp[-1].minor.yy0, true);
+ tVariantCreate(&yylhsminor.yy162, &yymsp[-1].minor.yy0);
}
yymsp[-1].minor.yy162 = yylhsminor.yy162;
break;
- case 166: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
+ case 168: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{
yylhsminor.yy16 = tSetQuerySqlNode(&yymsp[-14].minor.yy0, yymsp[-13].minor.yy189, yymsp[-12].minor.yy36, yymsp[-11].minor.yy18, yymsp[-4].minor.yy189, yymsp[-2].minor.yy189, &yymsp[-9].minor.yy32, &yymsp[-7].minor.yy155, &yymsp[-6].minor.yy336, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy189, &yymsp[0].minor.yy38, &yymsp[-1].minor.yy38, yymsp[-3].minor.yy18, &yymsp[-10].minor.yy124);
}
yymsp[-14].minor.yy16 = yylhsminor.yy16;
break;
- case 167: /* select ::= LP select RP */
+ case 169: /* select ::= LP select RP */
{yymsp[-2].minor.yy16 = yymsp[-1].minor.yy16;}
break;
- case 168: /* union ::= select */
+ case 170: /* union ::= select */
{ yylhsminor.yy189 = setSubclause(NULL, yymsp[0].minor.yy16); }
yymsp[0].minor.yy189 = yylhsminor.yy189;
break;
- case 169: /* union ::= union UNION ALL select */
+ case 171: /* union ::= union UNION ALL select */
{ yylhsminor.yy189 = appendSelectClause(yymsp[-3].minor.yy189, yymsp[0].minor.yy16); }
yymsp[-3].minor.yy189 = yylhsminor.yy189;
break;
- case 170: /* cmd ::= union */
+ case 172: /* cmd ::= union */
{ setSqlInfo(pInfo, yymsp[0].minor.yy189, NULL, TSDB_SQL_SELECT); }
break;
- case 171: /* select ::= SELECT selcollist */
+ case 173: /* select ::= SELECT selcollist */
{
yylhsminor.yy16 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy189, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
yymsp[-1].minor.yy16 = yylhsminor.yy16;
break;
- case 172: /* sclp ::= selcollist COMMA */
+ case 174: /* sclp ::= selcollist COMMA */
{yylhsminor.yy189 = yymsp[-1].minor.yy189;}
yymsp[-1].minor.yy189 = yylhsminor.yy189;
break;
- case 173: /* sclp ::= */
- case 214: /* orderby_opt ::= */ yytestcase(yyruleno==214);
+ case 175: /* sclp ::= */
+ case 216: /* orderby_opt ::= */ yytestcase(yyruleno==216);
{yymsp[1].minor.yy189 = 0;}
break;
- case 174: /* selcollist ::= sclp distinct expr as */
+ case 176: /* selcollist ::= sclp distinct expr as */
{
yylhsminor.yy189 = tSqlExprListAppend(yymsp[-3].minor.yy189, yymsp[-1].minor.yy18, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
}
yymsp[-3].minor.yy189 = yylhsminor.yy189;
break;
- case 175: /* selcollist ::= sclp STAR */
+ case 177: /* selcollist ::= sclp STAR */
{
tSqlExpr *pNode = tSqlExprCreateIdValue(pInfo, NULL, TK_ALL);
yylhsminor.yy189 = tSqlExprListAppend(yymsp[-1].minor.yy189, pNode, 0, 0);
}
yymsp[-1].minor.yy189 = yylhsminor.yy189;
break;
- case 176: /* as ::= AS ids */
+ case 178: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
- case 177: /* as ::= ids */
+ case 179: /* as ::= ids */
{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 178: /* as ::= */
+ case 180: /* as ::= */
{ yymsp[1].minor.yy0.n = 0; }
break;
- case 179: /* distinct ::= DISTINCT */
+ case 181: /* distinct ::= DISTINCT */
{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 181: /* from ::= FROM tablelist */
- case 182: /* from ::= FROM sub */ yytestcase(yyruleno==182);
+ case 183: /* from ::= FROM tablelist */
+ case 184: /* from ::= FROM sub */ yytestcase(yyruleno==184);
{yymsp[-1].minor.yy36 = yymsp[0].minor.yy36;}
break;
- case 183: /* sub ::= LP union RP */
+ case 185: /* sub ::= LP union RP */
{yymsp[-2].minor.yy36 = addSubqueryElem(NULL, yymsp[-1].minor.yy189, NULL);}
break;
- case 184: /* sub ::= LP union RP ids */
+ case 186: /* sub ::= LP union RP ids */
{yymsp[-3].minor.yy36 = addSubqueryElem(NULL, yymsp[-2].minor.yy189, &yymsp[0].minor.yy0);}
break;
- case 185: /* sub ::= sub COMMA LP union RP ids */
+ case 187: /* sub ::= sub COMMA LP union RP ids */
{yylhsminor.yy36 = addSubqueryElem(yymsp[-5].minor.yy36, yymsp[-2].minor.yy189, &yymsp[0].minor.yy0);}
yymsp[-5].minor.yy36 = yylhsminor.yy36;
break;
- case 186: /* tablelist ::= ids cpxName */
+ case 188: /* tablelist ::= ids cpxName */
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy36 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
}
yymsp[-1].minor.yy36 = yylhsminor.yy36;
break;
- case 187: /* tablelist ::= ids cpxName ids */
+ case 189: /* tablelist ::= ids cpxName ids */
{
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy36 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[-2].minor.yy36 = yylhsminor.yy36;
break;
- case 188: /* tablelist ::= tablelist COMMA ids cpxName */
+ case 190: /* tablelist ::= tablelist COMMA ids cpxName */
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy36 = setTableNameList(yymsp[-3].minor.yy36, &yymsp[-1].minor.yy0, NULL);
}
yymsp[-3].minor.yy36 = yylhsminor.yy36;
break;
- case 189: /* tablelist ::= tablelist COMMA ids cpxName ids */
+ case 191: /* tablelist ::= tablelist COMMA ids cpxName ids */
{
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy36 = setTableNameList(yymsp[-4].minor.yy36, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[-4].minor.yy36 = yylhsminor.yy36;
break;
- case 190: /* tmvar ::= VARIABLE */
+ case 192: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 191: /* timestamp ::= INTEGER */
+ case 193: /* timestamp ::= INTEGER */
{ yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 192: /* timestamp ::= MINUS INTEGER */
- case 193: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==193);
+ case 194: /* timestamp ::= MINUS INTEGER */
+ case 195: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==195);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy18 = yylhsminor.yy18;
break;
- case 194: /* timestamp ::= STRING */
+ case 196: /* timestamp ::= STRING */
{ yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 195: /* timestamp ::= NOW */
+ case 197: /* timestamp ::= NOW */
{ yylhsminor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 196: /* timestamp ::= NOW PLUS VARIABLE */
+ case 198: /* timestamp ::= NOW PLUS VARIABLE */
{yymsp[-2].minor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_PLUS); }
break;
- case 197: /* timestamp ::= NOW MINUS VARIABLE */
+ case 199: /* timestamp ::= NOW MINUS VARIABLE */
{yymsp[-2].minor.yy18 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_MINUS); }
break;
- case 198: /* range_option ::= */
+ case 200: /* range_option ::= */
{yymsp[1].minor.yy124.start = 0; yymsp[1].minor.yy124.end = 0;}
break;
- case 199: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */
+ case 201: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */
{yymsp[-5].minor.yy124.start = yymsp[-3].minor.yy18; yymsp[-5].minor.yy124.end = yymsp[-1].minor.yy18;}
break;
- case 200: /* interval_option ::= intervalKey LP tmvar RP */
+ case 202: /* interval_option ::= intervalKey LP tmvar RP */
{yylhsminor.yy32.interval = yymsp[-1].minor.yy0; yylhsminor.yy32.offset.n = 0; yylhsminor.yy32.token = yymsp[-3].minor.yy516;}
yymsp[-3].minor.yy32 = yylhsminor.yy32;
break;
- case 201: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
+ case 203: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{yylhsminor.yy32.interval = yymsp[-3].minor.yy0; yylhsminor.yy32.offset = yymsp[-1].minor.yy0; yylhsminor.yy32.token = yymsp[-5].minor.yy516;}
yymsp[-5].minor.yy32 = yylhsminor.yy32;
break;
- case 202: /* interval_option ::= */
+ case 204: /* interval_option ::= */
{memset(&yymsp[1].minor.yy32, 0, sizeof(yymsp[1].minor.yy32));}
break;
- case 203: /* intervalKey ::= INTERVAL */
+ case 205: /* intervalKey ::= INTERVAL */
{yymsp[0].minor.yy516 = TK_INTERVAL;}
break;
- case 204: /* intervalKey ::= EVERY */
+ case 206: /* intervalKey ::= EVERY */
{yymsp[0].minor.yy516 = TK_EVERY; }
break;
- case 205: /* session_option ::= */
+ case 207: /* session_option ::= */
{yymsp[1].minor.yy155.col.n = 0; yymsp[1].minor.yy155.gap.n = 0;}
break;
- case 206: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+ case 208: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
yymsp[-6].minor.yy155.col = yymsp[-4].minor.yy0;
yymsp[-6].minor.yy155.gap = yymsp[-1].minor.yy0;
}
break;
- case 207: /* windowstate_option ::= */
+ case 209: /* windowstate_option ::= */
{ yymsp[1].minor.yy336.col.n = 0; yymsp[1].minor.yy336.col.z = NULL;}
break;
- case 208: /* windowstate_option ::= STATE_WINDOW LP ids RP */
+ case 210: /* windowstate_option ::= STATE_WINDOW LP ids RP */
{ yymsp[-3].minor.yy336.col = yymsp[-1].minor.yy0; }
break;
- case 209: /* fill_opt ::= */
+ case 211: /* fill_opt ::= */
{ yymsp[1].minor.yy189 = 0; }
break;
- case 210: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ case 212: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
tVariant A = {0};
toTSDBType(yymsp[-3].minor.yy0.type);
- tVariantCreate(&A, &yymsp[-3].minor.yy0, true);
+ tVariantCreate(&A, &yymsp[-3].minor.yy0);
tVariantListInsert(yymsp[-1].minor.yy189, &A, -1, 0);
yymsp[-5].minor.yy189 = yymsp[-1].minor.yy189;
}
break;
- case 211: /* fill_opt ::= FILL LP ID RP */
+ case 213: /* fill_opt ::= FILL LP ID RP */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-3].minor.yy189 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1, true);
}
break;
- case 212: /* sliding_opt ::= SLIDING LP tmvar RP */
+ case 214: /* sliding_opt ::= SLIDING LP tmvar RP */
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; }
break;
- case 213: /* sliding_opt ::= */
+ case 215: /* sliding_opt ::= */
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
break;
- case 215: /* orderby_opt ::= ORDER BY sortlist */
+ case 217: /* orderby_opt ::= ORDER BY sortlist */
{yymsp[-2].minor.yy189 = yymsp[0].minor.yy189;}
break;
- case 216: /* sortlist ::= sortlist COMMA item sortorder */
+ case 218: /* sortlist ::= sortlist COMMA item sortorder */
{
yylhsminor.yy189 = commonItemAppend(yymsp[-3].minor.yy189, &yymsp[-1].minor.yy162, NULL, false, yymsp[0].minor.yy420);
}
yymsp[-3].minor.yy189 = yylhsminor.yy189;
break;
- case 217: /* sortlist ::= sortlist COMMA arrow sortorder */
+ case 219: /* sortlist ::= sortlist COMMA arrow sortorder */
{
yylhsminor.yy189 = commonItemAppend(yymsp[-3].minor.yy189, NULL, yymsp[-1].minor.yy18, true, yymsp[0].minor.yy420);
}
yymsp[-3].minor.yy189 = yylhsminor.yy189;
break;
- case 218: /* sortlist ::= item sortorder */
+ case 220: /* sortlist ::= item sortorder */
{
yylhsminor.yy189 = commonItemAppend(NULL, &yymsp[-1].minor.yy162, NULL, false, yymsp[0].minor.yy420);
}
yymsp[-1].minor.yy189 = yylhsminor.yy189;
break;
- case 219: /* sortlist ::= arrow sortorder */
+ case 221: /* sortlist ::= arrow sortorder */
{
yylhsminor.yy189 = commonItemAppend(NULL, NULL, yymsp[-1].minor.yy18, true, yymsp[0].minor.yy420);
}
yymsp[-1].minor.yy189 = yylhsminor.yy189;
break;
- case 220: /* item ::= ID */
+ case 222: /* item ::= ID */
{
toTSDBType(yymsp[0].minor.yy0.type);
- tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0, true);
+ tVariantCreate(&yylhsminor.yy162, &yymsp[0].minor.yy0);
}
yymsp[0].minor.yy162 = yylhsminor.yy162;
break;
- case 221: /* item ::= ID DOT ID */
+ case 223: /* item ::= ID DOT ID */
{
toTSDBType(yymsp[-2].minor.yy0.type);
yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n);
- tVariantCreate(&yylhsminor.yy162, &yymsp[-2].minor.yy0, true);
+ tVariantCreate(&yylhsminor.yy162, &yymsp[-2].minor.yy0);
}
yymsp[-2].minor.yy162 = yylhsminor.yy162;
break;
- case 222: /* sortorder ::= ASC */
+ case 224: /* sortorder ::= ASC */
{ yymsp[0].minor.yy420 = TSDB_ORDER_ASC; }
break;
- case 223: /* sortorder ::= DESC */
+ case 225: /* sortorder ::= DESC */
{ yymsp[0].minor.yy420 = TSDB_ORDER_DESC;}
break;
- case 224: /* sortorder ::= */
+ case 226: /* sortorder ::= */
{ yymsp[1].minor.yy420 = TSDB_ORDER_ASC; }
break;
- case 225: /* groupby_opt ::= */
+ case 227: /* groupby_opt ::= */
{ yymsp[1].minor.yy189 = 0;}
break;
- case 226: /* groupby_opt ::= GROUP BY grouplist */
+ case 228: /* groupby_opt ::= GROUP BY grouplist */
{ yymsp[-2].minor.yy189 = yymsp[0].minor.yy189;}
break;
- case 227: /* grouplist ::= grouplist COMMA item */
+ case 229: /* grouplist ::= grouplist COMMA item */
{
yylhsminor.yy189 = commonItemAppend(yymsp[-2].minor.yy189, &yymsp[0].minor.yy162, NULL, false, -1);
}
yymsp[-2].minor.yy189 = yylhsminor.yy189;
break;
- case 228: /* grouplist ::= grouplist COMMA arrow */
+ case 230: /* grouplist ::= grouplist COMMA arrow */
{
yylhsminor.yy189 = commonItemAppend(yymsp[-2].minor.yy189, NULL, yymsp[0].minor.yy18, true, -1);
}
yymsp[-2].minor.yy189 = yylhsminor.yy189;
break;
- case 229: /* grouplist ::= item */
+ case 231: /* grouplist ::= item */
{
yylhsminor.yy189 = commonItemAppend(NULL, &yymsp[0].minor.yy162, NULL, false, -1);
}
yymsp[0].minor.yy189 = yylhsminor.yy189;
break;
- case 230: /* grouplist ::= arrow */
+ case 232: /* grouplist ::= arrow */
{
yylhsminor.yy189 = commonItemAppend(NULL, NULL, yymsp[0].minor.yy18, true, -1);
}
yymsp[0].minor.yy189 = yylhsminor.yy189;
break;
- case 231: /* having_opt ::= */
- case 241: /* where_opt ::= */ yytestcase(yyruleno==241);
- case 291: /* expritem ::= */ yytestcase(yyruleno==291);
+ case 233: /* having_opt ::= */
+ case 243: /* where_opt ::= */ yytestcase(yyruleno==243);
+ case 293: /* expritem ::= */ yytestcase(yyruleno==293);
{yymsp[1].minor.yy18 = 0;}
break;
- case 232: /* having_opt ::= HAVING expr */
- case 242: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==242);
+ case 234: /* having_opt ::= HAVING expr */
+ case 244: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==244);
{yymsp[-1].minor.yy18 = yymsp[0].minor.yy18;}
break;
- case 233: /* limit_opt ::= */
- case 237: /* slimit_opt ::= */ yytestcase(yyruleno==237);
+ case 235: /* limit_opt ::= */
+ case 239: /* slimit_opt ::= */ yytestcase(yyruleno==239);
{yymsp[1].minor.yy38.limit = -1; yymsp[1].minor.yy38.offset = 0;}
break;
- case 234: /* limit_opt ::= LIMIT signed */
- case 238: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==238);
+ case 236: /* limit_opt ::= LIMIT signed */
+ case 240: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==240);
{yymsp[-1].minor.yy38.limit = yymsp[0].minor.yy69; yymsp[-1].minor.yy38.offset = 0;}
break;
- case 235: /* limit_opt ::= LIMIT signed OFFSET signed */
+ case 237: /* limit_opt ::= LIMIT signed OFFSET signed */
{ yymsp[-3].minor.yy38.limit = yymsp[-2].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[0].minor.yy69;}
break;
- case 236: /* limit_opt ::= LIMIT signed COMMA signed */
+ case 238: /* limit_opt ::= LIMIT signed COMMA signed */
{ yymsp[-3].minor.yy38.limit = yymsp[0].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[-2].minor.yy69;}
break;
- case 239: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
+ case 241: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
{yymsp[-3].minor.yy38.limit = yymsp[-2].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[0].minor.yy69;}
break;
- case 240: /* slimit_opt ::= SLIMIT signed COMMA signed */
+ case 242: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy38.limit = yymsp[0].minor.yy69; yymsp[-3].minor.yy38.offset = yymsp[-2].minor.yy69;}
break;
- case 243: /* expr ::= LP expr RP */
+ case 245: /* expr ::= LP expr RP */
{yylhsminor.yy18 = yymsp[-1].minor.yy18; yylhsminor.yy18->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy18->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 244: /* expr ::= ID */
+ case 246: /* expr ::= ID */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 245: /* expr ::= ID DOT ID */
+ case 247: /* expr ::= ID DOT ID */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 246: /* expr ::= ID DOT STAR */
+ case 248: /* expr ::= ID DOT STAR */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 247: /* expr ::= INTEGER */
+ case 249: /* expr ::= INTEGER */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 248: /* expr ::= MINUS INTEGER */
- case 249: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==249);
+ case 250: /* expr ::= MINUS INTEGER */
+ case 251: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==251);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy18 = yylhsminor.yy18;
break;
- case 250: /* expr ::= FLOAT */
+ case 252: /* expr ::= FLOAT */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 251: /* expr ::= MINUS FLOAT */
- case 252: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==252);
+ case 253: /* expr ::= MINUS FLOAT */
+ case 254: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==254);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);}
yymsp[-1].minor.yy18 = yylhsminor.yy18;
break;
- case 253: /* expr ::= STRING */
+ case 255: /* expr ::= STRING */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 254: /* expr ::= NOW */
+ case 256: /* expr ::= NOW */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 255: /* expr ::= VARIABLE */
+ case 257: /* expr ::= VARIABLE */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 256: /* expr ::= PLUS VARIABLE */
- case 257: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==257);
+ case 258: /* expr ::= PLUS VARIABLE */
+ case 259: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==259);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);}
yymsp[-1].minor.yy18 = yylhsminor.yy18;
break;
- case 258: /* expr ::= BOOL */
+ case 260: /* expr ::= BOOL */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 259: /* expr ::= NULL */
+ case 261: /* expr ::= NULL */
{ yylhsminor.yy18 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 260: /* expr ::= ID LP exprlist RP */
+ case 262: /* expr ::= ID LP exprlist RP */
{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy18 = tSqlExprCreateFunction(yymsp[-1].minor.yy189, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy18 = yylhsminor.yy18;
break;
- case 261: /* expr ::= ID LP STAR RP */
+ case 263: /* expr ::= ID LP STAR RP */
{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy18 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy18 = yylhsminor.yy18;
break;
- case 262: /* expr ::= ID LP expr AS typename RP */
+ case 264: /* expr ::= ID LP expr AS typename RP */
{ tStrTokenAppend(pInfo->funcs, &yymsp[-5].minor.yy0); yylhsminor.yy18 = tSqlExprCreateFuncWithParams(pInfo, yymsp[-3].minor.yy18, &yymsp[-1].minor.yy279, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, yymsp[-5].minor.yy0.type); }
yymsp[-5].minor.yy18 = yylhsminor.yy18;
break;
- case 263: /* expr ::= expr IS NULL */
+ case 265: /* expr ::= expr IS NULL */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, NULL, TK_ISNULL);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 264: /* expr ::= expr IS NOT NULL */
+ case 266: /* expr ::= expr IS NOT NULL */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-3].minor.yy18, NULL, TK_NOTNULL);}
yymsp[-3].minor.yy18 = yylhsminor.yy18;
break;
- case 265: /* expr ::= expr LT expr */
+ case 267: /* expr ::= expr LT expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_LT);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 266: /* expr ::= expr GT expr */
+ case 268: /* expr ::= expr GT expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_GT);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 267: /* expr ::= expr LE expr */
+ case 269: /* expr ::= expr LE expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_LE);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 268: /* expr ::= expr GE expr */
+ case 270: /* expr ::= expr GE expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_GE);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 269: /* expr ::= expr NE expr */
+ case 271: /* expr ::= expr NE expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_NE);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 270: /* expr ::= expr EQ expr */
+ case 272: /* expr ::= expr EQ expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_EQ);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 271: /* expr ::= expr BETWEEN expr AND expr */
+ case 273: /* expr ::= expr BETWEEN expr AND expr */
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy18); yylhsminor.yy18 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy18, yymsp[-2].minor.yy18, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy18, TK_LE), TK_AND);}
yymsp[-4].minor.yy18 = yylhsminor.yy18;
break;
- case 272: /* expr ::= expr AND expr */
+ case 274: /* expr ::= expr AND expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_AND);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 273: /* expr ::= expr OR expr */
+ case 275: /* expr ::= expr OR expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_OR); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 274: /* expr ::= expr PLUS expr */
+ case 276: /* expr ::= expr PLUS expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_PLUS); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 275: /* expr ::= expr MINUS expr */
+ case 277: /* expr ::= expr MINUS expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_MINUS); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 276: /* expr ::= expr STAR expr */
+ case 278: /* expr ::= expr STAR expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_STAR); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 277: /* expr ::= expr SLASH expr */
+ case 279: /* expr ::= expr SLASH expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_DIVIDE);}
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 278: /* expr ::= expr REM expr */
+ case 280: /* expr ::= expr REM expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_REM); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 279: /* expr ::= expr LIKE expr */
+ case 281: /* expr ::= expr LIKE expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_LIKE); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 280: /* expr ::= expr MATCH expr */
+ case 282: /* expr ::= expr MATCH expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_MATCH); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 281: /* expr ::= expr NMATCH expr */
+ case 283: /* expr ::= expr NMATCH expr */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-2].minor.yy18, yymsp[0].minor.yy18, TK_NMATCH); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 282: /* expr ::= ID CONTAINS STRING */
+ case 284: /* expr ::= ID CONTAINS STRING */
{ tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_CONTAINS); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 283: /* expr ::= ID DOT ID CONTAINS STRING */
+ case 285: /* expr ::= ID DOT ID CONTAINS STRING */
{ yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_CONTAINS); }
yymsp[-4].minor.yy18 = yylhsminor.yy18;
break;
- case 284: /* arrow ::= ID ARROW STRING */
+ case 286: /* arrow ::= ID ARROW STRING */
{tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_ARROW); }
yymsp[-2].minor.yy18 = yylhsminor.yy18;
break;
- case 285: /* arrow ::= ID DOT ID ARROW STRING */
+ case 287: /* arrow ::= ID DOT ID ARROW STRING */
{yymsp[-4].minor.yy0.n += (1+yymsp[-2].minor.yy0.n); tSqlExpr* S = tSqlExprCreateIdValue(pInfo, &yymsp[-4].minor.yy0, TK_ID); tSqlExpr* M = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING); yylhsminor.yy18 = tSqlExprCreate(S, M, TK_ARROW); }
yymsp[-4].minor.yy18 = yylhsminor.yy18;
break;
- case 286: /* expr ::= arrow */
- case 290: /* expritem ::= expr */ yytestcase(yyruleno==290);
+ case 288: /* expr ::= arrow */
+ case 292: /* expritem ::= expr */ yytestcase(yyruleno==292);
{yylhsminor.yy18 = yymsp[0].minor.yy18;}
yymsp[0].minor.yy18 = yylhsminor.yy18;
break;
- case 287: /* expr ::= expr IN LP exprlist RP */
+ case 289: /* expr ::= expr IN LP exprlist RP */
{yylhsminor.yy18 = tSqlExprCreate(yymsp[-4].minor.yy18, (tSqlExpr*)yymsp[-1].minor.yy189, TK_IN); }
yymsp[-4].minor.yy18 = yylhsminor.yy18;
break;
- case 288: /* exprlist ::= exprlist COMMA expritem */
+ case 290: /* exprlist ::= exprlist COMMA expritem */
{yylhsminor.yy189 = tSqlExprListAppend(yymsp[-2].minor.yy189,yymsp[0].minor.yy18,0, 0);}
yymsp[-2].minor.yy189 = yylhsminor.yy189;
break;
- case 289: /* exprlist ::= expritem */
+ case 291: /* exprlist ::= expritem */
{yylhsminor.yy189 = tSqlExprListAppend(0,yymsp[0].minor.yy18,0, 0);}
yymsp[0].minor.yy189 = yylhsminor.yy189;
break;
- case 292: /* cmd ::= RESET QUERY CACHE */
+ case 294: /* cmd ::= RESET QUERY CACHE */
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
break;
- case 293: /* cmd ::= SYNCDB ids REPLICA */
+ case 295: /* cmd ::= SYNCDB ids REPLICA */
{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
break;
- case 294: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ case 296: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 295: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ case 297: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3804,21 +3824,21 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 296: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
+ case 298: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 297: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ case 299: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 298: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ case 300: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3829,7 +3849,7 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 299: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ case 301: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -3843,7 +3863,7 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 300: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ case 302: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
@@ -3855,21 +3875,21 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 301: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
+ case 303: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 302: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ case 304: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 303: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ case 305: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3880,21 +3900,21 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 304: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
+ case 306: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 305: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ case 307: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 306: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ case 308: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3905,7 +3925,7 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 307: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ case 309: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -3919,7 +3939,7 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 308: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
+ case 310: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
@@ -3931,20 +3951,20 @@ static YYACTIONTYPE yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 309: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
+ case 311: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy189, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 310: /* cmd ::= KILL CONNECTION INTEGER */
+ case 312: /* cmd ::= KILL CONNECTION INTEGER */
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
break;
- case 311: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ case 313: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);}
break;
- case 312: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ case 314: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);}
break;
default:
diff --git a/src/tfs/src/tfs.c b/src/tfs/src/tfs.c
index 43ccb324b235c2bfed6b121ed2049474cc5ecb74..b3aabe177bd4c34151cbe2778825bed6262679ab 100644
--- a/src/tfs/src/tfs.c
+++ b/src/tfs/src/tfs.c
@@ -265,7 +265,10 @@ int tfsMkdirRecurAt(const char *rname, int level, int id) {
if (errno == ENOENT) {
// Try to create upper
char *s = strdup(rname);
-
+ if (strcmp(s, ".") == 0){ // TD-12238, if mkdir failed, rname will be ".", it will be always failed, so need to jump recursion
+ free(s);
+ return -1;
+ }
// Make a copy of dirname(s) because the implementation of 'dirname' differs on different platforms.
// Some platform may modify the contents of the string passed into dirname(). Others may return a pointer to
// internal static storage space that will be overwritten by next call. For case like that, we should not use
diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c
index 232d10a7d07594c9c62cd13767c320da27af2a73..7b5dafcc8e771ba7d6e7b5691226bbc84a556ef8 100644
--- a/src/util/src/tlog.c
+++ b/src/util/src/tlog.c
@@ -131,7 +131,7 @@ void taosCloseLog() {
taosStopLog();
//tsem_post(&(tsLogObj.logHandle->buffNotEmpty));
taosMsleep(MAX_LOG_INTERVAL/1000);
- if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
+ if (tsLogObj.logHandle && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
pthread_join(tsLogObj.logHandle->asyncThread, NULL);
}
// In case that other threads still use log resources causing invalid write in valgrind
diff --git a/src/util/src/tnettest.c b/src/util/src/tnettest.c
index 8dc2d4c993e001c95f63d72c60db8b8fe3ac3df8..7d1076abbf1eb0c35385b769bfc6a88cfd8a21a7 100644
--- a/src/util/src/tnettest.c
+++ b/src/util/src/tnettest.c
@@ -356,7 +356,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
epSet.inUse = 0;
epSet.numOfEps = 1;
epSet.port[0] = port;
- strcpy(epSet.fqdn[0], serverFqdn);
+ tstrncpy(epSet.fqdn[0], serverFqdn, sizeof(epSet.fqdn[0]));
reqMsg.msgType = TSDB_MSG_TYPE_NETWORK_TEST;
reqMsg.pCont = rpcMallocCont(pktLen);
@@ -364,7 +364,7 @@ static int32_t taosNetCheckRpc(const char* serverFqdn, uint16_t port, uint16_t p
reqMsg.code = 0;
reqMsg.handle = NULL; // rpc handle returned to app
reqMsg.ahandle = NULL; // app handle set by client
- strcpy(reqMsg.pCont, "nettest");
+ tstrncpy((char*)reqMsg.pCont, "nettest", pktLen);
rpcSendRecv(pRpcConn, &epSet, &reqMsg, &rspMsg);
@@ -606,7 +606,7 @@ static void taosNetCheckSpeed(char *host, int32_t port, int32_t pkgLen,
epSet.inUse = 0;
epSet.numOfEps = 1;
epSet.port[0] = port;
- strcpy(epSet.fqdn[0], host);
+ tstrncpy(epSet.fqdn[0], host, sizeof(epSet.fqdn[0]));
reqMsg.msgType = TSDB_MSG_TYPE_NETWORK_TEST;
reqMsg.pCont = rpcMallocCont(pkgLen);
@@ -614,8 +614,8 @@ static void taosNetCheckSpeed(char *host, int32_t port, int32_t pkgLen,
reqMsg.code = 0;
reqMsg.handle = NULL; // rpc handle returned to app
reqMsg.ahandle = NULL; // app handle set by client
- strcpy(reqMsg.pCont, "nettest speed");
-
+ tstrncpy((char*)reqMsg.pCont, "nettest speed", pkgLen);
+
rpcSendRecv(pRpcConn, &epSet, &reqMsg, &rspMsg);
int code = 0;
diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c
index c15197b7537601c0f0ca72420a6711547d1ed0ed..02498e222212fada5b7a9f39fbcfe5c76494a651 100644
--- a/src/util/src/tutil.c
+++ b/src/util/src/tutil.c
@@ -57,36 +57,32 @@ int32_t strdequote(char *z) {
return j + 1; // only one quote, do nothing
}
-
+// delete escape character: \\, \', \"
int32_t strRmquote(char *z, int32_t len){
- // delete escape character: \\, \', \"
- char delim = z[0];
- if (delim != '\'' && delim != '\"') {
- return len;
+ char delim = 0;
+ int32_t cnt = 0;
+ int32_t j = 0;
+ for (size_t k = 0; k < len; ++k) {
+ if (!delim && (z[k] == '\'' || z[k] == '"')){ // find the start ' or "
+ delim = z[k];
}
- int32_t cnt = 0;
- int32_t j = 0;
- for (uint32_t k = 1; k < len - 1; ++k) {
- if (z[k] == '\\' || (z[k] == delim && z[k + 1] == delim)) {
- if ((z[k] == '\\' && z[k + 1] == '_') || (z[k] == '\\' && z[k + 1] == '%')) {
- //match '_' self
- } else {
- z[j] = z[k + 1];
- cnt++;
- j++;
- k++;
- continue;
- }
- }
-
- z[j] = z[k];
+ if ((z[k] == '\\' && z[k + 1] == '_') || (z[k] == '\\' && z[k + 1] == '%')) {
+ //match '_' '%' self
+ }else if(z[k] == '\\'){
+ z[j] = z[k + 1];
+ cnt++;
j++;
+ k++;
+ continue;
+ }else if(z[k] == delim){
+ continue;
}
-
- z[j] = 0;
-
- return len - 2 - cnt;
+ z[j] = z[k];
+ j++;
+ }
+ z[j] = 0;
+ return j;
}
int32_t strRmquoteEscape(char *z, int32_t len) {
diff --git a/src/util/tests/stringTest.cpp b/src/util/tests/stringTest.cpp
index 95fba0cd3e2b62da2b2dadb0b7e592aef5893543..e304ccaec6753ed627418ea8bf2fd428ae710859 100644
--- a/src/util/tests/stringTest.cpp
+++ b/src/util/tests/stringTest.cpp
@@ -6,6 +6,44 @@
#include "taos.h"
#include "tutil.h"
+TEST(testCase, str_rmquote_test) {
+ char t1[] = "\"\".dd";
+ int32_t len = strRmquote(t1, strlen(t1));
+ printf("t1:%s, len:%d\n", t1, len);
+ EXPECT_EQ(3, len);
+ EXPECT_STRCASEEQ(t1, ".dd");
+
+ char t2[] = "\"fsd\\\"fs\".dd";
+ len = strRmquote(t2, strlen(t2));
+ printf("t2:%s, len:%d\n", t2, len);
+ EXPECT_EQ(9, len);
+ EXPECT_STRCASEEQ(t2, "fsd\"fs.dd");
+
+ char t3[] = "fs\\_d\\%.d\\d";
+ len = strRmquote(t3, strlen(t3));
+ printf("t3:%s, len:%d\n", t3, len);
+ EXPECT_EQ(10, len);
+ EXPECT_STRCASEEQ(t3, "fs\\_d\\%.dd");
+
+ char t4[] = "\"fs\\_d\\%\".dd";
+ len = strRmquote(t4, strlen(t4));
+ printf("t4:%s, len:%d\n", t4, len);
+ EXPECT_EQ(10, len);
+ EXPECT_STRCASEEQ(t4, "fs\\_d\\%.dd");
+
+ char t5[] = "\"fs\\_d\\%\"";
+ len = strRmquote(t5, strlen(t5));
+ printf("t5:%s, len:%d\n", t5, len);
+ EXPECT_EQ(7, len);
+ EXPECT_STRCASEEQ(t5, "fs\\_d\\%");
+
+ char t6[] = "'fs\\_d\\%'";
+ len = strRmquote(t6, strlen(t6));
+ printf("t6:%s, len:%d\n", t6, len);
+ EXPECT_EQ(7, len);
+ EXPECT_STRCASEEQ(t6, "fs\\_d\\%");
+}
+
TEST(testCase, string_dequote_test) {
char t1[] = "'abc'";
int32_t len = strdequote(t1);
diff --git a/tests/develop-test/0-management/3-tag/json_tag.py b/tests/develop-test/0-management/3-tag/json_tag.py
index 4810ec8b4e2437f5aecbb67a10c8d2ce4e5c55c5..b6a15ca770ea7e4885973a03bfc8e3bd08c3f54d 100644
--- a/tests/develop-test/0-management/3-tag/json_tag.py
+++ b/tests/develop-test/0-management/3-tag/json_tag.py
@@ -16,6 +16,7 @@ import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
+import json
class TDTestCase:
@@ -74,6 +75,10 @@ class TDTestCase:
tdSql.error("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"\t\":\"fff\"}')")
tdSql.error("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"试试\":\"fff\"}')")
+ # test invalidate json value, value number can not be inf,nan TD-12166
+ tdSql.error("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"k\":1.8e308}')")
+ tdSql.error("CREATE TABLE if not exists jsons1_14 using jsons1 tags('{\"k\":-1.8e308}')")
+
#test length limit
char1= ''.join(['abcd']*64)
char3= ''.join(['abcd']*1022)
@@ -505,6 +510,11 @@ class TDTestCase:
tdSql.query("select round(dataint) from jsons1 where jtag->'tag1'>1")
tdSql.checkRows(3)
+ #test TD-12077
+ tdSql.execute("insert into jsons1_16 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":-2.111}') values(1591062628000, 2, NULL, '你就会', 'dws')")
+ tdSql.query("select jtag->'tag3' from jsons1_16")
+ tdSql.checkData(0, 0, '-2.111000000')
+
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
diff --git a/tests/develop-test/1-insert/0-sql/basic.py b/tests/develop-test/1-insert/0-sql/basic.py
deleted file mode 100644
index 273ff8ba488db609cfa4aa5978c689288d14750b..0000000000000000000000000000000000000000
--- a/tests/develop-test/1-insert/0-sql/basic.py
+++ /dev/null
@@ -1,68 +0,0 @@
-###################################################################
-# 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
-#
-###################################################################
-
-# -*- coding: utf-8 -*-
-
-import sys
-from util.log import *
-from util.cases import *
-from util.sql import *
-
-
-class TDTestCase:
- def caseDescription(self):
- '''
- case1: insert 倒序插入
- case2: 语法解析错误同时meta请求也发出去了导致callback中处理逻辑失效
- case3: [TD-XXXX]insert语句在values之间加入多个逗号
- '''
- return
-
- def init(self, conn, logSql):
- tdLog.debug("start to execute %s" % __file__)
- tdSql.init(conn.cursor(), logSql)
-
- def run(self):
- tdSql.prepare()
-
- ret = tdSql.execute('create table tb (ts timestamp, speed int)')
-
- insertRows = 10
- tdLog.info("insert %d rows" % (insertRows))
- for i in range(0, insertRows):
- ret = tdSql.execute(
- 'insert into tb values (now + %dm, %d)' %
- (i, i))
-
- tdLog.info("insert earlier data")
- tdSql.execute('insert into tb values (now - 5m , 10)')
- tdSql.execute('insert into tb values (now - 6m , 10)')
- tdSql.execute('insert into tb values (now - 7m , 10)')
- tdSql.execute('insert into tb values (now - 8m , 10)')
-
- tdSql.query("select * from tb")
- tdSql.checkRows(insertRows + 4)
-
- # test case for https://jira.taosdata.com:18080/browse/TD-3716:
- tdSql.error("insert into tb(now, 1)")
- # test case for TD-10717
- tdSql.error("insert into tb values(now,1),,(now+1s,1)")
- tdSql.execute("insert into tb values(now+2s,1),(now+3s,1),(now+4s,1)")
- tdSql.query("select * from tb")
- tdSql.checkRows(insertRows + 4 +3)
-
- def stop(self):
- tdSql.close()
- tdLog.success("%s successfully executed" % __file__)
-
-
-tdCases.addWindows(__file__, TDTestCase())
-tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/develop-test/fulltest.sh b/tests/develop-test/fulltest.sh
index 9ec1dd23ac27928950befc35bd49ba8b4e6270eb..bccf17e8bbf26280de4d77b6c4bb671df842dcaf 100755
--- a/tests/develop-test/fulltest.sh
+++ b/tests/develop-test/fulltest.sh
@@ -1,3 +1,2 @@
python3 test.py -f 0-management/3-tag/json_tag.py
-python3 test.py -f 1-insert/0-sql/basic.py
-python3 test.py -f 1-insert/0-sql/batchInsert.py
\ No newline at end of file
+python3 test.py -f 1-insert/0-sql/batchInsert.py
diff --git a/tests/examples/C#/C#checker/TDengineDriver.cs b/tests/examples/C#/C#checker/TDengineDriver.cs
deleted file mode 100644
index 0f6477ff75a9b457069112c477746dd036c71251..0000000000000000000000000000000000000000
--- a/tests/examples/C#/C#checker/TDengineDriver.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2019 TAOS Data, Inc.
- *
- * This program is free software: you can use, redistribute, and/or modify
- * it under the terms of the GNU Affero General Public License, version 3
- * or later ("AGPL"), as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-
-namespace TDengineDriver
-{
- enum TDengineDataType
- {
- TSDB_DATA_TYPE_NULL = 0, // 1 bytes
- TSDB_DATA_TYPE_BOOL = 1, // 1 bytes
- TSDB_DATA_TYPE_TINYINT = 2, // 1 bytes
- TSDB_DATA_TYPE_SMALLINT = 3, // 2 bytes
- TSDB_DATA_TYPE_INT = 4, // 4 bytes
- TSDB_DATA_TYPE_BIGINT = 5, // 8 bytes
- TSDB_DATA_TYPE_FLOAT = 6, // 4 bytes
- TSDB_DATA_TYPE_DOUBLE = 7, // 8 bytes
- TSDB_DATA_TYPE_BINARY = 8, // string
- TSDB_DATA_TYPE_TIMESTAMP = 9,// 8 bytes
- TSDB_DATA_TYPE_NCHAR = 10, // unicode string
- TSDB_DATA_TYPE_UTINYINT = 11,// 1 byte
- TSDB_DATA_TYPE_USMALLINT= 12,// 2 bytes
- TSDB_DATA_TYPE_UINT = 13, // 4 bytes
- TSDB_DATA_TYPE_UBIGINT= 14 // 8 bytes
- }
-
- enum TDengineInitOption
- {
- TSDB_OPTION_LOCALE = 0,
- TSDB_OPTION_CHARSET = 1,
- TSDB_OPTION_TIMEZONE = 2,
- TDDB_OPTION_CONFIGDIR = 3,
- TDDB_OPTION_SHELL_ACTIVITY_TIMER = 4
- }
-
- class TDengineMeta
- {
- public string name;
- public short size;
- public byte type;
- public string TypeName()
- {
- switch ((TDengineDataType)type)
- {
- case TDengineDataType.TSDB_DATA_TYPE_BOOL:
- return "BOOL";
- case TDengineDataType.TSDB_DATA_TYPE_TINYINT:
- return "TINYINT";
- case TDengineDataType.TSDB_DATA_TYPE_SMALLINT:
- return "SMALLINT";
- case TDengineDataType.TSDB_DATA_TYPE_INT:
- return "INT";
- case TDengineDataType.TSDB_DATA_TYPE_BIGINT:
- return "BIGINT";
- case TDengineDataType.TSDB_DATA_TYPE_UTINYINT:
- return "TINYINT UNSIGNED";
- case TDengineDataType.TSDB_DATA_TYPE_USMALLINT:
- return "SMALLINT UNSIGNED";
- case TDengineDataType.TSDB_DATA_TYPE_UINT:
- return "INT UNSIGNED";
- case TDengineDataType.TSDB_DATA_TYPE_UBIGINT:
- return "BIGINT UNSIGNED";
- case TDengineDataType.TSDB_DATA_TYPE_FLOAT:
- return "FLOAT";
- case TDengineDataType.TSDB_DATA_TYPE_DOUBLE:
- return "DOUBLE";
- case TDengineDataType.TSDB_DATA_TYPE_BINARY:
- return "STRING";
- case TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP:
- return "TIMESTAMP";
- case TDengineDataType.TSDB_DATA_TYPE_NCHAR:
- return "NCHAR";
- default:
- return "undefine";
- }
- }
- }
-
- class TDengine
- {
- public const int TSDB_CODE_SUCCESS = 0;
-
- [DllImport("taos", EntryPoint = "taos_init", CallingConvention = CallingConvention.Cdecl)]
- static extern public void Init();
-
- [DllImport("taos", EntryPoint = "taos_cleanup", CallingConvention = CallingConvention.Cdecl)]
- static extern public void Cleanup();
-
- [DllImport("taos", EntryPoint = "taos_options", CallingConvention = CallingConvention.Cdecl)]
- static extern public void Options(int option, string value);
-
- [DllImport("taos", EntryPoint = "taos_connect", CallingConvention = CallingConvention.Cdecl)]
- static extern public IntPtr Connect(string ip, string user, string password, string db, short port);
-
- [DllImport("taos", EntryPoint = "taos_errstr", CallingConvention = CallingConvention.Cdecl)]
- static extern private IntPtr taos_errstr(IntPtr res);
- static public string Error(IntPtr res)
- {
- IntPtr errPtr = taos_errstr(res);
- return Marshal.PtrToStringAnsi(errPtr);
- }
-
- [DllImport("taos", EntryPoint = "taos_errno", CallingConvention = CallingConvention.Cdecl)]
- static extern public int ErrorNo(IntPtr res);
-
- [DllImport("taos", EntryPoint = "taos_query", CallingConvention = CallingConvention.Cdecl)]
- static extern public IntPtr Query(IntPtr conn, string sqlstr);
-
- [DllImport("taos", EntryPoint = "taos_affected_rows", CallingConvention = CallingConvention.Cdecl)]
- static extern public int AffectRows(IntPtr res);
-
- [DllImport("taos", EntryPoint = "taos_field_count", CallingConvention = CallingConvention.Cdecl)]
- static extern public int FieldCount(IntPtr res);
-
- [DllImport("taos", EntryPoint = "taos_fetch_fields", CallingConvention = CallingConvention.Cdecl)]
- static extern private IntPtr taos_fetch_fields(IntPtr res);
- static public List FetchFields(IntPtr res)
- {
- const int fieldSize = 68;
-
- List metas = new List();
- if (res == IntPtr.Zero)
- {
- return metas;
- }
-
- int fieldCount = FieldCount(res);
- IntPtr fieldsPtr = taos_fetch_fields(res);
-
- for (int i = 0; i < fieldCount; ++i)
- {
- int offset = i * fieldSize;
-
- TDengineMeta meta = new TDengineMeta();
- meta.name = Marshal.PtrToStringAnsi(fieldsPtr + offset);
- meta.type = Marshal.ReadByte(fieldsPtr + offset + 65);
- meta.size = Marshal.ReadInt16(fieldsPtr + offset + 66);
- metas.Add(meta);
- }
-
- return metas;
- }
-
- [DllImport("taos", EntryPoint = "taos_fetch_row", CallingConvention = CallingConvention.Cdecl)]
- static extern public IntPtr FetchRows(IntPtr res);
-
- [DllImport("taos", EntryPoint = "taos_free_result", CallingConvention = CallingConvention.Cdecl)]
- static extern public IntPtr FreeResult(IntPtr res);
-
- [DllImport("taos", EntryPoint = "taos_close", CallingConvention = CallingConvention.Cdecl)]
- static extern public int Close(IntPtr taos);
-
- //get precision in restultset
- [DllImport("taos", EntryPoint = "taos_result_precision", CallingConvention = CallingConvention.Cdecl)]
- static extern public int ResultPrecision(IntPtr taos);
-
- //schemaless API
- [DllImport("taos",SetLastError = true, EntryPoint = "taos_schemaless_insert", CallingConvention = CallingConvention.Cdecl)]
- static extern public IntPtr SchemalessInsert(IntPtr taos, string[] lines, int numLines, int protocol, int precision);
- }
-}
diff --git a/tests/examples/C#/TDengineTest/TDengineTest.cs b/tests/examples/C#/TDengineTest/TDengineTest.cs
index 89ef57bd41ac8f68ac2bc34e4ebe5ad90d213b17..9f84634ffb400e5d891a9fdeaeee0c013829f969 100644
--- a/tests/examples/C#/TDengineTest/TDengineTest.cs
+++ b/tests/examples/C#/TDengineTest/TDengineTest.cs
@@ -168,7 +168,7 @@ namespace TDengineDriver
host = this.GetArgumentAsString(argv, "-h", "127.0.0.1");
user = this.GetArgumentAsString(argv, "-u", "root");
password = this.GetArgumentAsString(argv, "-p", "taosdata");
- dbName = this.GetArgumentAsString(argv, "-d", "db");
+ dbName = this.GetArgumentAsString(argv, "-d", "tdengint_test_cs");
stableName = this.GetArgumentAsString(argv, "-s", "st");
tablePrefix = this.GetArgumentAsString(argv, "-t", "t");
isInsertData = this.GetArgumentAsLong(argv, "-w", 0, 1, 1) != 0;
diff --git a/tests/examples/C#/schemaless/schemaless.csproj b/tests/examples/C#/schemaless/schemaless.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..d132e34589525826d5b0ff0f0055156fad2d5a38
--- /dev/null
+++ b/tests/examples/C#/schemaless/schemaless.csproj
@@ -0,0 +1,12 @@
+
+
+
+ Exe
+ net5.0
+
+
+
+
+
+
+
diff --git a/tests/examples/C#/taosdemo/taosdemo.cs b/tests/examples/C#/taosdemo/taosdemo.cs
index e092c48f15314f5cad0a9509190d7b9970a7073a..e62a502d1508c1339e559160b50da39e622a021f 100644
--- a/tests/examples/C#/taosdemo/taosdemo.cs
+++ b/tests/examples/C#/taosdemo/taosdemo.cs
@@ -118,7 +118,7 @@ namespace TDengineDriver
port = (short)this.GetArgumentAsLong(argv, "-p", 0, 65535, 6030);
user = this.GetArgumentAsString(argv, "-u", "root");
password = this.GetArgumentAsString(argv, "-P", "taosdata");
- dbName = this.GetArgumentAsString(argv, "-d", "db");
+ dbName = this.GetArgumentAsString(argv, "-d", "taosdemo_cs");
stablePrefix = this.GetArgumentAsString(argv, "-s", "st");
tablePrefix = this.GetArgumentAsString(argv, "-m", "t");
isInsertOnly = this.GetArgumentAsFlag(argv, "-x", true);
@@ -361,7 +361,10 @@ namespace TDengineDriver
threadArr[i] = new Thread(createTableThread.ThreadMain);
threadArr[i].Start();
- threadArr[i].Join();
+ }
+ for (int j = 0; j < numOfThreads; j++)
+ {
+ threadArr[j].Join();
}
}
@@ -482,7 +485,10 @@ namespace TDengineDriver
threadArr[i] = new Thread(insertThread.ThreadMain);
threadArr[i].Start();
- threadArr[i].Join();
+ }
+ for (int j = 0; j < numOfThreads; j++)
+ {
+ threadArr[j].Join();
}
}
diff --git a/tests/examples/JDBC/JDBCDemo/pom.xml b/tests/examples/JDBC/JDBCDemo/pom.xml
index 5f0e35fa8f739453651ce3a7af092437531c00c6..b0b07d58f4e59645e5ebe78a938d0043558a9c80 100644
--- a/tests/examples/JDBC/JDBCDemo/pom.xml
+++ b/tests/examples/JDBC/JDBCDemo/pom.xml
@@ -17,7 +17,7 @@
com.taosdata.jdbc
taos-jdbcdriver
- 2.0.35
+ 2.0.36
diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ClientParameterSetting.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ClientParameterSetting.java
new file mode 100644
index 0000000000000000000000000000000000000000..09fb8f1b19f069305464a52df15f748d29ddd5d8
--- /dev/null
+++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ClientParameterSetting.java
@@ -0,0 +1,54 @@
+package com.taosdata.example;
+
+import com.taosdata.jdbc.TSDBDriver;
+
+import java.sql.*;
+import java.util.Properties;
+
+public class ClientParameterSetting {
+ private static final String host = "127.0.0.1";
+
+ public static void main(String[] args) throws SQLException {
+ setParameterInJdbcUrl();
+
+ setParameterInProperties();
+ }
+
+ private static void setParameterInJdbcUrl() throws SQLException {
+ String jdbcUrl = "jdbc:TAOS://" + host + ":6030/?debugFlag=135&asyncLog=0";
+
+ Connection connection = DriverManager.getConnection(jdbcUrl, "root", "taosdata");
+
+ printDatabase(connection);
+
+ connection.close();
+ }
+
+ private static void setParameterInProperties() throws SQLException {
+ String jdbcUrl = "jdbc:TAOS://" + host + ":6030/";
+ Properties properties = new Properties();
+ properties.setProperty("user", "root");
+ properties.setProperty("password", "taosdata");
+ properties.setProperty("debugFlag", "135");
+ properties.setProperty("asyncLog", "0");
+ properties.setProperty("maxSQLLength", "1048576");
+
+ try (Connection conn = DriverManager.getConnection(jdbcUrl, properties)) {
+ printDatabase(conn);
+ }
+ }
+
+ private static void printDatabase(Connection connection) throws SQLException {
+ try (Statement stmt = connection.createStatement()) {
+ ResultSet rs = stmt.executeQuery("show databases");
+
+ ResultSetMetaData meta = rs.getMetaData();
+ while (rs.next()) {
+ for (int i = 1; i <= meta.getColumnCount(); i++) {
+ System.out.print(meta.getColumnLabel(i) + ": " + rs.getString(i) + "\t");
+ }
+ System.out.println();
+ }
+ }
+ }
+}
diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ParameterBindingDemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ParameterBindingDemo.java
new file mode 100644
index 0000000000000000000000000000000000000000..726b57b1465f678d703f0dc9c524f92b856e034e
--- /dev/null
+++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ParameterBindingDemo.java
@@ -0,0 +1,237 @@
+package com.taosdata.example;
+
+import com.taosdata.jdbc.TSDBPreparedStatement;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Random;
+
+public class ParameterBindingDemo {
+
+ private static final String host = "127.0.0.1";
+ private static final Random random = new Random(System.currentTimeMillis());
+ private static final int BINARY_COLUMN_SIZE = 20;
+ private static final String[] schemaList = {
+ "create table stable1(ts timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint) tags(t1 tinyint, t2 smallint, t3 int, t4 bigint)",
+ "create table stable2(ts timestamp, f1 float, f2 double) tags(t1 float, t2 double)",
+ "create table stable3(ts timestamp, f1 bool) tags(t1 bool)",
+ "create table stable4(ts timestamp, f1 binary(" + BINARY_COLUMN_SIZE + ")) tags(t1 binary(" + BINARY_COLUMN_SIZE + "))",
+ "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))"
+ };
+ private static final int numOfSubTable = 10, numOfRow = 10;
+
+ public static void main(String[] args) throws SQLException {
+
+ String jdbcUrl = "jdbc:TAOS://" + host + ":6030/";
+ Connection conn = DriverManager.getConnection(jdbcUrl, "root", "taosdata");
+
+ init(conn);
+
+ bindInteger(conn);
+
+ bindFloat(conn);
+
+ bindBoolean(conn);
+
+ bindBytes(conn);
+
+ bindString(conn);
+
+ conn.close();
+ }
+
+ private static void init(Connection conn) throws SQLException {
+ try (Statement stmt = conn.createStatement()) {
+ stmt.execute("drop database if exists test_parabind");
+ stmt.execute("create database if not exists test_parabind");
+ stmt.execute("use test_parabind");
+ for (int i = 0; i < schemaList.length; i++) {
+ stmt.execute(schemaList[i]);
+ }
+ }
+ }
+
+ private static void bindInteger(Connection conn) throws SQLException {
+ String sql = "insert into ? using stable1 tags(?,?,?,?) values(?,?,?,?,?)";
+
+ try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) {
+
+ for (int i = 1; i <= numOfSubTable; i++) {
+ // set table name
+ pstmt.setTableName("t1_" + i);
+ // set tags
+ pstmt.setTagByte(0, Byte.parseByte(Integer.toString(random.nextInt(Byte.MAX_VALUE))));
+ pstmt.setTagShort(1, Short.parseShort(Integer.toString(random.nextInt(Short.MAX_VALUE))));
+ pstmt.setTagInt(2, random.nextInt(Integer.MAX_VALUE));
+ pstmt.setTagLong(3, random.nextLong());
+ // set columns
+ ArrayList tsList = new ArrayList<>();
+ long current = System.currentTimeMillis();
+ for (int j = 0; j < numOfRow; j++)
+ tsList.add(current + j);
+ pstmt.setTimestamp(0, tsList);
+
+ ArrayList f1List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f1List.add(Byte.parseByte(Integer.toString(random.nextInt(Byte.MAX_VALUE))));
+ pstmt.setByte(1, f1List);
+
+ ArrayList f2List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f2List.add(Short.parseShort(Integer.toString(random.nextInt(Short.MAX_VALUE))));
+ pstmt.setShort(2, f2List);
+
+ ArrayList f3List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f3List.add(random.nextInt(Integer.MAX_VALUE));
+ pstmt.setInt(3, f3List);
+
+ ArrayList f4List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f4List.add(random.nextLong());
+ pstmt.setLong(4, f4List);
+
+ // add column
+ pstmt.columnDataAddBatch();
+ }
+ // execute column
+ pstmt.columnDataExecuteBatch();
+ }
+
+ }
+
+ private static void bindFloat(Connection conn) throws SQLException {
+ String sql = "insert into ? using stable2 tags(?,?) values(?,?,?)";
+
+ TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class);
+
+ for (int i = 1; i <= numOfSubTable; i++) {
+ // set table name
+ pstmt.setTableName("t2_" + i);
+ // set tags
+ pstmt.setTagFloat(0, random.nextFloat());
+ pstmt.setTagDouble(1, random.nextDouble());
+ // set columns
+ ArrayList tsList = new ArrayList<>();
+ long current = System.currentTimeMillis();
+ for (int j = 0; j < numOfRow; j++)
+ tsList.add(current + j);
+ pstmt.setTimestamp(0, tsList);
+
+ ArrayList f1List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f1List.add(random.nextFloat());
+ pstmt.setFloat(1, f1List);
+
+ ArrayList f2List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f2List.add(random.nextDouble());
+ pstmt.setDouble(2, f2List);
+
+ // add column
+ pstmt.columnDataAddBatch();
+ }
+ // execute
+ pstmt.columnDataExecuteBatch();
+ // close if no try-with-catch statement is used
+ pstmt.close();
+ }
+
+ private static void bindBoolean(Connection conn) throws SQLException {
+ String sql = "insert into ? using stable3 tags(?) values(?,?)";
+
+ try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) {
+ for (int i = 1; i <= numOfSubTable; i++) {
+ // set table name
+ pstmt.setTableName("t3_" + i);
+ // set tags
+ pstmt.setTagBoolean(0, random.nextBoolean());
+ // set columns
+ ArrayList tsList = new ArrayList<>();
+ long current = System.currentTimeMillis();
+ for (int j = 0; j < numOfRow; j++)
+ tsList.add(current + j);
+ pstmt.setTimestamp(0, tsList);
+
+ ArrayList f1List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++)
+ f1List.add(random.nextBoolean());
+ pstmt.setBoolean(1, f1List);
+
+ // add column
+ pstmt.columnDataAddBatch();
+ }
+ // execute
+ pstmt.columnDataExecuteBatch();
+ }
+ }
+
+ private static void bindBytes(Connection conn) throws SQLException {
+ String sql = "insert into ? using stable4 tags(?) values(?,?)";
+
+ try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) {
+
+ for (int i = 1; i <= numOfSubTable; i++) {
+ // set table name
+ pstmt.setTableName("t4_" + i);
+ // set tags
+ pstmt.setTagString(0, new String("abc"));
+
+ // set columns
+ ArrayList tsList = new ArrayList<>();
+ long current = System.currentTimeMillis();
+ for (int j = 0; j < numOfRow; j++)
+ tsList.add(current + j);
+ pstmt.setTimestamp(0, tsList);
+
+ ArrayList f1List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++) {
+ f1List.add(new String("abc"));
+ }
+ pstmt.setString(1, f1List, BINARY_COLUMN_SIZE);
+
+ // add column
+ pstmt.columnDataAddBatch();
+ }
+ // execute
+ pstmt.columnDataExecuteBatch();
+ }
+ }
+
+ private static void bindString(Connection conn) throws SQLException {
+ String sql = "insert into ? using stable5 tags(?) values(?,?)";
+
+ try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) {
+
+ for (int i = 1; i <= numOfSubTable; i++) {
+ // set table name
+ pstmt.setTableName("t5_" + i);
+ // set tags
+ pstmt.setTagNString(0, "北京-abc");
+
+ // set columns
+ ArrayList tsList = new ArrayList<>();
+ long current = System.currentTimeMillis();
+ for (int j = 0; j < numOfRow; j++)
+ tsList.add(current + j);
+ pstmt.setTimestamp(0, tsList);
+
+ ArrayList f1List = new ArrayList<>();
+ for (int j = 0; j < numOfRow; j++) {
+ f1List.add("北京-abc");
+ }
+ pstmt.setNString(1, f1List, BINARY_COLUMN_SIZE);
+
+ // add column
+ pstmt.columnDataAddBatch();
+ }
+ // execute
+ pstmt.columnDataExecuteBatch();
+ }
+ }
+
+
+}
diff --git a/tests/examples/JDBC/connectionPools/pom.xml b/tests/examples/JDBC/connectionPools/pom.xml
index 91f1cb36f28840b7d5eeb428aca3f940365ed59d..aad2923b823c1fcf2cb87eba4f18865fede063a1 100644
--- a/tests/examples/JDBC/connectionPools/pom.xml
+++ b/tests/examples/JDBC/connectionPools/pom.xml
@@ -53,7 +53,7 @@
org.apache.logging.log4j
log4j-core
- 2.15.0
+ 2.17.0
diff --git a/tests/examples/JDBC/taosdemo/pom.xml b/tests/examples/JDBC/taosdemo/pom.xml
index c6e61f5d22ca83c5d56deef7db9354913a3321b1..23c74ef1b72e0f2fd8b2a647a798872062a9c216 100644
--- a/tests/examples/JDBC/taosdemo/pom.xml
+++ b/tests/examples/JDBC/taosdemo/pom.xml
@@ -88,7 +88,7 @@
org.apache.logging.log4j
log4j-core
- 2.15.0
+ 2.17.0
diff --git a/tests/examples/c/makefile b/tests/examples/c/makefile
index 83a9a75271ef5d841a784b69c328e12c0cdf36be..355d1a2d54c1293e909309dafe986daa716ac293 100644
--- a/tests/examples/c/makefile
+++ b/tests/examples/c/makefile
@@ -25,7 +25,6 @@ clean:
rm $(ROOT)asyncdemo
rm $(ROOT)demo
rm $(ROOT)prepare
- rm $(ROOT)batchprepare
rm $(ROOT)stream
rm $(ROOT)subscribe
rm $(ROOT)apitest
diff --git a/tests/examples/c/prepare.c b/tests/examples/c/prepare.c
index b62aca727905f6b632d191e08f87cfeb061266e0..14acba3b0d691b4d9bb61db3d8bf95e10e6c20fe 100644
--- a/tests/examples/c/prepare.c
+++ b/tests/examples/c/prepare.c
@@ -857,6 +857,542 @@ void verify_prepare3(TAOS* taos) {
}
+/**
+ * @brief Verify the upper/lower case of tableName for create(by setTableName)/query/show/describe/drop.
+ * https://jira.taosdata.com:18080/browse/TS-904
+ * https://jira.taosdata.com:18090/pages/viewpage.action?pageId=129140555
+ * @param taos
+ */
+void verify_prepare4(TAOS* taos) {
+ printf("Verify the upper/lower case of tableName for create(by setTableName)/query/show/describe/drop etc.\n");
+
+ TAOS_RES* result = taos_query(taos, "drop database if exists test;");
+ taos_free_result(result);
+ usleep(100000);
+ result = taos_query(taos, "create database test;");
+
+ int code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create database, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(EXIT_FAILURE);
+ }
+ taos_free_result(result);
+
+ usleep(100000);
+ taos_select_db(taos, "test");
+
+ // create table
+ const char* sql =
+ "create stable st1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin "
+ "binary(40), blob nchar(10), u1 tinyint unsigned, u2 smallint unsigned, u4 int unsigned, u8 bigint unsigned) "
+ "tags "
+ "(b_tag bool, v1_tag tinyint, v2_tag smallint, v4_tag int, v8_tag bigint, f4_tag float, f8_tag double, bin_tag "
+ "binary(40), blob_tag nchar(10), u1_tag tinyint unsigned, u2_tag smallint unsigned, u4_tag int unsigned, u8_tag "
+ "bigint "
+ "unsigned)";
+ result = taos_query(taos, sql);
+ code = taos_errno(result);
+ if (code != 0) {
+ printf("\033[31mfailed to create table, reason:%s\033[0m\n", taos_errstr(result));
+ taos_free_result(result);
+ exit(EXIT_FAILURE);
+ }
+ taos_free_result(result);
+
+ TAOS_BIND tags[13];
+
+ struct {
+ int8_t b;
+ int8_t v1;
+ int16_t v2;
+ int32_t v4;
+ int64_t v8;
+ float f4;
+ double f8;
+ char bin[40];
+ char blob[80];
+ uint8_t u1;
+ uint16_t u2;
+ uint32_t u4;
+ uint64_t u8;
+ } id = {0};
+
+ id.b = (int8_t)1;
+ id.v1 = (int8_t)1;
+ id.v2 = (int16_t)2;
+ id.v4 = (int32_t)4;
+ id.v8 = (int64_t)8;
+ id.f4 = (float)40;
+ id.f8 = (double)80;
+ for (int j = 0; j < sizeof(id.bin); ++j) {
+ id.bin[j] = (char)('1' + '0');
+ }
+ strcpy(id.blob, "一二三四五六七八九十");
+ id.u1 = (uint8_t)1;
+ id.u2 = (uint16_t)2;
+ id.u4 = (uint32_t)4;
+ id.u8 = (uint64_t)8;
+
+ tags[0].buffer_type = TSDB_DATA_TYPE_BOOL;
+ tags[0].buffer_length = sizeof(id.b);
+ tags[0].buffer = &id.b;
+ tags[0].length = &tags[0].buffer_length;
+ tags[0].is_null = NULL;
+
+ tags[1].buffer_type = TSDB_DATA_TYPE_TINYINT;
+ tags[1].buffer_length = sizeof(id.v1);
+ tags[1].buffer = &id.v1;
+ tags[1].length = &tags[1].buffer_length;
+ tags[1].is_null = NULL;
+
+ tags[2].buffer_type = TSDB_DATA_TYPE_SMALLINT;
+ tags[2].buffer_length = sizeof(id.v2);
+ tags[2].buffer = &id.v2;
+ tags[2].length = &tags[2].buffer_length;
+ tags[2].is_null = NULL;
+
+ tags[3].buffer_type = TSDB_DATA_TYPE_INT;
+ tags[3].buffer_length = sizeof(id.v4);
+ tags[3].buffer = &id.v4;
+ tags[3].length = &tags[3].buffer_length;
+ tags[3].is_null = NULL;
+
+ tags[4].buffer_type = TSDB_DATA_TYPE_BIGINT;
+ tags[4].buffer_length = sizeof(id.v8);
+ tags[4].buffer = &id.v8;
+ tags[4].length = &tags[4].buffer_length;
+ tags[4].is_null = NULL;
+
+ tags[5].buffer_type = TSDB_DATA_TYPE_FLOAT;
+ tags[5].buffer_length = sizeof(id.f4);
+ tags[5].buffer = &id.f4;
+ tags[5].length = &tags[5].buffer_length;
+ tags[5].is_null = NULL;
+
+ tags[6].buffer_type = TSDB_DATA_TYPE_DOUBLE;
+ tags[6].buffer_length = sizeof(id.f8);
+ tags[6].buffer = &id.f8;
+ tags[6].length = &tags[6].buffer_length;
+ tags[6].is_null = NULL;
+
+ tags[7].buffer_type = TSDB_DATA_TYPE_BINARY;
+ tags[7].buffer_length = sizeof(id.bin);
+ tags[7].buffer = &id.bin;
+ tags[7].length = &tags[7].buffer_length;
+ tags[7].is_null = NULL;
+
+ tags[8].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ tags[8].buffer_length = strlen(id.blob);
+ tags[8].buffer = &id.blob;
+ tags[8].length = &tags[8].buffer_length;
+ tags[8].is_null = NULL;
+
+ tags[9].buffer_type = TSDB_DATA_TYPE_UTINYINT;
+ tags[9].buffer_length = sizeof(id.u1);
+ tags[9].buffer = &id.u1;
+ tags[9].length = &tags[9].buffer_length;
+ tags[9].is_null = NULL;
+
+ tags[10].buffer_type = TSDB_DATA_TYPE_USMALLINT;
+ tags[10].buffer_length = sizeof(id.u2);
+ tags[10].buffer = &id.u2;
+ tags[10].length = &tags[10].buffer_length;
+ tags[10].is_null = NULL;
+
+ tags[11].buffer_type = TSDB_DATA_TYPE_UINT;
+ tags[11].buffer_length = sizeof(id.u4);
+ tags[11].buffer = &id.u4;
+ tags[11].length = &tags[11].buffer_length;
+ tags[11].is_null = NULL;
+
+ tags[12].buffer_type = TSDB_DATA_TYPE_UBIGINT;
+ tags[12].buffer_length = sizeof(id.u8);
+ tags[12].buffer = &id.u8;
+ tags[12].length = &tags[12].buffer_length;
+ tags[12].is_null = NULL;
+ // insert 10 records
+ struct {
+ int64_t ts[10];
+ int8_t b[10];
+ int8_t v1[10];
+ int16_t v2[10];
+ int32_t v4[10];
+ int64_t v8[10];
+ float f4[10];
+ double f8[10];
+ char bin[10][40];
+ char blob[10][80];
+ uint8_t u1[10];
+ uint16_t u2[10];
+ uint32_t u4[10];
+ uint64_t u8[10];
+ } v;
+
+ int32_t* t8_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t16_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t32_len = malloc(sizeof(int32_t) * 10);
+ int32_t* t64_len = malloc(sizeof(int32_t) * 10);
+ int32_t* float_len = malloc(sizeof(int32_t) * 10);
+ int32_t* double_len = malloc(sizeof(int32_t) * 10);
+ int32_t* bin_len = malloc(sizeof(int32_t) * 10);
+ int32_t* blob_len = malloc(sizeof(int32_t) * 10);
+ int32_t* u8_len = malloc(sizeof(int32_t) * 10);
+ int32_t* u16_len = malloc(sizeof(int32_t) * 10);
+ int32_t* u32_len = malloc(sizeof(int32_t) * 10);
+ int32_t* u64_len = malloc(sizeof(int32_t) * 10);
+
+ TAOS_MULTI_BIND params[14];
+ char is_null[10] = {0};
+ params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
+ params[0].buffer_length = sizeof(v.ts[0]);
+ params[0].buffer = v.ts;
+ params[0].length = t64_len;
+ params[0].is_null = is_null;
+ params[0].num = 10;
+
+ params[1].buffer_type = TSDB_DATA_TYPE_BOOL;
+ params[1].buffer_length = sizeof(v.b[0]);
+ params[1].buffer = v.b;
+ params[1].length = t8_len;
+ params[1].is_null = is_null;
+ params[1].num = 10;
+
+ params[2].buffer_type = TSDB_DATA_TYPE_TINYINT;
+ params[2].buffer_length = sizeof(v.v1[0]);
+ params[2].buffer = v.v1;
+ params[2].length = t8_len;
+ params[2].is_null = is_null;
+ params[2].num = 10;
+
+ params[3].buffer_type = TSDB_DATA_TYPE_SMALLINT;
+ params[3].buffer_length = sizeof(v.v2[0]);
+ params[3].buffer = v.v2;
+ params[3].length = t16_len;
+ params[3].is_null = is_null;
+ params[3].num = 10;
+
+ params[4].buffer_type = TSDB_DATA_TYPE_INT;
+ params[4].buffer_length = sizeof(v.v4[0]);
+ params[4].buffer = v.v4;
+ params[4].length = t32_len;
+ params[4].is_null = is_null;
+ params[4].num = 10;
+
+ params[5].buffer_type = TSDB_DATA_TYPE_BIGINT;
+ params[5].buffer_length = sizeof(v.v8[0]);
+ params[5].buffer = v.v8;
+ params[5].length = t64_len;
+ params[5].is_null = is_null;
+ params[5].num = 10;
+
+ params[6].buffer_type = TSDB_DATA_TYPE_FLOAT;
+ params[6].buffer_length = sizeof(v.f4[0]);
+ params[6].buffer = v.f4;
+ params[6].length = float_len;
+ params[6].is_null = is_null;
+ params[6].num = 10;
+
+ params[7].buffer_type = TSDB_DATA_TYPE_DOUBLE;
+ params[7].buffer_length = sizeof(v.f8[0]);
+ params[7].buffer = v.f8;
+ params[7].length = double_len;
+ params[7].is_null = is_null;
+ params[7].num = 10;
+
+ params[8].buffer_type = TSDB_DATA_TYPE_BINARY;
+ params[8].buffer_length = sizeof(v.bin[0]);
+ params[8].buffer = v.bin;
+ params[8].length = bin_len;
+ params[8].is_null = is_null;
+ params[8].num = 10;
+
+ params[9].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ params[9].buffer_length = sizeof(v.blob[0]);
+ params[9].buffer = v.blob;
+ params[9].length = blob_len;
+ params[9].is_null = is_null;
+ params[9].num = 10;
+
+ params[10].buffer_type = TSDB_DATA_TYPE_UTINYINT;
+ params[10].buffer_length = sizeof(v.u1[0]);
+ params[10].buffer = v.u1;
+ params[10].length = u8_len;
+ params[10].is_null = is_null;
+ params[10].num = 10;
+
+ params[11].buffer_type = TSDB_DATA_TYPE_USMALLINT;
+ params[11].buffer_length = sizeof(v.u2[0]);
+ params[11].buffer = v.u2;
+ params[11].length = u16_len;
+ params[11].is_null = is_null;
+ params[11].num = 10;
+
+ params[12].buffer_type = TSDB_DATA_TYPE_UINT;
+ params[12].buffer_length = sizeof(v.u4[0]);
+ params[12].buffer = v.u4;
+ params[12].length = u32_len;
+ params[12].is_null = is_null;
+ params[12].num = 10;
+
+ params[13].buffer_type = TSDB_DATA_TYPE_UBIGINT;
+ params[13].buffer_length = sizeof(v.u8[0]);
+ params[13].buffer = v.u8;
+ params[13].length = u64_len;
+ params[13].is_null = is_null;
+ params[13].num = 10;
+
+// verify table names for upper/lower case
+#define VERIFY_CNT 5
+
+ typedef struct {
+ char setTbName[20];
+ char showName[20];
+ char describeName[20];
+ char queryName[20];
+ char dropName[20];
+ } STbNames;
+
+ /**
+ * @brief
+ * 0 - success expected
+ * NonZero - fail expected
+ */
+ typedef struct {
+ int32_t setTbName;
+ int32_t showName;
+ int32_t describeName;
+ int32_t queryName;
+ int32_t dropName;
+ } STbNamesResult;
+
+ STbNames tbName[VERIFY_CNT] = {0};
+ STbNamesResult tbNameResult[VERIFY_CNT] = {0};
+
+ STbNames* pTbName = NULL;
+ STbNamesResult* pTbNameResult = NULL;
+
+ pTbName = &tbName[0];
+ pTbNameResult = &tbNameResult[0];
+ strcpy(pTbName->setTbName, "Mn1");
+ strcpy(pTbName->showName, "mn1");
+ strcpy(pTbName->describeName, "mn1");
+ strcpy(pTbName->queryName, "mn1");
+ strcpy(pTbName->dropName, "mn1");
+
+ pTbName = &tbName[1];
+ pTbNameResult = &tbNameResult[1];
+ strcpy(pTbName->setTbName, "'Mn1'");
+ strcpy(pTbName->showName, "'mn1'");
+ strcpy(pTbName->describeName, "'mn1'");
+ strcpy(pTbName->queryName, "'mn1'");
+ strcpy(pTbName->dropName, "'mn1'");
+
+ pTbName = &tbName[2];
+ pTbNameResult = &tbNameResult[2];
+ strcpy(pTbName->setTbName, "\"Mn1\"");
+ strcpy(pTbName->showName, "\"mn1\"");
+ strcpy(pTbName->describeName, "\"mn1\"");
+ strcpy(pTbName->queryName, "\"mn1\"");
+ strcpy(pTbName->dropName, "\"mn1\"");
+
+ pTbName = &tbName[3];
+ pTbNameResult = &tbNameResult[3];
+ strcpy(pTbName->setTbName, "\"Mn1\"");
+ strcpy(pTbName->showName, "'mn1'");
+ strcpy(pTbName->describeName, "'mn1'");
+ strcpy(pTbName->queryName, "mn1");
+ strcpy(pTbName->dropName, "\"mn1\"");
+
+ pTbName = &tbName[4];
+ pTbNameResult = &tbNameResult[4];
+ strcpy(pTbName->setTbName, "`Mn1`");
+ strcpy(pTbName->showName, "Mn1"); // TODO support uniform of ``
+ strcpy(pTbName->describeName, "`Mn1`");
+ strcpy(pTbName->queryName, "`Mn1`");
+ strcpy(pTbName->dropName, "`Mn1`");
+
+ TAOS_STMT* stmt = NULL;
+
+ for (int n = 0; n < VERIFY_CNT; ++n) {
+ printf("\033[31m[%d] ===================================\033[0m\n", n);
+ pTbName = &tbName[n];
+ pTbNameResult = &tbNameResult[n];
+ char tmpStr[256] = {0};
+
+ // set table name
+ stmt = taos_stmt_init(taos);
+ if (!stmt) {
+ printf("\033[31m[%d] failed to execute taos_stmt_init. error:%s\033[0m\n", n);
+ exit(EXIT_FAILURE);
+ }
+
+ sql = "insert into ? using st1 tags(?,?,?,?,?,?,?,?,?,?,?,?,?) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ code = taos_stmt_prepare(stmt, sql, 0);
+ if (code != 0) {
+ printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+
+ printf("[%d] taos_stmt_set_tbname_tags, tbname=%s\n", n, pTbName->setTbName);
+ code = taos_stmt_set_tbname_tags(stmt, pTbName->setTbName, tags);
+ if ((!pTbNameResult->setTbName && (0 != code)) || (pTbNameResult->setTbName && (0 == code))) {
+ printf("\033[31m[%d] failed to execute taos_stmt_set_tbname_tags. error:%s\033[0m\n", n, taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+
+ if (code == 0) {
+ int64_t ts = 1591060628000 + 1000 * n;
+ for (int i = 0; i < 10; ++i) {
+ v.ts[i] = ts++;
+ is_null[i] = 0;
+
+ v.b[i] = (int8_t)i % 2;
+ v.v1[i] = (int8_t)i;
+ v.v2[i] = (int16_t)(i * 2);
+ v.v4[i] = (int32_t)(i * 4);
+ v.v8[i] = (int64_t)(i * 8);
+ v.f4[i] = (float)(i * 40);
+ v.f8[i] = (double)(i * 80);
+ for (int j = 0; j < sizeof(v.bin[0]); ++j) {
+ v.bin[i][j] = (char)(i + '0');
+ }
+ strcpy(v.blob[i], "一二三四五六七八九十");
+ v.u1[i] = (uint8_t)i;
+ v.u2[i] = (uint16_t)(i * 2);
+ v.u4[i] = (uint32_t)(i * 4);
+ v.u8[i] = (uint64_t)(i * 8);
+
+ t8_len[i] = sizeof(int8_t);
+ t16_len[i] = sizeof(int16_t);
+ t32_len[i] = sizeof(int32_t);
+ t64_len[i] = sizeof(int64_t);
+ float_len[i] = sizeof(float);
+ double_len[i] = sizeof(double);
+ bin_len[i] = sizeof(v.bin[0]);
+ blob_len[i] = (int32_t)strlen(v.blob[i]);
+ u8_len[i] = sizeof(uint8_t);
+ u16_len[i] = sizeof(uint16_t);
+ u32_len[i] = sizeof(uint32_t);
+ u64_len[i] = sizeof(uint64_t);
+ }
+
+ taos_stmt_bind_param_batch(stmt, params);
+ taos_stmt_add_batch(stmt);
+
+ if (taos_stmt_execute(stmt) != 0) {
+ printf("\033[31m[%d] failed to execute insert statement.error:%s\033[0m\n", n, taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+ }
+ taos_stmt_close(stmt);
+
+ // show the table
+ printf("[%d] show tables, tbName = %s\n", n, pTbName->showName);
+ stmt = taos_stmt_init(taos);
+ sprintf(tmpStr, "show tables like %s", pTbName->showName);
+ taos_stmt_prepare(stmt, tmpStr, 0);
+ code = taos_stmt_execute(stmt);
+ if ((!pTbNameResult->showName && (0 != code)) || (pTbNameResult->showName && (0 == code))) {
+ printf("\033[31m[%d] failed to execute show tables like. error:%s\033[0m\n", n, taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+ taos_stmt_close(stmt);
+
+ // describe the table
+ printf("[%d] describe tables, tbName = %s\n", n, pTbName->describeName);
+ stmt = taos_stmt_init(taos);
+ sprintf(tmpStr, "describe %s", pTbName->describeName);
+ taos_stmt_prepare(stmt, tmpStr, 0);
+ code = taos_stmt_execute(stmt);
+ if ((!pTbNameResult->describeName && (0 != code)) || (pTbNameResult->describeName && (0 == code))) {
+ printf("\033[31m[%d] failed to execute describe tables. error:%s\033[0m\n", n, taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+ taos_stmt_close(stmt);
+
+ // query the records
+ printf("[%d] select statement, tbName = %s\n", n, pTbName->queryName);
+ stmt = taos_stmt_init(taos);
+ sprintf(tmpStr, "SELECT * FROM %s", pTbName->queryName);
+ taos_stmt_prepare(stmt, tmpStr, 0);
+
+ TAOS_BIND qparams[2];
+
+ int8_t v1 = 5;
+ int16_t v2 = 15;
+ qparams[0].buffer_type = TSDB_DATA_TYPE_TINYINT;
+ qparams[0].buffer_length = sizeof(v1);
+ qparams[0].buffer = &v1;
+ qparams[0].length = &qparams[0].buffer_length;
+ qparams[0].is_null = NULL;
+
+ qparams[1].buffer_type = TSDB_DATA_TYPE_SMALLINT;
+ qparams[1].buffer_length = sizeof(v2);
+ qparams[1].buffer = &v2;
+ qparams[1].length = &qparams[1].buffer_length;
+ qparams[1].is_null = NULL;
+
+ taos_stmt_bind_param(stmt, qparams);
+
+ code = taos_stmt_execute(stmt);
+ if ((!pTbNameResult->queryName && (0 != code)) || (pTbNameResult->queryName && (0 == code))) {
+ printf("\033[31m[%d] failed to execute select statement.error:%s\033[0m\n", n, taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+
+ result = taos_stmt_use_result(stmt);
+
+ TAOS_ROW row;
+ int rows = 0;
+ int num_fields = taos_num_fields(result);
+ TAOS_FIELD* fields = taos_fetch_fields(result);
+
+ // fetch the records row by row
+ while ((row = taos_fetch_row(result))) {
+ char temp[256] = {0};
+ rows++;
+ taos_print_row(temp, row, fields, num_fields);
+ printf("[%d] row = %s\n", n, temp);
+ }
+
+ taos_free_result(result);
+ taos_stmt_close(stmt);
+
+ // drop table
+ printf("[%d] drop table, tbName = %s\n", n, pTbName->dropName);
+ stmt = taos_stmt_init(taos);
+ sprintf(tmpStr, "drop table %s", pTbName->dropName);
+ taos_stmt_prepare(stmt, tmpStr, 0);
+ code = taos_stmt_execute(stmt);
+ if ((!pTbNameResult->dropName && (0 != code)) || (pTbNameResult->dropName && (0 == code))) {
+ printf("\033[31m[%d] failed to drop table. error:%s\033[0m\n", n, taos_stmt_errstr(stmt));
+ taos_stmt_close(stmt);
+ exit(EXIT_FAILURE);
+ }
+ taos_stmt_close(stmt);
+ }
+
+ free(t8_len);
+ free(t16_len);
+ free(t32_len);
+ free(t64_len);
+ free(float_len);
+ free(double_len);
+ free(bin_len);
+ free(blob_len);
+ free(u8_len);
+ free(u16_len);
+ free(u32_len);
+ free(u64_len);
+}
+
int main(int argc, char* argv[]) {
const char* host = "127.0.0.1";
const char* user = "root";
@@ -880,5 +1416,7 @@ int main(int argc, char* argv[]) {
printf("************ verify prepare3 *************\n");
verify_prepare3(taos);
printf("************ verify prepare4 *************\n");
+ verify_prepare4(taos);
+ printf("************ verify end *************\n");
exit(EXIT_SUCCESS);
}
diff --git a/tests/pytest/fulltest-connector.sh b/tests/pytest/fulltest-connector.sh
new file mode 100755
index 0000000000000000000000000000000000000000..89361e5ea1917e877373dc856f926a1a9d32dde9
--- /dev/null
+++ b/tests/pytest/fulltest-connector.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+ulimit -c unlimited
+#======================p1-start===============
+
+# restful test for python
+# python3 test.py -f restful/restful_bind_db1.py
+# python3 test.py -f restful/restful_bind_db2.py
+python3 ./test.py -f client/nettest.py
+
+#======================p1-end===============
diff --git a/tests/pytest/fulltest-insert.sh b/tests/pytest/fulltest-insert.sh
new file mode 100755
index 0000000000000000000000000000000000000000..85b36bda29a047c788eb00b991bb890a2c270bac
--- /dev/null
+++ b/tests/pytest/fulltest-insert.sh
@@ -0,0 +1,174 @@
+#!/bin/bash
+ulimit -c unlimited
+#======================p1-start===============
+
+python3 testCompress.py
+python3 testNoCompress.py
+
+python3 ./test.py -f import_merge/importBlock1HO.py
+python3 ./test.py -f import_merge/importBlock1HPO.py
+python3 ./test.py -f import_merge/importBlock1H.py
+python3 ./test.py -f import_merge/importBlock1S.py
+python3 ./test.py -f import_merge/importBlock1Sub.py
+python3 ./test.py -f import_merge/importBlock1TO.py
+python3 ./test.py -f import_merge/importBlock1TPO.py
+python3 ./test.py -f import_merge/importBlock1T.py
+python3 ./test.py -f import_merge/importBlock2HO.py
+python3 ./test.py -f import_merge/importBlock2HPO.py
+python3 ./test.py -f import_merge/importBlock2H.py
+python3 ./test.py -f import_merge/importBlock2S.py
+python3 ./test.py -f import_merge/importBlock2Sub.py
+python3 ./test.py -f import_merge/importBlock2TO.py
+python3 ./test.py -f import_merge/importBlock2TPO.py
+python3 ./test.py -f import_merge/importBlock2T.py
+python3 ./test.py -f import_merge/importBlockbetween.py
+python3 ./test.py -f import_merge/importCacheFileHO.py
+
+#======================p1-end===============
+#======================p2-start===============
+
+python3 ./test.py -f import_merge/importCacheFileHPO.py
+python3 ./test.py -f import_merge/importCacheFileH.py
+python3 ./test.py -f import_merge/importCacheFileS.py
+python3 ./test.py -f import_merge/importCacheFileSub.py
+python3 ./test.py -f import_merge/importCacheFileTO.py
+python3 ./test.py -f import_merge/importCacheFileTPO.py
+python3 ./test.py -f import_merge/importCacheFileT.py
+python3 ./test.py -f import_merge/importDataH2.py
+python3 ./test.py -f import_merge/importDataHO2.py
+python3 ./test.py -f import_merge/importDataHO.py
+python3 ./test.py -f import_merge/importDataHPO.py
+python3 ./test.py -f import_merge/importDataLastHO.py
+python3 ./test.py -f import_merge/importDataLastHPO.py
+python3 ./test.py -f import_merge/importDataLastH.py
+python3 ./test.py -f import_merge/importDataLastS.py
+python3 ./test.py -f import_merge/importDataLastSub.py
+python3 ./test.py -f import_merge/importDataLastTO.py
+python3 ./test.py -f import_merge/importDataLastTPO.py
+python3 ./test.py -f import_merge/importDataLastT.py
+python3 ./test.py -f import_merge/importDataS.py
+python3 ./test.py -f import_merge/importDataSub.py
+
+#======================p2-end===============
+#======================p3-start===============
+
+python3 ./test.py -f import_merge/importDataTO.py
+python3 ./test.py -f import_merge/importDataTPO.py
+python3 ./test.py -f import_merge/importDataT.py
+python3 ./test.py -f import_merge/importHeadOverlap.py
+python3 ./test.py -f import_merge/importHeadPartOverlap.py
+python3 ./test.py -f import_merge/importHead.py
+python3 ./test.py -f import_merge/importHORestart.py
+python3 ./test.py -f import_merge/importHPORestart.py
+python3 ./test.py -f import_merge/importHRestart.py
+python3 ./test.py -f import_merge/importLastHO.py
+python3 ./test.py -f import_merge/importLastHPO.py
+python3 ./test.py -f import_merge/importLastH.py
+python3 ./test.py -f import_merge/importLastS.py
+python3 ./test.py -f import_merge/importLastSub.py
+python3 ./test.py -f import_merge/importLastTO.py
+python3 ./test.py -f import_merge/importLastTPO.py
+python3 ./test.py -f import_merge/importLastT.py
+python3 ./test.py -f import_merge/importSpan.py
+python3 ./test.py -f import_merge/importSRestart.py
+python3 ./test.py -f import_merge/importSubRestart.py
+python3 ./test.py -f import_merge/importTailOverlap.py
+
+#======================p3-end===============
+#======================p4-start===============
+
+python3 ./test.py -f import_merge/importTailPartOverlap.py
+python3 ./test.py -f import_merge/importTail.py
+python3 ./test.py -f import_merge/importToCommit.py
+python3 ./test.py -f import_merge/importTORestart.py
+python3 ./test.py -f import_merge/importTPORestart.py
+python3 ./test.py -f import_merge/importTRestart.py
+python3 ./test.py -f import_merge/importInsertThenImport.py
+python3 ./test.py -f import_merge/importCSV.py
+python3 ./test.py -f import_merge/import_update_0.py
+python3 ./test.py -f import_merge/import_update_1.py
+python3 ./test.py -f import_merge/import_update_2.py
+
+python3 ./test.py -f insert/basic.py
+python3 ./test.py -f insert/int.py
+python3 ./test.py -f insert/float.py
+python3 ./test.py -f insert/bigint.py
+python3 ./test.py -f insert/bool.py
+python3 ./test.py -f insert/double.py
+python3 ./test.py -f insert/smallint.py
+python3 ./test.py -f insert/tinyint.py
+python3 ./test.py -f insert/date.py
+
+
+python3 ./test.py -f insert/binary.py
+python3 ./test.py -f insert/nchar.py
+#python3 ./test.py -f insert/nchar-boundary.py
+python3 ./test.py -f insert/nchar-unicode.py
+python3 ./test.py -f insert/multi.py
+python3 ./test.py -f insert/randomNullCommit.py
+python3 insert/retentionpolicy.py
+python3 ./test.py -f insert/alterTableAndInsert.py
+python3 ./test.py -f insert/insertIntoTwoTables.py
+python3 ./test.py -f insert/before_1970.py
+python3 ./test.py -f insert/special_character_show.py
+python3 bug2265.py
+python3 ./test.py -f insert/bug3654.py
+python3 ./test.py -f insert/insertDynamicColBeforeVal.py
+python3 ./test.py -f insert/in_function.py
+python3 ./test.py -f insert/modify_column.py
+#python3 ./test.py -f insert/line_insert.py
+python3 ./test.py -f insert/specialSql.py
+python3 ./test.py -f insert/timestamp.py
+python3 ./test.py -f insert/metadataUpdate.py
+python3 ./test.py -f insert/unsignedInt.py
+python3 ./test.py -f insert/unsignedBigint.py
+python3 ./test.py -f insert/unsignedSmallint.py
+python3 ./test.py -f insert/unsignedTinyint.py
+python3 ./test.py -f insert/insertFromCSV.py
+python3 ./test.py -f insert/boundary2.py
+python3 ./test.py -f insert/insert_locking.py
+python3 test.py -f insert/insert_before_use_db.py
+python3 ./test.py -f insert/flushwhiledrop.py
+python3 ./test.py -f insert/verifyMemToDiskCrash.py
+#python3 ./test.py -f insert/schemalessInsert.py
+#python3 ./test.py -f insert/openTsdbJsonInsert.py
+python3 ./test.py -f insert/openTsdbTelnetLinesInsert.py
+
+
+# update
+python3 ./test.py -f update/merge_commit_data.py
+python3 ./test.py -f update/allow_update.py
+python3 ./test.py -f update/allow_update-0.py
+python3 ./test.py -f update/append_commit_data.py
+python3 ./test.py -f update/append_commit_last-0.py
+python3 ./test.py -f update/append_commit_last.py
+
+
+python3 ./test.py -f update/merge_commit_data2.py
+python3 ./test.py -f update/merge_commit_data2_update0.py
+python3 ./test.py -f update/merge_commit_last-0.py
+python3 ./test.py -f update/merge_commit_last.py
+python3 ./test.py -f update/update_options.py
+python3 ./test.py -f update/merge_commit_data-0.py
+
+# wal
+python3 ./test.py -f wal/addOldWalTest.py
+python3 ./test.py -f wal/sdbComp.py
+
+#======================p4-end===============
+#======================p5-start===============
+python3 ./test.py -f ../system-test/1-insert/0-sql/basic.py
+python3 ./test.py -f ../develop-test/1-insert/0-sql/basic.py
+python3 ./test.py -f ../develop-test/1-insert/0-sql/batchInsert.py
+
+#======================p5-end===============
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/pytest/fulltest-others.sh b/tests/pytest/fulltest-others.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a081833ddb323ad1becfc24f48fdaaebac26b328
--- /dev/null
+++ b/tests/pytest/fulltest-others.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+ulimit -c unlimited
+#======================p1-start===============
+
+#python3 ./test.py -f dbmgmt/database-name-boundary.py
+python3 test.py -f dbmgmt/nanoSecondCheck.py
+
+#
+python3 ./test.py -f tsdb/tsdbComp.py
+
+# user
+python3 ./test.py -f user/user_create.py
+python3 ./test.py -f user/pass_len.py
+
+#======================p1-end===============
+#======================p2-start===============
+
+# perfbenchmark
+python3 ./test.py -f perfbenchmark/bug3433.py
+#python3 ./test.py -f perfbenchmark/bug3589.py
+#python3 ./test.py -f perfbenchmark/taosdemoInsert.py
+
+#alter table
+python3 ./test.py -f alter/alter_table_crash.py
+python3 ./test.py -f alter/alterTabAddTagWithNULL.py
+python3 ./test.py -f alter/alterTimestampColDataProcess.py
+
+#======================p2-end===============
+#======================p3-start===============
+
+python3 ./test.py -f alter/alter_table.py
+python3 ./test.py -f alter/alter_debugFlag.py
+python3 ./test.py -f alter/alter_keep.py
+python3 ./test.py -f alter/alter_cacheLastRow.py
+python3 ./test.py -f alter/alter_create_exception.py
+python3 ./test.py -f alter/alterColMultiTimes.py
+
+#======================p3-end===============
+#======================p4-start===============
+
+python3 ./test.py -f account/account_create.py
+
+# client
+python3 ./test.py -f client/client.py
+python3 ./test.py -f client/version.py
+python3 ./test.py -f client/alterDatabase.py
+python3 ./test.py -f client/noConnectionErrorTest.py
+python3 ./test.py -f client/taoshellCheckCase.py
+# python3 ./test.py -f client/change_time_1_1.py
+# python3 ./test.py -f client/change_time_1_2.py
+python3 client/twoClients.py
+python3 testMinTablesPerVnode.py
+
+# topic
+python3 ./test.py -f topic/topicQuery.py
+#======================p4-end===============
+#======================p5-start===============
+python3 ./test.py -f ../system-test/0-management/1-stable/create_col_tag.py
+python3 ./test.py -f ../develop-test/0-management/3-tag/json_tag.py
+
+#======================p5-end===============
diff --git a/tests/pytest/fulltest-query.sh b/tests/pytest/fulltest-query.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b36694017c405991271340c91d21da7ca2e1b21b
--- /dev/null
+++ b/tests/pytest/fulltest-query.sh
@@ -0,0 +1,219 @@
+#!/bin/bash
+ulimit -c unlimited
+#======================p1-start===============
+
+# timezone
+python3 ./test.py -f TimeZone/TestCaseTimeZone.py
+
+#stable
+python3 ./test.py -f stable/insert.py
+python3 ./test.py -f stable/query_after_reset.py
+
+#table
+python3 ./test.py -f table/alter_wal0.py
+python3 ./test.py -f table/column_name.py
+python3 ./test.py -f table/column_num.py
+python3 ./test.py -f table/db_table.py
+python3 ./test.py -f table/create_sensitive.py
+python3 ./test.py -f table/tablename-boundary.py
+python3 ./test.py -f table/max_table_length.py
+python3 ./test.py -f table/alter_column.py
+python3 ./test.py -f table/boundary.py
+#python3 ./test.py -f table/create.py
+python3 ./test.py -f table/del_stable.py
+python3 ./test.py -f table/create_db_from_normal_db.py
+
+# tag
+python3 ./test.py -f tag_lite/filter.py
+python3 ./test.py -f tag_lite/create-tags-boundary.py
+python3 ./test.py -f tag_lite/3.py
+python3 ./test.py -f tag_lite/4.py
+python3 ./test.py -f tag_lite/5.py
+python3 ./test.py -f tag_lite/6.py
+python3 ./test.py -f tag_lite/add.py
+python3 ./test.py -f tag_lite/bigint.py
+python3 ./test.py -f tag_lite/binary_binary.py
+python3 ./test.py -f tag_lite/binary.py
+python3 ./test.py -f tag_lite/bool_binary.py
+python3 ./test.py -f tag_lite/bool_int.py
+python3 ./test.py -f tag_lite/bool.py
+python3 ./test.py -f tag_lite/change.py
+
+#======================p1-end===============
+#======================p2-start===============
+
+python3 ./test.py -f tag_lite/column.py
+python3 ./test.py -f tag_lite/commit.py
+python3 ./test.py -f tag_lite/create.py
+python3 ./test.py -f tag_lite/datatype.py
+python3 ./test.py -f tag_lite/datatype-without-alter.py
+python3 ./test.py -f tag_lite/delete.py
+python3 ./test.py -f tag_lite/double.py
+python3 ./test.py -f tag_lite/float.py
+python3 ./test.py -f tag_lite/int_binary.py
+python3 ./test.py -f tag_lite/int_float.py
+python3 ./test.py -f tag_lite/int.py
+python3 ./test.py -f tag_lite/set.py
+python3 ./test.py -f tag_lite/smallint.py
+python3 ./test.py -f tag_lite/tinyint.py
+python3 ./test.py -f tag_lite/timestamp.py
+python3 ./test.py -f tag_lite/TestModifyTag.py
+python3 ./test.py -f tag_lite/unsignedInt.py
+python3 ./test.py -f tag_lite/unsignedBigint.py
+python3 ./test.py -f tag_lite/unsignedSmallint.py
+python3 ./test.py -f tag_lite/unsignedTinyint.py
+python3 ./test.py -f tag_lite/alter_tag.py
+python3 ./test.py -f tag_lite/drop_auto_create.py
+python3 ./test.py -f tag_lite/json_tag_extra.py
+
+#======================p2-end===============
+#======================p3-start===============
+
+#query
+python3 ./test.py -f query/distinctOneColTb.py
+python3 ./test.py -f query/filter.py
+python3 ./test.py -f query/filterCombo.py
+python3 ./test.py -f query/queryNormal.py
+python3 ./test.py -f query/queryError.py
+python3 ./test.py -f query/filterAllIntTypes.py
+python3 ./test.py -f query/filterFloatAndDouble.py
+python3 ./test.py -f query/filterOtherTypes.py
+python3 ./test.py -f query/querySort.py
+python3 ./test.py -f query/queryJoin.py
+python3 ./test.py -f query/select_last_crash.py
+python3 ./test.py -f query/queryNullValueTest.py
+python3 ./test.py -f query/queryInsertValue.py
+python3 ./test.py -f query/queryConnection.py
+python3 ./test.py -f query/queryCountCSVData.py
+python3 ./test.py -f query/natualInterval.py
+python3 ./test.py -f query/bug1471.py
+#python3 ./test.py -f query/dataLossTest.py
+python3 ./test.py -f query/bug1874.py
+python3 ./test.py -f query/bug1875.py
+python3 ./test.py -f query/bug1876.py
+python3 ./test.py -f query/bug2218.py
+python3 ./test.py -f query/bug2117.py
+python3 ./test.py -f query/bug2118.py
+python3 ./test.py -f query/bug2143.py
+python3 ./test.py -f query/sliding.py
+python3 ./test.py -f query/unionAllTest.py
+python3 ./test.py -f query/bug2281.py
+python3 ./test.py -f query/udf.py
+python3 ./test.py -f query/bug2119.py
+python3 ./test.py -f query/isNullTest.py
+python3 ./test.py -f query/queryWithTaosdKilled.py
+python3 ./test.py -f query/floatCompare.py
+python3 ./test.py -f query/query1970YearsAf.py
+python3 ./test.py -f query/bug3351.py
+python3 ./test.py -f query/bug3375.py
+python3 ./test.py -f query/queryJoin10tables.py
+python3 ./test.py -f query/queryStddevWithGroupby.py
+python3 ./test.py -f query/querySecondtscolumnTowherenow.py
+python3 ./test.py -f query/queryFilterTswithDateUnit.py
+python3 ./test.py -f query/queryTscomputWithNow.py
+python3 ./test.py -f query/queryStableJoin.py
+python3 ./test.py -f query/computeErrorinWhere.py
+python3 ./test.py -f query/queryTsisNull.py
+python3 ./test.py -f query/subqueryFilter.py
+python3 ./test.py -f query/nestedQuery/queryInterval.py
+python3 ./test.py -f query/queryStateWindow.py
+# python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
+
+#======================p3-end===============
+#======================p4-start===============
+
+python3 ./test.py -f query/nestquery_last_row.py
+python3 ./test.py -f query/nestedQuery/nestedQuery.py
+python3 ./test.py -f query/nestedQuery/nestedQuery_datacheck.py
+python3 ./test.py -f query/queryCnameDisplay.py
+# python3 ./test.py -f query/operator_cost.py
+# python3 ./test.py -f query/long_where_query.py
+python3 test.py -f query/nestedQuery/queryWithSpread.py
+python3 ./test.py -f query/bug6586.py
+# python3 ./test.py -f query/bug5903.py
+python3 test.py -f query/queryInterval.py
+python3 test.py -f query/queryFillTest.py
+python3 ./test.py -f query/last_cache.py
+python3 ./test.py -f query/last_row_cache.py
+python3 ./test.py -f query/queryGroupbySort.py
+python3 ./test.py -f query/filterAllUnsignedIntTypes.py
+python3 ./test.py -f query/queryBetweenAnd.py
+python3 ./test.py -f query/querySession.py
+python3 ./test.py -f query/queryWildcardLength.py
+python3 ./test.py -f query/queryTbnameUpperLower.py
+python3 ./test.py -f query/query.py
+python3 ./test.py -f query/queryDiffColsTagsAndOr.py
+python3 ./test.py -f query/queryGroupTbname.py
+python3 ./test.py -f query/queryRegex.py
+
+#stream
+python3 ./test.py -f stream/metric_1.py
+python3 ./test.py -f stream/metric_n.py
+python3 ./test.py -f stream/new.py
+python3 ./test.py -f stream/stream1.py
+python3 ./test.py -f stream/stream2.py
+#python3 ./test.py -f stream/parser.py
+python3 ./test.py -f stream/history.py
+python3 ./test.py -f stream/sys.py
+python3 ./test.py -f stream/table_1.py
+python3 ./test.py -f stream/table_n.py
+python3 ./test.py -f stream/showStreamExecTimeisNull.py
+python3 ./test.py -f stream/cqSupportBefore1970.py
+
+python3 ./test.py -f query/queryGroupbyWithInterval.py
+python3 queryCount.py
+
+# subscribe
+python3 test.py -f subscribe/singlemeter.py
+#python3 test.py -f subscribe/stability.py
+python3 test.py -f subscribe/supertable.py
+
+#======================p4-end===============
+#======================p5-start===============
+
+# functions
+python3 ./test.py -f functions/all_null_value.py
+python3 ./test.py -f functions/function_avg.py -r 1
+python3 ./test.py -f functions/function_bottom.py -r 1
+python3 ./test.py -f functions/function_count.py -r 1
+python3 ./test.py -f functions/function_count_last_stab.py
+python3 ./test.py -f functions/function_diff.py -r 1
+python3 ./test.py -f functions/function_first.py -r 1
+python3 ./test.py -f functions/function_last.py -r 1
+python3 ./test.py -f functions/function_last_row.py -r 1
+python3 ./test.py -f functions/function_leastsquares.py -r 1
+python3 ./test.py -f functions/function_max.py -r 1
+python3 ./test.py -f functions/function_min.py -r 1
+python3 ./test.py -f functions/function_operations.py -r 1
+python3 ./test.py -f functions/function_percentile.py -r 1
+python3 ./test.py -f functions/function_spread.py -r 1
+python3 ./test.py -f functions/function_stddev.py -r 1
+python3 ./test.py -f functions/function_sum.py -r 1
+python3 ./test.py -f functions/function_top.py -r 1
+python3 ./test.py -f functions/function_sample.py -r 1
+python3 ./test.py -f functions/function_twa.py -r 1
+python3 ./test.py -f functions/function_twa_test2.py
+python3 ./test.py -f functions/function_stddev_td2555.py
+python3 ./test.py -f functions/showOfflineThresholdIs864000.py
+python3 ./test.py -f functions/function_interp.py
+#python3 ./test.py -f functions/queryTestCases.py
+python3 ./test.py -f functions/function_stateWindow.py
+python3 ./test.py -f functions/function_derivative.py
+python3 ./test.py -f functions/function_irate.py
+python3 ./test.py -f functions/function_ceil.py
+python3 ./test.py -f functions/function_floor.py
+python3 ./test.py -f functions/function_round.py
+python3 ./test.py -f functions/function_elapsed.py
+python3 ./test.py -f functions/function_mavg.py
+python3 ./test.py -f functions/function_csum.py
+python3 ./test.py -f functions/function_percentile2.py
+python3 ./test.py -f functions/variable_httpDbNameMandatory.py
+
+
+
+######## system-test
+#python3 ./test.py -f ../system-test/2-query/9-others/TD-11389.py # this case will run when this bug fix TD-11389
+
+
+#======================p5-end===============
+
diff --git a/tests/pytest/fulltest-tools.sh b/tests/pytest/fulltest-tools.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d1f83e9fb289f36d52340b0ed942c912f361c2de
--- /dev/null
+++ b/tests/pytest/fulltest-tools.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+ulimit -c unlimited
+#======================p1-start===============
+
+# tools
+python3 test.py -f tools/taosdumpTest.py
+python3 test.py -f tools/taosdumpTest2.py
+
+python3 test.py -f tools/taosdemoTest.py
+python3 test.py -f tools/taosdemoTestWithoutMetric.py
+python3 test.py -f tools/taosdemoTestWithJson.py
+
+#======================p1-end===============
+#======================p2-start===============
+
+python3 test.py -f tools/taosdemoTestLimitOffset.py
+python3 test.py -f tools/taosdemoTestTblAlt.py
+python3 test.py -f tools/taosdemoTestSampleData.py
+python3 test.py -f tools/taosdemoTestInterlace.py
+# python3 test.py -f tools/taosdemoTestQuery.py
+python3 ./test.py -f tools/taosdemoTestdatatype.py
+#======================p2-end===============
+#======================p3-start===============
+
+# nano support
+python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
+python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoQuery.py
+python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosubscribe.py
+python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py
+python3 test.py -f tools/taosdumpTestNanoSupport.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
+#======================p3-end===============
+#======================p4-start===============
+
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
+python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py
+python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
+python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
+
+#python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py
+
+#======================p4-end===============
+#======================p5-start===============
+
+#======================p5-end===============
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh
index 47e535cbd81b9cbc9675493342c1b734ccbeeca2..b14be1cc110caea6fc42dd6ca66934d5b5333f3f 100755
--- a/tests/pytest/fulltest.sh
+++ b/tests/pytest/fulltest.sh
@@ -52,6 +52,8 @@ python3 ./test.py -f table/create_db_from_normal_db.py
#stable
python3 ./test.py -f stable/insert.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
+python3 test.py -f tag_lite/json_tag_extra.py
# tag
python3 ./test.py -f tag_lite/filter.py
@@ -223,6 +225,7 @@ python3 ./test.py -f perfbenchmark/bug3433.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py
#query
python3 test.py -f query/distinctOneColTb.py
diff --git a/tests/pytest/functions/function_elapsed_case.py b/tests/pytest/functions/function_elapsed_case.py
index 56610a9347c3ab90a9addc64dd62a6ed60758abf..6b279d7f63de0cdbd854457350b670520ea455ec 100644
--- a/tests/pytest/functions/function_elapsed_case.py
+++ b/tests/pytest/functions/function_elapsed_case.py
@@ -320,6 +320,8 @@ class ElapsedCase:
def selectIllegalTest(self):
tdSql.execute("use wxy_db")
+ tdSql.error("select elapsed() from t1")
+ tdSql.error("select elapsed(,) from t1")
tdSql.error("select elapsed(1) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'")
tdSql.error("select elapsed('2021-11-18 00:00:10') from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'")
tdSql.error("select elapsed(now) from t1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'")
diff --git a/tests/pytest/functions/variable_httpDbNameMandatory.py b/tests/pytest/functions/variable_httpDbNameMandatory.py
index 3be620ad1e1631126697d93e388df82be3e9d57c..1cd2516ec9303f2f038bc22a69afcd01bce3a930 100644
--- a/tests/pytest/functions/variable_httpDbNameMandatory.py
+++ b/tests/pytest/functions/variable_httpDbNameMandatory.py
@@ -34,11 +34,15 @@ class TDTestCase:
def getBuildPath(self) -> str:
selfPath = os.path.dirname(os.path.realpath(__file__))
+ global cfgPath
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
+ cfgPath = projPath + "/community/sim/dnode1/cfg"
else:
projPath = selfPath[:selfPath.find("tests")]
+ cfgPath = projPath + "/sim/dnode1/cfg"
+
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
@@ -53,8 +57,10 @@ class TDTestCase:
if ("community" in selfPath):
cfgDir = self.getBuildPath() + "/community/sim/dnode1/cfg"
+
else:
cfgDir = self.getBuildPath() + "/sim/dnode1/cfg"
+
return cfgDir
def getCfgFile(self) -> str:
@@ -85,8 +91,8 @@ class TDTestCase:
def TS834(self):
tdLog.printNoPrefix("==========TS-782==========")
tdSql.prepare()
-
- cfgfile = self.getCfgFile()
+ buildPath = self.getBuildPath()
+ cfgfile = cfgPath + "/taos.cfg"
tdSql.execute("show variables")
res_com = tdSql.cursor.fetchall()
diff --git a/tests/pytest/tag_lite/json_tag_extra.py b/tests/pytest/tag_lite/json_tag_extra.py
new file mode 100644
index 0000000000000000000000000000000000000000..094359d05141d02e181bd2ed92beffbfd612f507
--- /dev/null
+++ b/tests/pytest/tag_lite/json_tag_extra.py
@@ -0,0 +1,591 @@
+###################################################################
+# 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, db_test.stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import taos
+from util.log import tdLog
+from util.cases import tdCases
+from util.sql import tdSql
+import time
+import random
+
+class TDTestCase:
+
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("drop database if exists db_json;")
+ print("==============step1 tag format =======")
+ tdLog.info("create database ")
+ tdSql.execute("create database db_json")
+ tdSql.execute("use db_json")
+ # test tag format
+ tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)")
+ tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json(10000000))")
+ tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,jtag1 json)")
+ tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,dataBool bool)")
+
+ tdSql.execute("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":\"fff\",\"id\":5}')")
+
+ # two stables: jsons1 jsons2 ,test tag's value and key
+ tdSql.execute("insert into jsons1_1(ts,dataInt) using jsons1 tags('{\"loc+\":\"fff\",\"id\":5}') values (now,12)")
+
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{oc:\"fff\",\"id\":5}')")
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":fff,\"id\":5}')")
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('3333')")
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":}')")
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":bool)")
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags(true)")
+ tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('[{\"num\":5}]')")
+
+ # test object and key max length. max key length is 256, max object length is 4096 include abcd.
+ tdSql.execute("create table if not exists jsons4(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)")
+
+ char1= ''.join(['abcd']*64)
+ char2=''.join(char1)
+ char3= ''.join(['abcd']*1022)
+ print(len(char3)) # 4088
+ tdSql.execute("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s\":5}')" % char1) # len(key)=256
+ tdSql.error("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s1\":5}')" % char2) # len(key)=257
+ tdSql.execute("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"T\":\"%s\"}')" % char3) # len(object)=4096
+ tdSql.error("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"TS\":\"%s\"}')" % char3) # len(object)=4097
+
+ tdSql.execute("insert into jsons1_1 values(now, 1, 'json1')")
+ tdSql.execute("insert into jsons1_1 values(now+1s, 1, 'json1')")
+ tdSql.execute("insert into jsons1_2 using jsons1 tags('{\"num\":5,\"location\":\"beijing\"}') values (now, 1, 'json2')")
+ tdSql.execute("insert into jsons1_3 using jsons1 tags('{\"num\":34,\"location\":\"beijing\",\"level\":\"l1\"}') values (now, 1, 'json3')")
+ tdSql.execute("insert into jsons1_4 using jsons1 tags('{\"class\":55,\"location\":\"beijing\",\"name\":\"name4\"}') values (now, 1, 'json4')")
+
+ # test : json'vaule is null and
+ tdSql.execute("create table if not exists jsons2(ts timestamp, dataInt2 int, dataStr2 nchar(50)) tags(jtag2 json)")
+ tdSql.execute("CREATE TABLE if not exists jsons2_1 using jsons2 tags('{}')")
+ tdSql.query("select jtag2 from jsons2_1")
+ tdSql.checkData(0, 0, None)
+ tdSql.execute("CREATE TABLE if not exists jsons2_2 using jsons2 tags('')")
+ tdSql.query("select jtag2 from jsons2_2")
+ tdSql.checkData(0, 0, None)
+ tdSql.execute("CREATE TABLE if not exists jsons2_3 using jsons2 tags('null')")
+ tdSql.query("select jtag2 from jsons2_3")
+ tdSql.checkData(0, 0, None)
+ tdSql.execute("CREATE TABLE if not exists jsons2_4 using jsons2 tags('\t')")
+ tdSql.query("select jtag2 from jsons2_4")
+ tdSql.checkData(0, 0, None)
+ tdSql.execute("CREATE TABLE if not exists jsons2_5 using jsons2 tags(' ')")
+ tdSql.query("select jtag2 from jsons2_5")
+ tdSql.checkData(0, 0, None)
+ tdSql.execute("CREATE TABLE if not exists jsons2_6 using jsons2 tags('{\"nv\":null,\"tea\":true,\"\":false,\"\":123,\"tea\":false}')")
+ tdSql.query("select jtag2 from jsons2_6")
+ tdSql.checkData(0, 0, "{\"nv\":null,\"tea\":true}")
+ tdSql.execute("CREATE TABLE if not exists jsons2_7 using jsons2 tags('{\"test7\":\"\"}')")
+ tdSql.query("select jtag2 from jsons2_7")
+ tdSql.checkData(0, 0, "{\"test7\":\"\"}")
+ tdSql.execute("CREATE TABLE if not exists jsons2_8 using jsons2 tags('{\"nv\":null,\"tea\":123,\"\":false,\"\":123,\"tea\":false}')")
+ tdSql.query("select jtag2 from jsons2_8")
+ tdSql.checkData(0, 0, "{\"nv\":null,\"tea\":123}")
+
+ print("==============step2 alter json table==")
+ tdLog.info("alter stable add tag")
+ tdSql.error("ALTER STABLE jsons2 add tag jtag3 nchar(20)")
+ tdSql.error("ALTER STABLE jsons2 drop tag jtag2")
+ tdSql.execute("ALTER STABLE jsons2 change tag jtag2 jtag3")
+ tdSql.query("select jtag3->'tea' from jsons2_6")
+ tdSql.checkData(0, 0, "true")
+ tdSql.error("ALTER TABLE jsons2_6 SET TAG jtag3='{\"tea-=[].;!@#$%^&*()/\":}'")
+ tdSql.execute("ALTER TABLE jsons2_6 SET TAG jtag3='{\"tea-=[].;!@#$%^&*()/\":false}'")
+ tdSql.query("select jtag3 from jsons2_6")
+ tdSql.checkData(0, 0, "{\"tea-=[].;!@#$%^&*()/\":false}")
+ tdSql.execute("ALTER TABLE jsons1_1 SET TAG jtag='{\"sex\":\"femail\",\"age\":35}'")
+ tdSql.query("select jtag from jsons1_1")
+ tdSql.checkData(0, 0, "{\"sex\":\"femail\",\"age\":35}")
+
+
+
+ print("==============step3")
+ tdLog.info("select table")
+
+ tdSql.query("select jtag from jsons1_1")
+ tdSql.checkData(0, 0, "{\"sex\":\"femail\",\"age\":35}")
+
+ tdSql.query("select jtag from jsons1 where jtag->'name'='name4'")
+ tdSql.checkData(0, 0, "{\"class\":55,\"location\":\"beijing\",\"name\":\"name4\"}")
+
+
+ tdSql.query("select * from jsons1")
+ tdSql.checkRows(6)
+
+ tdSql.query("select * from jsons1_1")
+ tdSql.checkRows(3)
+
+ tdSql.query("select * from jsons1 where jtag->'location'='beijing'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select jtag->'location' from jsons1_2")
+ tdSql.checkData(0, 0, "\"beijing\"")
+
+
+ tdSql.query("select jtag->'num' from jsons1 where jtag->'level'='l1'")
+ tdSql.checkData(0, 0, 34)
+
+ tdSql.query("select jtag->'location' from jsons1")
+ tdSql.checkRows(4)
+
+ tdSql.query("select jtag from jsons1_1")
+ tdSql.checkRows(1)
+
+ tdSql.query("select * from jsons1 where jtag contains 'sex' or jtag contains 'num'")
+ tdSql.checkRows(5)
+
+ tdSql.query("select * from jsons1 where jtag contains 'sex' and jtag contains 'num'")
+ tdSql.checkRows(0)
+
+ tdSql.query("select jtag->'sex' from jsons1 where jtag contains 'sex' or jtag contains 'num'")
+ tdSql.checkData(0, 0, "\"femail\"")
+ tdSql.checkRows(3)
+
+ tdSql.query("select *,tbname from jsons1 where jtag->'location'='beijing'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select *,tbname from jsons1 where jtag->'num'=5 or jtag contains 'sex'")
+ tdSql.checkRows(4)
+
+ # test with tbname
+ tdSql.query("select * from jsons1 where tbname = 'jsons1_1'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select * from jsons1 where tbname = 'jsons1_1' or jtag contains 'num'")
+ tdSql.checkRows(5)
+
+ tdSql.query("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'num'")
+ tdSql.checkRows(0)
+
+ tdSql.query("select * from jsons1 where tbname = 'jsons1_1' or jtag->'num'=5")
+ tdSql.checkRows(4)
+
+ # test where condition like
+ tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' and jtag->'location'='beijin'")
+ tdSql.checkRows(0)
+
+ tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' or jtag->'location'='beijin'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select *,tbname from jsons1 where jtag->'location' like 'bei%' and jtag->'num'=34")
+ tdSql.checkRows(1)
+
+ tdSql.query("select *,tbname from jsons1 where (jtag->'location' like 'shanghai%' or jtag->'num'=34) and jtag->'class'=55")
+ tdSql.checkRows(0)
+
+ tdSql.query("select * from jsons1 where jtag->'num' like '5%'")
+ tdSql.checkRows(0)
+
+ # # test where condition in
+ # tdSql.query("select * from jsons1 where jtag->'location' in ('beijing')")
+ # tdSql.checkRows(3)
+
+ # tdSql.query("select * from jsons1 where jtag->'num' in (5,34)")
+ # tdSql.checkRows(2)
+
+ # tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)")
+
+ # tdSql.query("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55")
+ # tdSql.checkRows(1)
+
+ # test where condition match
+ tdSql.query("select * from jsons1 where jtag->'location' match 'jin$'")
+ tdSql.checkRows(0)
+
+ tdSql.query("select * from jsons1 where jtag->'location' match 'jin'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select * from jsons1 where datastr match 'json' and jtag->'location' match 'jin'")
+ tdSql.checkRows(3)
+
+ tdSql.query("select * from jsons1 where jtag->'num' match '5'")
+ tdSql.checkRows(0)
+
+ # test json string parse
+ tdSql.error("CREATE TABLE if not exists jsons1_5 using jsons1 tags('efwewf')")
+ tdSql.execute("CREATE TABLE if not exists jsons1_5 using jsons1 tags('\t')")
+ tdSql.execute("CREATE TABLE if not exists jsons1_6 using jsons1 tags('')")
+
+ tdSql.query("select jtag from jsons1_6")
+ tdSql.checkData(0, 0, None)
+
+ tdSql.execute("CREATE TABLE if not exists jsons1_7 using jsons1 tags('{}')")
+ tdSql.query("select jtag from jsons1_7")
+ tdSql.checkData(0, 0, None)
+
+ tdSql.execute("CREATE TABLE if not exists jsons1_8 using jsons1 tags('null')")
+ tdSql.query("select jtag from jsons1_8")
+ tdSql.checkData(0, 0, None)
+
+ tdSql.execute("CREATE TABLE if not exists jsons1_9 using jsons1 tags('{\"\":4,\"time\":null}')")
+ tdSql.query("select jtag from jsons1_9")
+ tdSql.checkData(0, 0, "{\"time\":null}")
+
+ tdSql.execute("CREATE TABLE if not exists jsons1_10 using jsons1 tags('{\"k1\":\"\",\"k1\":\"v1\",\"k2\":true,\"k3\":false,\"k4\":55}')")
+ tdSql.query("select jtag from jsons1_10")
+ tdSql.checkData(0, 0, "{\"k1\":\"\",\"k2\":true,\"k3\":false,\"k4\":55}")
+
+ tdSql.query("select jtag->'k2' from jsons1_10")
+ tdSql.checkData(0, 0, "true")
+
+ tdSql.query("select jtag from jsons1 where jtag->'k1'=''")
+ tdSql.checkRows(1)
+
+ tdSql.query("select jtag from jsons1 where jtag->'k2'=true")
+ tdSql.checkRows(1)
+
+ tdSql.query("select jtag from jsons1 where jtag is null")
+ tdSql.checkRows(4)
+
+ tdSql.query("select jtag from jsons1 where jtag is not null")
+ tdSql.checkRows(6)
+
+ tdSql.query("select * from jsons1 where jtag->'location' is not null")
+ tdSql.checkRows(3)
+
+ tdSql.query("select tbname,jtag from jsons1 where jtag->'location' is null")
+ tdSql.checkRows(7)
+
+ tdSql.query("select * from jsons1 where jtag->'num' is not null")
+ tdSql.checkRows(2)
+
+ tdSql.query("select * from jsons1 where jtag->'location'='null'")
+ tdSql.checkRows(0)
+
+ tdSql.query("select * from jsons1 where jtag->'num'=null")
+ tdSql.checkRows(0)
+
+ # test distinct
+ tdSql.query("select distinct jtag from jsons1")
+ tdSql.checkRows(7)
+
+ tdSql.query("select distinct jtag->'location' from jsons1")
+ tdSql.checkRows(2)
+
+ # test chinese
+ tdSql.execute("CREATE TABLE if not exists jsons1_11 using jsons1 tags('{\"k1\":\"中国\",\"k5\":\"是是是\"}')")
+
+ tdSql.query("select tbname,jtag from jsons1 where jtag->'k1' match '中'")
+ tdSql.checkRows(1)
+
+ tdSql.query("select tbname,jtag from jsons1 where jtag->'k1'='中国'")
+ tdSql.checkRows(1)
+
+ #test dumplicate key with normal colomn
+ tdSql.execute("INSERT INTO jsons1_12 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"dataStr\":\"是是是\"}') values(now, 4, \"你就会\")")
+
+ tdSql.query("select *,tbname,jtag from jsons1 where jtag->'dataStr' match '是'")
+ tdSql.checkRows(1)
+
+ tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt'")
+ tdSql.checkRows(1)
+
+ # test filter : and /or / in/ like
+ tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool'")
+ tdSql.checkRows(2)
+
+ tdSql.query("select * from jsons1 where jtag->'num' is not null and jtag contains 'class' or jtag contains 'databool'")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 1, 4)
+
+ tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' and jtag->'location' like 'bei%'")
+ tdSql.checkRows(2)
+
+ tdSql.query("select * from jsons1 where datastr like '你就会' and ( jtag->'num' is not null or jtag contains 'tbname' and jtag contains 'databool' )")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 1, 4)
+
+ tdSql.error("select * from jsons1 where datastr like '你就会' and jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool'")
+
+
+ tdSql.error("select * from jsons1 where datastr like '你就会' or jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' or jtag->'location' in ('beijing') and jtag->'location' like 'bei%' ")
+
+ tdSql.query("select * from jsons1 where datastr like '你就会' and (jtag->'num' is not null or jtag contains 'class' and jtag contains 'databool' and jtag->'k1' match '中' and jtag->'location' like 'bei%' )")
+ tdSql.checkRows(0)
+
+ tdSql.error("select *,tbname,jtag from jsons1 where dataBool=true")
+
+ # test error
+ tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags(3333)")
+ tdSql.execute("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"1loc\":\"fff\",\";id\":5}')")
+ tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"。loc\":\"fff\",\"fsd\":5}')")
+ tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"试试\":\"fff\",\";id\":5}')")
+ tdSql.error("insert into jsons1_13 using jsons1 tags(3)")
+
+ # test query normal column,tag and tbname
+ tdSql.execute("create stable if not exists jsons3(ts timestamp, dataInt3 int, dataBool3 bool, dataStr3 nchar(50)) tags(jtag3 json)")
+ tdSql.execute("create table jsons3_2 using jsons3 tags('{\"t\":true,\"t123\":123,\"\":\"true\"}')")
+
+ tdSql.execute("create table jsons3_3 using jsons3 tags('{\"t\":true,\"t123\":456,\"k1\":true,\"str1\":\"111\"}')")
+ tdSql.execute("insert into jsons3_3 values(now, 4, true, 'test')")
+
+ tdSql.execute("insert into jsons3_4 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null,\"str1\":\"112\"}') values(now, 5, true, 'test')")
+ tdSql.query("select * from jsons3 where jtag3->'k1'=true")
+ tdSql.checkRows(1)
+ tdSql.error("select jtag3->k1 from jsons3 ")
+ tdSql.error("select jtag3 from jsons3 where jtag3->'k1'")
+ tdSql.error("select jtag3 from jsons3 where jtag3 contains 'k1'=true")
+ tdSql.error("select jtag3 contains 'k1' from jsons3;")
+ tdSql.error("select jtag3 contains 'k1'=true from jsons3;")
+ tdSql.error("select jtag3->'k1'=true from jsons3;")
+ tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":123,\"s\":null}') values(now, 5, true, 'test')")
+ tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":012,\"k2\":null,\"s\":null}') values(now+1s, 5, true, 'test')")
+ tdSql.query("select jtag3 from jsons3_5")
+ tdSql.checkData(0, 0, '{\"t\":true,\"t123\":789,\"k1\":123,\"s\":null}')
+ tdSql.execute("insert into jsons3_6 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null}') values(now, 5, true, 'test')")
+ tdSql.query("select jtag3 from jsons3 where jtag3->'t123'=12 or jtag3 contains 'k1'")
+ tdSql.checkRows(4)
+ tdSql.query("select distinct jtag3 from jsons3 where jtag3->'t123'=12 or jtag3 contains 'k1'")
+ tdSql.checkRows(4)
+
+
+ tdSql.execute("INSERT INTO jsons1_14 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"tianjing\",\"dataStr\":\"是是是\"}') values(now,5, \"你就会\")")
+
+ tdSql.query("select ts,jtag->'tbname',tbname from jsons1 where dataint>=1 and jtag contains 'tbname'")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, '\"tt\"')
+
+ tdSql.query("select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 3, 'jsons1_14')
+
+ tdSql.query("select ts,jtag3->'tbname', jtag3->'str1',tbname from jsons3 where jtag3->'t123' between 456 and 789 and jtag3->'str1' like '11%' ")
+ tdSql.checkRows(2)
+ for i in range(1):
+ if tdSql.queryResult[i][1] == 'jsons3_3':
+ tdSql.checkData(i, 2, 111)
+
+ tdSql.query("select jtag3->'',dataint3 from jsons3")
+ tdSql.checkRows(5)
+ for i in range(4):
+ if tdSql.queryResult[i][1] == 4:
+ tdSql.checkData(i, 0, None)
+ tdSql.query("select tbname,dataint3,jtag3->'k1' from jsons3;")
+ tdSql.checkRows(5)
+ for i in range(4):
+ if tdSql.queryResult[i][1] == 4:
+ tdSql.checkData(i, 2, 'true')
+
+ # Select_exprs is SQL function -Aggregation function , tests includes group by and order by
+
+ tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by jtag->'location';")
+ tdSql.checkData(2, 3, '\"tianjing\"')
+ tdSql.checkRows(3)
+ for i in range(2):
+ if tdSql.queryResult[i][3] == 'beijing':
+ tdSql.checkData(i, 0, 1)
+ tdSql.checkData(i, 1, 3)
+ tdSql.error("select avg(dataInt) as 123 ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by 123")
+ tdSql.error("select avg(dataInt) as avgdata ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by avgdata ;")
+ tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by ts;")
+ tdSql.checkRows(3)
+ tdSql.error("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by tbname;")
+ #notice,it should return error ****
+ tdSql.error("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by jtag->'num' ;")
+ tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by jtag->'age' ;")
+ tdSql.checkRows(2)
+ tdSql.error("select avg(dataInt) from jsons1 group by jtag->'location' order by dataInt;")
+ tdSql.error("select avg(dataInt),tbname from jsons1 group by jtag->'location' order by tbname;")
+ tdSql.execute("CREATE TABLE if not exists jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"beijing\"}')")
+ tdSql.execute("insert into jsons1_15 values(now+1s, 2, 'json1')")
+ tdSql.error("select twa(dataint) from jsons1 group by jtag->'location' order by jtag->'location';")
+ tdSql.error("select irate(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.query(" select stddev(dataint) from jsons1 group by jtag->'location';")
+ tdSql.checkRows(3)
+ tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';")
+ tdSql.checkRows(1)
+ tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;")
+
+
+
+ # Select_exprs is SQL function -Selection function
+
+ tdSql.query(" select min(dataint),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing' or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 1)
+ tdSql.query(" select max(dataint),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 12)
+ tdSql.query(" select first(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select last(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.error(" select last(*),jtag from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.query(" select last_row(*) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,0) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,50) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,90) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,100) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,0,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,50,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query(" select apercentile(dataint,100,'t-digest') from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkRows(1)
+ tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location';")
+ tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' asc;")
+ tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' desc;")
+ tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts desc;")
+ tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts asc;")
+ tdSql.query("select top(dataint,100) from jsons1 group by jtag->'location';")
+ tdSql.query("select bottom(dataint,1) from jsons1 group by jtag->'location';")
+ tdSql.query("select bottom(dataint,100) from jsons1 group by jtag->'location';")
+
+ tdSql.execute("create table if not exists jsons_interp(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)")
+ tdSql.execute("insert into jsons_interp_1 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"rate\":456,\"tea\":false}') values ('2021-07-25 02:19:54.119',2,'true',0.9,0.1,'123')")
+ tdSql.execute("insert into jsons_interp_1 values ('2021-07-25 02:19:54.219',3,'true',-4.8,-5.5,'123') ")
+ tdSql.execute("insert into jsons_interp_2 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"level\":\"123456\",\"rate\":123,\"tea\":false}') values ('2021-07-25 02:19:54.319',4,'true',0.9,0.1,'123')")
+ tdSql.execute("insert into jsons_interp_2 values ('2021-07-25 02:19:54.419',5,'true',-5.1,1.3,'123') ")
+ tdSql.query("select interp(dataint) as itd from jsons_interp where (jtag->'rate'=123 or jtag->'rate'=456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) group by tbname order by ts desc ;")
+ tdSql.checkRows(4)
+ tdSql.checkData(0,1,3)
+ tdSql.checkData(2,1,5)
+
+ tdSql.query("select interp(dataint) as itd from jsons_interp where (jtag->'rate'=123 or jtag->'rate'=456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) group by tbname order by tbname asc;")
+ tdSql.checkRows(4)
+ tdSql.checkData(0,1,2)
+ tdSql.checkData(2,1,4)
+
+ # Select_exprs is SQL function -Calculation function
+ tdSql.error(" select diff(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.error(" select Derivative(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.query(" select SPREAD(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.checkData(0, 0, 11)
+ tdSql.query(" select ceil(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.query(" select floor(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ tdSql.query(" select round(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
+ #need insert new data --data type is double or float and tests ceil floor round .
+ tdSql.execute("create table if not exists jsons7(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)")
+ tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now+2s,2,'true',0.9,0.1,'123')")
+ tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"tea\":false}') values (now+3s,2,'true',0.9,0.1,'123')")
+ tdSql.query("select * from jsons7 where jtag->'tea'=0 ;")
+ tdSql.checkRows(0)
+ tdSql.query("select * from jsons7 where jtag->'tea'=3;")
+ # tdSql.checkRows(0)
+ tdSql.execute("insert into jsons7_1 values (now+1s,3,'true',-4.8,-5.5,'123') ")
+ tdSql.execute("insert into jsons7_1 values (now+2s,4,'true',1.9998,2.00001,'123') ")
+ tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":123,\"tea\":false}') values (now,5,'true',4.01,2.2,'123') ")
+ tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"tag\":123,\"tea\":false}') values (now+5s,5,'false',4.01,2.2,'123') ")
+ tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+3s,-0.9) ")
+ tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+4s,-2.9) ")
+ tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+1s,-0.9) ")
+ tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+2s,-1.9) ")
+ tdSql.execute("CREATE TABLE if not exists jsons7_3 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":4569,\"tea\":false}') ")
+ tdSql.query("select ts,ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag contains 'tea';")
+ tdSql.query("select ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag contains 'tea';")
+ tdSql.query("select ts,floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag contains 'tea';")
+ tdSql.query("select floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag contains 'tea';")
+ tdSql.query("select ts,round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';")
+ tdSql.query("select round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';")
+
+ #modify one same key and diffirent data type,include negative number of double
+ tdSql.execute("insert into jsons7_4 using jsons7 tags('{\"nv\":null,\"tea\":123,\"tag\":123,\"tea\":false}') values (now+1s,5,'true',4.01,2.2,'abc'); ")
+ tdSql.execute("insert into jsons7_5 using jsons7 tags('{\"nv\":null,\"tea\":\"app\",\"tag\":123,\"tea\":false}') values (now+2s,5,'true',4.01,2.2,'abc'); ")
+ tdSql.error("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111111111111111111111111111111111111111111111111111111111111111,\"tag\":123,\"tea\":false}') values (now+3s,5,'true',4.01,2.2,'123'); ")
+ tdSql.execute("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111,\"tag\":123,\"tea\":false}') values (now,5,'false',4.01,2.2,'t123'); ")
+ tdSql.query("select jtag from jsons7 where jtag->'tea'>-1.01;")
+ # tdSql.checkRows(2)
+
+ # test join
+ tdSql.execute("create table if not exists jsons6(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)")
+ tdSql.execute("create table if not exists jsons5(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)")
+ tdSql.execute("CREATE TABLE if not exists jsons6_1 using jsons6 tags('{\"loc\":\"fff\",\"id\":6,\"user\":\"ffc\"}')")
+ tdSql.execute("CREATE TABLE if not exists jsons6_2 using jsons6 tags('{\"loc\":\"ffc\",\"id\":5}')")
+ tdSql.execute("insert into jsons6_1 values ('2020-04-18 15:00:00.000', 1, false, 'json1')")
+ tdSql.execute("insert into jsons6_2 values ('2020-04-18 15:00:01.000', 2, false, 'json1')")
+ tdSql.execute("insert into jsons5_1 using jsons5 tags('{\"loc\":\"fff\",\"num\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:00.000', 2, true, 'json2')")
+ tdSql.execute("insert into jsons5_2 using jsons5 tags('{\"loc\":\"fff\",\"id\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:01.000', 2, true, 'json2')")
+ tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'loc'=b.jtag->'loc'")
+ tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'user'=b.jtag->'loc';")
+ tdSql.query("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'id'=b.jtag->'id'")
+ tdSql.checkData(0, 0, "sss")
+ tdSql.checkData(0, 2, "\"ffc\"")
+
+
+
+ # #nested query
+ tdSql.error("select jtag->'tag' from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where cdata=3 ") # not currently supported
+ tdSql.error("select jtag from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where jtag->'tag'=123 ") # not currently supported
+ tdSql.query("select * from (select tbname,jtag->'tea',ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag contains 'tea') where cdata=5 ")
+ tdSql.checkRows(5)
+ for i in range(5):
+ if tdSql.queryResult[i][0] == 'jsons7_4':
+ tdSql.checkData(i, 1, 123)
+ tdSql.checkData(i, 3, 5)
+ if tdSql.queryResult[i][0] == 'jsons7_5':
+ tdSql.checkData(i, 1, "\"app\"")
+
+ # query child table
+ tdSql.error("select * from jsons3_2 where jtag3->'k1'=true;")
+ # tdSql.checkData(0, 0, None)
+ # tdSql.checkRows(3)
+
+ # union all :max times is 100
+ unioSql = "select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing' union all "
+ for i in range(99):
+ if (i < 98):
+ unioSql += "select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing' union all "
+ else:
+ print(i)
+ unioSql += " select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'"
+ tdSql.query(unioSql)
+ tdSql.checkRows(100)
+ unioSql += " union all select ts,jtag->'tbname',jtag->'location',tbname from jsons1 where dataint between 1 and 5 and jtag->'location'='tianjing'"
+ tdSql.error(unioSql)
+
+
+
+ # fuction testcase : stddev, supported data type: int\str\bool unsupported data type: float\double
+ tdSql.query(" select stddev(datafloat),dataint from jsons7 group by dataint;")
+ tdSql.checkRows(5)
+ tdSql.query(" select stddev(dataint) from jsons7 group by datastr;")
+ tdSql.checkRows(4)
+ tdSql.query(" select stddev(dataint) from jsons7 group by databool;")
+ tdSql.checkRows(3)
+ tdSql.error(" select stddev(dataint) from jsons7 group by datafloat;")
+ tdSql.error(" select stddev(dataint) from jsons7 group by datadouble;")
+ tdSql.execute("create table if not exists jsons8(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50),datatime timestamp) tags(jtag json)")
+ tdSql.execute("insert into jsons8_1 using jsons8 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now,2,'true',0.9,0.1,'abc',now+60s)")
+ tdSql.execute("insert into jsons8_2 using jsons8 tags('{\"nv\":null,\"tea\":true,\"\":false,\" \":123,\"tea\":false}') values (now+5s,2,'true',0.9,0.1,'abc',now+65s)")
+ tdSql.query(" select stddev(dataint) from jsons8 group by datatime;")
+ tdSql.error(" select stddev(datatime) from jsons8 group by datadouble;")
+
+
+ # # test drop tables and databases
+ # tdSql.execute("drop table jsons1_1")
+ # tdSql.execute("drop stable jsons1")
+ # tdSql.execute("drop stable jsons3")
+ # tdSql.execute("drop stable jsons2")
+ # tdSql.execute("drop database db_json")
+
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json
index 3f194f376a12772151c4d1c32f233e0d67e72857..e10fd1116b948032d5aa67dc0844bbf493d650de 100644
--- a/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json
+++ b/tests/pytest/tools/taosdemoAllTest/insert-1s1tntmr.json
@@ -41,7 +41,7 @@
"batch_create_tbl_num": 10,
"data_source": "rand",
"insert_mode": "taosc",
- "insert_rows": 10000,
+ "insert_rows": 100,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
@@ -67,7 +67,7 @@
"batch_create_tbl_num": 10,
"data_source": "rand",
"insert_mode": "taosc",
- "insert_rows": 20000,
+ "insert_rows": 200,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
diff --git a/tests/pytest/tools/taosdemoAllTest/insert-chinese.json b/tests/pytest/tools/taosdemoAllTest/insert-chinese.json
new file mode 100644
index 0000000000000000000000000000000000000000..b7f3be9546c61fe895979cdc13e39eea5a322400
--- /dev/null
+++ b/tests/pytest/tools/taosdemoAllTest/insert-chinese.json
@@ -0,0 +1,63 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 4,
+ "thread_count_create_tbl": 4,
+ "result_file": "./insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "interlace_rows": 100,
+ "num_of_records_per_req": 1000,
+ "max_sql_len": 1024000,
+ "chinese": "yes",
+ "databases": [{
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "replica": 1,
+ "days": 10,
+ "cache": 50,
+ "blocks": 8,
+ "precision": "ms",
+ "keep": 36500,
+ "minRows": 100,
+ "maxRows": 4096,
+ "comp":2,
+ "walLevel":1,
+ "cachelast":0,
+ "quorum":1,
+ "fsync":3000,
+ "update": 0
+ },
+ "super_tables": [{
+ "name": "stb0",
+ "child_table_exists":"no",
+ "childtable_count": 10,
+ "childtable_prefix": "stb00_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 20,
+ "data_source": "rand",
+ "insert_mode": "taosc",
+ "insert_rows": 150,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 0,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
+ }]
+ }]
+}
diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json
index 0a4f8a0df22e7362124ce3be2f581d437739368b..2c3b8c6f81962e02ff5aac37c58fb04b79159a7c 100644
--- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json
+++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json
@@ -32,7 +32,7 @@
"update": 0
},
"super_tables": [{
- "name": "stb",
+ "name": "stb1",
"child_table_exists":"no",
"auto_create_table": "123",
"childtable_count": 20,
@@ -56,7 +56,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb2",
"child_table_exists":"no",
"auto_create_table": "no",
"childtable_count": 20,
@@ -80,7 +80,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb3",
"child_table_exists":"no",
"auto_create_table": "yes",
"childtable_count": 20,
@@ -104,7 +104,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb4",
"child_table_exists":"yes",
"auto_create_table": "123",
"childtable_count": 20,
@@ -128,7 +128,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb5",
"child_table_exists":"yes",
"auto_create_table": "no",
"childtable_count": 20,
@@ -152,7 +152,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb6",
"child_table_exists":"yes",
"auto_create_table": "yes",
"childtable_count": 20,
diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json
index 7b90980445ddf3a0bbbd7a5652179635a85c6b53..f8fe21a6c4015a27ee663bc7ac54a7889af62add 100644
--- a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json
+++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json
@@ -32,7 +32,7 @@
"update": 0
},
"super_tables": [{
- "name": "stb",
+ "name": "stb1",
"child_table_exists":"no",
"auto_create_table": "123",
"childtable_count": 20,
@@ -56,7 +56,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb2",
"child_table_exists":"no",
"auto_create_table": "no",
"childtable_count": 20,
@@ -80,7 +80,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb3",
"child_table_exists":"no",
"auto_create_table": "yes",
"childtable_count": 20,
@@ -104,7 +104,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb4",
"child_table_exists":"yes",
"auto_create_table": "123",
"childtable_count": 20,
@@ -128,7 +128,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb5",
"child_table_exists":"yes",
"auto_create_table": "no",
"childtable_count": 20,
@@ -152,7 +152,7 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb6",
"child_table_exists":"yes",
"auto_create_table": "yes",
"childtable_count": 20,
diff --git a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json
index 5f1c3fb6ca9ac7d088281f89e93e4c038d97ad56..d51dee428fc8f1bb61af84d5f570f69cce344651 100644
--- a/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json
+++ b/tests/pytest/tools/taosdemoAllTest/insert-interval-speed.json
@@ -35,13 +35,13 @@
"super_tables": [{
"name": "stb0",
"child_table_exists":"no",
- "childtable_count": 100,
+ "childtable_count": 10,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 10,
"data_source": "rand",
"insert_mode": "taosc",
- "insert_rows": 20000,
+ "insert_rows": 200,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
@@ -61,13 +61,13 @@
{
"name": "stb1",
"child_table_exists":"no",
- "childtable_count": 100,
+ "childtable_count": 20,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 10,
"data_source": "rand",
"insert_mode": "taosc",
- "insert_rows": 20000,
+ "insert_rows": 200,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json
new file mode 100644
index 0000000000000000000000000000000000000000..be55d31d5595b210695584f6dbbc334bb7b7f8e6
--- /dev/null
+++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json
@@ -0,0 +1,88 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 4,
+ "thread_count_create_tbl": 4,
+ "result_file": "./insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "interlace_rows": 10,
+ "num_of_records_per_req": 10240000000,
+ "max_sql_len": 10240000000,
+ "databases": [{
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "replica": 1,
+ "days": 10,
+ "cache": 50,
+ "blocks": 8,
+ "precision": "ms",
+ "keep": 36500,
+ "minRows": 100,
+ "maxRows": 4096,
+ "comp":2,
+ "walLevel":1,
+ "cachelast":0,
+ "quorum":1,
+ "fsync":3000,
+ "update": 0
+ },
+ "super_tables": [{
+ "name": "stb2",
+ "child_table_exists":"no",
+ "childtable_count": 1,
+ "childtable_prefix": "stb02_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 12,
+ "data_source": "rand",
+ "insert_mode": "taosc",
+ "insert_rows": 1,
+ "childtable_limit": 0,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 0,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
+ },
+ {
+ "name": "stb4",
+ "child_table_exists":"no",
+ "childtable_count": 1,
+ "childtable_prefix": "stb04_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 12,
+ "data_source": "rand",
+ "insert_mode": "taosc",
+ "insert_rows": 1,
+ "childtable_limit": 0,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 100,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
+ }]
+ }]
+}
diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json
index 02efafbbbe5657ab5a81e64fef0c43405ca6e317..67abdc67eed813501e012c8b7dce5d0719d22eb6 100644
--- a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json
+++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json
@@ -109,58 +109,6 @@
"tags_file": "",
"columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
- },
- {
- "name": "stb2",
- "child_table_exists":"no",
- "childtable_count": 1,
- "childtable_prefix": "stb02_",
- "auto_create_table": "no",
- "batch_create_tbl_num": 12,
- "data_source": "rand",
- "insert_mode": "taosc",
- "insert_rows": 1,
- "childtable_limit": 0,
- "childtable_offset":0,
- "multi_thread_write_one_tbl": "no",
- "interlace_rows": 0,
- "insert_interval":0,
- "max_sql_len": 1024000,
- "disorder_ratio": 0,
- "disorder_range": 1000,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "sample_format": "csv",
- "sample_file": "./sample.csv",
- "tags_file": "",
- "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}],
- "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
- },
- {
- "name": "stb4",
- "child_table_exists":"no",
- "childtable_count": 1,
- "childtable_prefix": "stb04_",
- "auto_create_table": "no",
- "batch_create_tbl_num": 12,
- "data_source": "rand",
- "insert_mode": "taosc",
- "insert_rows": 1,
- "childtable_limit": 0,
- "childtable_offset":0,
- "multi_thread_write_one_tbl": "no",
- "interlace_rows": 100,
- "insert_interval":0,
- "max_sql_len": 1024000,
- "disorder_ratio": 0,
- "disorder_range": 1000,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "sample_format": "csv",
- "sample_file": "./sample.csv",
- "tags_file": "",
- "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}],
- "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
}]
}]
}
diff --git a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json
index c86ed978170d2a0c8fac12a3c9346dc5a87839f7..17153c2f2c00a2e296ebf59409be1287cb203c24 100644
--- a/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json
+++ b/tests/pytest/tools/taosdemoAllTest/insertColumnsAndTagNum4096.json
@@ -55,7 +55,7 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 5, "count":3075}, {"type": "BINARY", "len": 32, "count":6}],
+ "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 1, "count":3075}, {"type": "BINARY", "len": 32, "count":6}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}]
}]
}]
diff --git a/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json b/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json
index c85713c94c3dd6fe5ee55bcc36badcce474a746e..6a59d4d75d9f7f29e3697c26d72793b9ad8bd554 100644
--- a/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json
+++ b/tests/pytest/tools/taosdemoAllTest/querySuperMutisql100.json
@@ -11,7 +11,7 @@
"super_table_query": {
"stblname": "stb0",
"query_interval": 10000,
- "concurrent": 9,
+ "threads": 9,
"sqls": [
{
"sql": "select last_row(*) from xxxx",
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json
index 5be20c28bba11ff40296d062f93ab4fda57a1f88..cbd4f6cb59c1ddd146b42a233c740d6bbaca45d3 100644
--- a/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-allDataType-sml.json
@@ -35,7 +35,7 @@
"super_tables": [{
"name": "stb0",
"child_table_exists":"no",
- "childtable_count": 1000,
+ "childtable_count": 10,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 1,
@@ -55,13 +55,13 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "INT"}, {"type": "TIMESTAMP"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}],
+ "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}],
"tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 16, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 16, "count":1}]
},
{
"name": "stb1",
"child_table_exists":"no",
- "childtable_count": 1000,
+ "childtable_count": 20,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 10,
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json
index 2de298efa6553ec0c6de095ee0515a73e777445f..f21cd6297c5a6277c4d9dfb5ec6eda1d9220de97 100644
--- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json
@@ -35,14 +35,14 @@
"super_tables": [{
"name": "stb0",
"child_table_exists":"no",
- "childtable_count": 2,
+ "childtable_count": 1,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 0,
@@ -59,16 +59,16 @@
"tags": [{"type": "INT", "count":1}]
},
{
- "name": "stb2",
+ "name": "stb1",
"child_table_exists":"no",
- "childtable_count": 4,
+ "childtable_count": 2,
"childtable_prefix": "stb02_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -265,6 +265,84 @@
"tags_file": "",
"columns": [{"type": "BINARY", "len": 16, "count":1}],
"tags": [{"type": "BINARY", "count":1}]
+ },
+ {
+ "name": "stb10",
+ "child_table_exists":"no",
+ "childtable_count": 3,
+ "childtable_prefix": "stb10_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 100,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "line_protocol": "telnet" ,
+ "insert_rows":50,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "interlace_rows": 32767,
+ "insert_interval":0,
+ "max_sql_len": 1025000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2012-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "UBIGINT"}],
+ "tags": [{"type": "UBIGINT", "count":1}]
+ },
+ {
+ "name": "stb11",
+ "child_table_exists":"no",
+ "childtable_count": 3,
+ "childtable_prefix": "stb11_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 100,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "line_protocol": "telnet" ,
+ "insert_rows":50,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "interlace_rows": 32767,
+ "insert_interval":0,
+ "max_sql_len": 1025000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2012-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "UTINYINT"}],
+ "tags": [{"type": "UTINYINT", "count":1}]
+ },
+ {
+ "name": "stb12",
+ "child_table_exists":"no",
+ "childtable_count": 3,
+ "childtable_prefix": "stb12_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 100,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "line_protocol": "telnet" ,
+ "insert_rows":50,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "interlace_rows": 32767,
+ "insert_interval":0,
+ "max_sql_len": 1025000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2012-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [ {"type": "USMALLINT"}],
+ "tags": [{"type": "USMALLINT", "count":1}]
}]
}]
}
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
index ff825440e5cbfd8aa5d8d6e74538c5802af8af38..983a3009db68e95fecf3f8eda91f0aa3f41aff37 100644
--- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
@@ -35,14 +35,14 @@
"super_tables": [{
"name": "stb0",
"child_table_exists":"no",
- "childtable_count": 2,
+ "childtable_count": 1,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 0,
@@ -61,14 +61,14 @@
{
"name": "stb1",
"child_table_exists":"no",
- "childtable_count": 3,
+ "childtable_count": 2,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -87,14 +87,14 @@
{
"name": "stb2",
"child_table_exists":"no",
- "childtable_count": 4,
+ "childtable_count": 3,
"childtable_prefix": "stb02_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -113,14 +113,14 @@
{
"name": "stb3",
"child_table_exists":"no",
- "childtable_count": 5,
+ "childtable_count": 4,
"childtable_prefix": "stb03_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -139,14 +139,14 @@
{
"name": "stb4",
"child_table_exists":"no",
- "childtable_count": 6,
+ "childtable_count": 5,
"childtable_prefix": "stb04_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":30,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -165,14 +165,14 @@
{
"name": "stb5",
"child_table_exists":"no",
- "childtable_count": 15,
+ "childtable_count": 6,
"childtable_prefix": "stb05_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":20,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -191,7 +191,7 @@
{
"name": "stb6",
"child_table_exists":"no",
- "childtable_count": 20,
+ "childtable_count": 7,
"childtable_prefix": "stb06_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
@@ -217,14 +217,14 @@
{
"name": "stb7",
"child_table_exists":"no",
- "childtable_count": 30,
+ "childtable_count": 8 ,
"childtable_prefix": "stb07_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":5,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -243,14 +243,14 @@
{
"name": "stb8",
"child_table_exists":"no",
- "childtable_count": 20,
+ "childtable_count": 9,
"childtable_prefix": "stb08_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":30,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -269,14 +269,14 @@
{
"name": "stb9",
"child_table_exists":"no",
- "childtable_count": 3,
+ "childtable_count": 10,
"childtable_prefix": "stb09_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -295,14 +295,14 @@
{
"name": "stb10",
"child_table_exists":"no",
- "childtable_count": 3,
+ "childtable_count": 11,
"childtable_prefix": "stb10_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -321,14 +321,14 @@
{
"name": "stb11",
"child_table_exists":"no",
- "childtable_count": 3,
+ "childtable_count": 12,
"childtable_prefix": "stb11_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
@@ -347,14 +347,14 @@
{
"name": "stb12",
"child_table_exists":"no",
- "childtable_count": 3,
+ "childtable_count": 13,
"childtable_prefix": "stb12_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
- "insert_rows":50,
+ "insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json
new file mode 100644
index 0000000000000000000000000000000000000000..4e8ff40cfdb7650f9d82635ac5be42f67904158a
--- /dev/null
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-timestamp.json
@@ -0,0 +1,113 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 4,
+ "thread_count_create_tbl": 4,
+ "result_file": "./insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "interlace_rows": 50000,
+ "num_of_records_per_req": 50000,
+ "max_sql_len": 1025000,
+ "databases": [{
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "replica": 1,
+ "days": 10,
+ "cache": 50,
+ "blocks": 8,
+ "precision": "ms",
+ "keep": 36500,
+ "minRows": 100,
+ "maxRows": 4096,
+ "comp":2,
+ "walLevel":1,
+ "cachelast":0,
+ "quorum":1,
+ "fsync":3000,
+ "update": 0
+ },
+ "super_tables": [{
+ "name": "stb0",
+ "child_table_exists":"no",
+ "childtable_count": 3,
+ "childtable_prefix": "stb12_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 100,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "insert_rows":50,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "interlace_rows": 32767,
+ "insert_interval":0,
+ "max_sql_len": 1025000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2012-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [ {"type": "TIMESTAMP"}],
+ "tags": [{"type": "TIMESTAMP", "count":1}]
+ },
+ {
+ "name": "stb1",
+ "child_table_exists":"no",
+ "childtable_count": 3,
+ "childtable_prefix": "stb12_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 100,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "line_protocol": "telnet" ,
+ "insert_rows":50,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "interlace_rows": 32767,
+ "insert_interval":0,
+ "max_sql_len": 1025000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2012-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [ {"type": "TIMESTAMP"}],
+ "tags": [{"type": "TIMESTAMP", "count":1}]
+ },
+ {
+ "name": "stb2",
+ "child_table_exists":"no",
+ "childtable_count": 3,
+ "childtable_prefix": "stb12_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 100,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "line_protocol": "json" ,
+ "insert_rows":50,
+ "childtable_limit": -1,
+ "childtable_offset":0,
+ "interlace_rows": 32767,
+ "insert_interval":0,
+ "max_sql_len": 1025000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2012-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [ {"type": "TIMESTAMP"}],
+ "tags": [{"type": "TIMESTAMP", "count":1}]
+ }]
+ }]
+}
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json
new file mode 100644
index 0000000000000000000000000000000000000000..c70db14b4c9b5fabe590eb8fec4a1f0e4dbc831a
--- /dev/null
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json
@@ -0,0 +1,88 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 4,
+ "thread_count_create_tbl": 4,
+ "result_file": "./insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "interlace_rows": 10,
+ "num_of_records_per_req": 10240000000,
+ "max_sql_len": 10240000000,
+ "databases": [{
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "replica": 1,
+ "days": 10,
+ "cache": 50,
+ "blocks": 8,
+ "precision": "ms",
+ "keep": 36500,
+ "minRows": 100,
+ "maxRows": 4096,
+ "comp":2,
+ "walLevel":1,
+ "cachelast":0,
+ "quorum":1,
+ "fsync":3000,
+ "update": 0
+ },
+ "super_tables": [{
+ "name": "stb2",
+ "child_table_exists":"no",
+ "childtable_count": 1,
+ "childtable_prefix": "stb02_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 12,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "insert_rows": 1,
+ "childtable_limit": 0,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 0,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
+ },
+ {
+ "name": "stb4",
+ "child_table_exists":"no",
+ "childtable_count": 1,
+ "childtable_prefix": "stb04_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 12,
+ "data_source": "rand",
+ "insert_mode": "sml",
+ "insert_rows": 1,
+ "childtable_limit": 0,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 100,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
+ }]
+ }]
+}
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json
index 83689d6c40e3844707cc367431f37f4f8ec144d5..12034adc0788f84852019d776fc0987cbc9c4f16 100644
--- a/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json
@@ -109,58 +109,6 @@
"tags_file": "",
"columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
- },
- {
- "name": "stb2",
- "child_table_exists":"no",
- "childtable_count": 1,
- "childtable_prefix": "stb02_",
- "auto_create_table": "no",
- "batch_create_tbl_num": 12,
- "data_source": "rand",
- "insert_mode": "sml",
- "insert_rows": 1,
- "childtable_limit": 0,
- "childtable_offset":0,
- "multi_thread_write_one_tbl": "no",
- "interlace_rows": 0,
- "insert_interval":0,
- "max_sql_len": 1024000,
- "disorder_ratio": 0,
- "disorder_range": 1000,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "sample_format": "csv",
- "sample_file": "./sample.csv",
- "tags_file": "",
- "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}],
- "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
- },
- {
- "name": "stb4",
- "child_table_exists":"no",
- "childtable_count": 1,
- "childtable_prefix": "stb04_",
- "auto_create_table": "no",
- "batch_create_tbl_num": 12,
- "data_source": "rand",
- "insert_mode": "sml",
- "insert_rows": 1,
- "childtable_limit": 0,
- "childtable_offset":0,
- "multi_thread_write_one_tbl": "no",
- "interlace_rows": 100,
- "insert_interval":0,
- "max_sql_len": 1024000,
- "disorder_ratio": 0,
- "disorder_range": 1000,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "sample_format": "csv",
- "sample_file": "./sample.csv",
- "tags_file": "",
- "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}],
- "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
}]
}]
}
diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json
index 98770a9fc80d8cde52674352469dffb5fa268715..2712f885936c12c1cf7742376ea541fd12e55cd4 100644
--- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json
+++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json
@@ -32,14 +32,14 @@
"update": 0
},
"super_tables": [{
- "name": "stb",
+ "name": "stb1",
"child_table_exists":"no",
"auto_create_table": "123",
"childtable_count": 20,
"childtable_prefix": "NN123_",
"batch_create_tbl_num": 100,
- "data_source": "rand",
- "insert_mode": "stmt",
+ "data_source": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -56,14 +56,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb2",
"child_table_exists":"no",
"auto_create_table": "no",
"childtable_count": 20,
"childtable_prefix": "NNN_",
"batch_create_tbl_num": 100,
- "data_source": "rand",
- "insert_mode": "stmt",
+ "data_source": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -80,14 +80,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb3",
"child_table_exists":"no",
"auto_create_table": "yes",
"childtable_count": 20,
"childtable_prefix": "NNY_",
"batch_create_tbl_num": 100,
- "data_source": "rand",
- "insert_mode": "stmt",
+ "data_source": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -104,14 +104,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb4",
"child_table_exists":"yes",
"auto_create_table": "123",
"childtable_count": 20,
"childtable_prefix": "NY123_",
"batch_create_tbl_num": 100,
- "data_source": "rand",
- "insert_mode": "stmt",
+ "data_source": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -128,14 +128,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb5",
"child_table_exists":"yes",
"auto_create_table": "no",
"childtable_count": 20,
"childtable_prefix": "NYN_",
"batch_create_tbl_num": 100,
- "data_source": "rand",
- "insert_mode": "stmt",
+ "data_source": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -152,14 +152,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb6",
"child_table_exists":"yes",
"auto_create_table": "yes",
"childtable_count": 20,
"childtable_prefix": "NYY_",
"batch_create_tbl_num": 100,
- "data_source": "rand",
- "insert_mode": "stmt",
+ "data_source": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json
index 9646f3dd23ef7bc9cbde6317437e10d96b0b213a..f8fe21a6c4015a27ee663bc7ac54a7889af62add 100644
--- a/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json
+++ b/tests/pytest/tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json
@@ -32,14 +32,14 @@
"update": 0
},
"super_tables": [{
- "name": "stb",
+ "name": "stb1",
"child_table_exists":"no",
"auto_create_table": "123",
"childtable_count": 20,
"childtable_prefix": "YN123_",
"batch_create_tbl_num": 100,
"data_source": "rand",
- "insert_mode": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -56,14 +56,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb2",
"child_table_exists":"no",
"auto_create_table": "no",
"childtable_count": 20,
"childtable_prefix": "YNN_",
"batch_create_tbl_num": 100,
"data_source": "rand",
- "insert_mode": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -80,14 +80,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb3",
"child_table_exists":"no",
"auto_create_table": "yes",
"childtable_count": 20,
"childtable_prefix": "YNY_",
"batch_create_tbl_num": 100,
"data_source": "rand",
- "insert_mode": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -104,14 +104,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb4",
"child_table_exists":"yes",
"auto_create_table": "123",
"childtable_count": 20,
"childtable_prefix": "YY123_",
"batch_create_tbl_num": 100,
"data_source": "rand",
- "insert_mode": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -128,14 +128,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb5",
"child_table_exists":"yes",
"auto_create_table": "no",
"childtable_count": 20,
"childtable_prefix": "YYN_",
"batch_create_tbl_num": 100,
"data_source": "rand",
- "insert_mode": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
@@ -152,14 +152,14 @@
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
},{
- "name": "stb",
+ "name": "stb6",
"child_table_exists":"yes",
"auto_create_table": "yes",
"childtable_count": 20,
"childtable_prefix": "YYY_",
"batch_create_tbl_num": 100,
"data_source": "rand",
- "insert_mode": "stmt",
+ "insert_mode": "taosc",
"insert_rows": 5,
"childtable_limit": 40,
"childtable_offset":0,
diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
new file mode 100644
index 0000000000000000000000000000000000000000..f59d2e4e22e165ddf1adf8b95212d521a75737d9
--- /dev/null
+++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json
@@ -0,0 +1,88 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos",
+ "host": "127.0.0.1",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 4,
+ "thread_count_create_tbl": 4,
+ "result_file": "./insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "interlace_rows": 10,
+ "num_of_records_per_req": 10240000000,
+ "max_sql_len": 10240000000,
+ "databases": [{
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "replica": 1,
+ "days": 10,
+ "cache": 50,
+ "blocks": 8,
+ "precision": "ms",
+ "keep": 36500,
+ "minRows": 100,
+ "maxRows": 4096,
+ "comp":2,
+ "walLevel":1,
+ "cachelast":0,
+ "quorum":1,
+ "fsync":3000,
+ "update": 0
+ },
+ "super_tables": [{
+ "name": "stb2",
+ "child_table_exists":"no",
+ "childtable_count": 1,
+ "childtable_prefix": "stb02_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 12,
+ "data_source": "rand",
+ "insert_mode": "stmt",
+ "insert_rows": 1,
+ "childtable_limit": 0,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 0,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
+ },
+ {
+ "name": "stb4",
+ "child_table_exists":"no",
+ "childtable_count": 1,
+ "childtable_prefix": "stb04_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 12,
+ "data_source": "rand",
+ "insert_mode": "stmt",
+ "insert_rows": 1,
+ "childtable_limit": 0,
+ "childtable_offset":0,
+ "multi_thread_write_one_tbl": "no",
+ "interlace_rows": 100,
+ "insert_interval":0,
+ "max_sql_len": 1024000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 1,
+ "start_timestamp": "2020-10-01 00:00:00.000",
+ "sample_format": "csv",
+ "sample_file": "./sample.csv",
+ "tags_file": "",
+ "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}],
+ "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
+ }]
+ }]
+}
diff --git a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json
index 5b7a7eda59831646a97318025b2b66979a17411a..4903335d181a0f06a0f0714072301438883f0f6e 100644
--- a/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json
+++ b/tests/pytest/tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json
@@ -109,58 +109,6 @@
"tags_file": "",
"columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
- },
- {
- "name": "stb2",
- "child_table_exists":"no",
- "childtable_count": 1,
- "childtable_prefix": "stb02_",
- "auto_create_table": "no",
- "batch_create_tbl_num": 12,
- "data_source": "rand",
- "insert_mode": "stmt",
- "insert_rows": 1,
- "childtable_limit": 0,
- "childtable_offset":0,
- "multi_thread_write_one_tbl": "no",
- "interlace_rows": 0,
- "insert_interval":0,
- "max_sql_len": 1024000,
- "disorder_ratio": 0,
- "disorder_range": 1000,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "sample_format": "csv",
- "sample_file": "./sample.csv",
- "tags_file": "",
- "columns": [{"type": "BINARY", "len": 16375, "count":1},{"type": "INT"}],
- "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
- },
- {
- "name": "stb4",
- "child_table_exists":"no",
- "childtable_count": 1,
- "childtable_prefix": "stb04_",
- "auto_create_table": "no",
- "batch_create_tbl_num": 12,
- "data_source": "rand",
- "insert_mode": "stmt",
- "insert_rows": 1,
- "childtable_limit": 0,
- "childtable_offset":0,
- "multi_thread_write_one_tbl": "no",
- "interlace_rows": 100,
- "insert_interval":0,
- "max_sql_len": 1024000,
- "disorder_ratio": 0,
- "disorder_range": 1000,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "sample_format": "csv",
- "sample_file": "./sample.csv",
- "tags_file": "",
- "columns": [{"type": "BINARY", "len": 16371, "count":3},{"type": "INT","count":6},{"type": "TINYINT"}],
- "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}]
}]
}]
}
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py
index 3bb290fdd0550bbebd95ebd9c30ee34272808281..4fdaab25fe182141bebbc06a30fa257481360be3 100644
--- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py
@@ -48,7 +48,7 @@ class TDTestCase:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
- # insert: create one or mutiple tables per sql and insert multiple rows per sql
+ # taosc interface
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-allDataType.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
@@ -79,7 +79,52 @@ class TDTestCase:
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 200000)
-
+
+ # insert-interface: sml
+ os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-allDataType-sml.json -y " % binPath)
+ tdSql.execute("use db")
+ tdSql.query("select count (tbname) from stb0")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count (tbname) from stb1")
+ tdSql.checkData(0, 0, 20)
+ # tdSql.query("select last(ts) from db.stb00_0")
+ # tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
+ tdSql.query("select count(*) from stb0")
+ tdSql.checkData(0, 0, 1000)
+ # tdSql.query("select last(ts) from db.stb01_0")
+ # tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
+ tdSql.query("select count(*) from stb1")
+ tdSql.checkData(0, 0, 4000)
+
+
+ # # insert-interface: sml-json
+ # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath)
+ # tdSql.execute("use db")
+ # tdSql.query("show stables")
+ # for i in range(13):
+ # for j in range(13):
+ # if tdSql.queryResult[i][0] == 'stb%d'%j:
+ # # print(i,"stb%d"%j)
+ # tdSql.checkData(i, 4, j+1)
+
+
+ # insert-interface: sml-telnet
+ os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json -y " % binPath)
+ tdSql.execute("use db")
+ tdSql.query("show stables")
+ for i in range(13):
+ for j in range(13):
+ if tdSql.queryResult[i][0] == 'stb%d'%j:
+ # print(i,"stb%d"%j)
+ tdSql.checkData(i, 4, j+1)
+ for i in range(13):
+ tdSql.query("select count(*) from stb%d"%i)
+ tdSql.checkData(0, 0, (i+1)*10)
+
+ # insert-interface: sml-telnet
+ assert os.system("%staosdemo -f tools/taosdemoAllTest/sml/insert-sml-timestamp.json -y " % binPath) !=0
+
+
# taosdemo command line
os.system("%staosBenchmark -t 1000 -n 100 -T 10 -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,NCHAR,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY -y " % binPath)
tdSql.execute("use test")
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f3106e0fa52b8622fe91546e13e4df69defed73
--- /dev/null
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
@@ -0,0 +1,184 @@
+###################################################################
+# 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
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+ global cfgPath
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ cfgPath = projPath + "/community/sim/dnode1/cfg"
+
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+ cfgPath = projPath + "/sim/dnode1/cfg"
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root)-len("/build/bin")]
+ break
+ return buildPath
+
+ # def checkGerData():
+
+ def run(self):
+ buildPath = self.getBuildPath()
+ print("%s" % cfgPath )
+ if (buildPath == ""):
+ tdLog.exit("taosd not found!")
+ else:
+ tdLog.info("taosd found in %s" % buildPath)
+ binPath = buildPath+ "/build/bin/"
+
+ tdLog.info("create super table")
+ # create super table
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath))
+ tdSql.execute("use db1")
+ tdSql.query("describe meters;")
+ tdSql.checkRows(13)
+ tdSql.query("select count(*) from meters")
+ tdSql.checkData(0, 0, 1000)
+ tdSql.query("select count(tbname) from meters")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count(*) from `test.0`")
+ tdSql.checkData(0, 0, 100)
+
+
+ tdLog.info("create general table -N ")
+ tdSql.execute("drop database db1;")
+ # create general table -N
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % (binPath,cfgPath))
+ tdSql.execute("use db1")
+ tdSql.query("describe `test.0`;")
+ tdSql.checkRows(11)
+ tdSql.error("select count(*) from meters")
+ tdSql.error("select count(tbname) from meters")
+ tdSql.query("select count(*) from `test.0`")
+ tdSql.checkData(0, 0, 100)
+
+ tdLog.info("use diffrent interface stmt")
+ tdSql.execute("drop database db1;")
+ # use diffrent interface-stmt
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath))
+ tdSql.execute("use db1")
+ tdSql.query("select count(*) from meters")
+ tdSql.checkData(0, 0, 1000)
+ tdSql.query("select count(tbname) from meters")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count(*) from `test.0`")
+ tdSql.checkData(0, 0, 100)
+
+ # tdLog.info("use diffrent interface rest")
+ # tdSql.execute("drop database db1;")
+ # # use diffrent interface -rest
+ # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \
+ # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath))
+ # tdSql.execute("use db1")
+ # tdSql.query("select count(*) from meters")
+ # tdSql.checkData(0, 0, 1000)
+ # tdSql.query("select count(tbname) from meters")
+ # tdSql.checkData(0, 0, 10)
+ # tdSql.query("select count(*) from `test.0`")
+ # tdSql.checkData(0, 0, 100)
+
+ tdLog.info("use diffrent interface sml")
+ tdSql.execute("drop database db1;")
+ # use diffrent interface-sml
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath))
+ tdSql.execute("use db1")
+ tdSql.query("select count(*) from meters")
+ tdSql.checkData(0, 0, 1000)
+ tdSql.query("select count(tbname) from meters")
+ tdSql.checkData(0, 0, 10)
+
+ tdLog.info("all data type")
+ tdSql.execute("drop database db1;")
+ # all data type
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \
+ -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath))
+ tdSql.execute("use db1")
+ tdSql.query("select count(*) from meters")
+ tdSql.checkData(0, 0, 1000)
+ tdSql.query("select count(tbname) from meters")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count(*) from `test.0`")
+ tdSql.checkData(0, 0, 100)
+
+ tdLog.info("all data type and interlace rows")
+ tdSql.execute("drop database db1;")
+ # all data type
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\
+ -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096\
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath))
+ tdSql.execute("use db3")
+ tdSql.query("select count(*) from meters")
+ tdSql.checkData(0, 0, 1000)
+ tdSql.query("select count(tbname) from meters")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count(*) from `test.0`")
+ tdSql.checkData(0, 0, 100)
+
+ tdLog.info("all data type and too much para")
+ tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \
+ localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath))
+ tdSql.execute("drop database db3;")
+ # repeate parameters
+ os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \
+ -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \
+ localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath))
+ tdSql.execute("use db1")
+ tdSql.query("select count(*) from meters")
+ tdSql.checkData(0, 0, 1000)
+ tdSql.query("select count(tbname) from meters")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count(*) from `test.0`")
+ tdSql.checkData(0, 0, 100)
+
+ # tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \
+ # -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath,cfgPath))
+ # # taosdemo error-exceeds max length
+ # assert os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \
+ # -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath,cfgPath)) != 0
+
+ testcaseFilename = os.path.split(__file__)[-1]
+ os.system("rm -rf ./insert_res*.txt*")
+ os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename )
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
index 2aaa5795866e03ab0bf4d3dbf6c0e431ebd604d3..06236a1d0175e4f685b29584cc0456e621fb754b 100644
--- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
@@ -68,21 +68,21 @@ class TDTestCase:
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 2000)
- # restful connector insert data
- os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath)
- tdSql.execute("use db")
- tdSql.query("select count (tbname) from stb0")
- tdSql.checkData(0, 0, 10)
- tdSql.query("select count (tbname) from stb1")
- tdSql.checkData(0, 0, 10)
- tdSql.query("select count(*) from stb00_0")
- tdSql.checkData(0, 0, 10)
- tdSql.query("select count(*) from stb0")
- tdSql.checkData(0, 0, 100)
- tdSql.query("select count(*) from stb01_1")
- tdSql.checkData(0, 0, 20)
- tdSql.query("select count(*) from stb1")
- tdSql.checkData(0, 0, 200)
+ # # restful connector insert data
+ # os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath)
+ # tdSql.execute("use db")
+ # tdSql.query("select count (tbname) from stb0")
+ # tdSql.checkData(0, 0, 10)
+ # tdSql.query("select count (tbname) from stb1")
+ # tdSql.checkData(0, 0, 10)
+ # tdSql.query("select count(*) from stb00_0")
+ # tdSql.checkData(0, 0, 10)
+ # tdSql.query("select count(*) from stb0")
+ # tdSql.checkData(0, 0, 100)
+ # tdSql.query("select count(*) from stb01_1")
+ # tdSql.checkData(0, 0, 20)
+ # tdSql.query("select count(*) from stb1")
+ # tdSql.checkData(0, 0, 200)
# default values json files
tdSql.execute("drop database if exists db")
@@ -103,30 +103,30 @@ class TDTestCase:
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb00_0")
- tdSql.checkData(0, 0, 10000)
+ tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
- tdSql.checkData(0, 0, 100000)
+ tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from stb01_0")
- tdSql.checkData(0, 0, 20000)
+ tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
- tdSql.checkData(0, 0, 400000)
+ tdSql.checkData(0, 0, 4000)
# insert: using parament "insert_interval to controls spped of insert.
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
- tdSql.checkData(0, 4, 100)
+ tdSql.checkData(0, 4, 10)
tdSql.query("select count(*) from stb00_0")
- tdSql.checkData(0, 0, 20000)
+ tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb0")
- tdSql.checkData(0, 0, 2000000)
+ tdSql.checkData(0, 0, 2000)
tdSql.query("show stables")
- tdSql.checkData(1, 4, 100)
+ tdSql.checkData(1, 4, 20)
tdSql.query("select count(*) from stb01_0")
- tdSql.checkData(0, 0, 20000)
+ tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
- tdSql.checkData(0, 0, 2000000)
+ tdSql.checkData(0, 0, 4000)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
@@ -218,6 +218,10 @@ class TDTestCase:
tdSql.query("select count(*) from db.stb3")
tdSql.checkRows(1)
tdSql.execute("drop database if exists db")
+ os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath)
+ tdSql.error("select * from db.stb4")
+ tdSql.error("select * from db.stb2")
+ tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
tdSql.error("select count(*) from db.stb0")
tdSql.execute("drop database if exists db")
@@ -353,6 +357,15 @@ class TDTestCase:
tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes
tdSql.checkRows(20)
+ # insert: test chinese encoding
+ os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath)
+ tdSql.execute("use db")
+ tdSql.query("select count (tbname) from stb0")
+ tdSql.checkData(0, 0, 10)
+ tdSql.query("select count (*) from stb0")
+ tdSql.checkData(0, 0, 1500)
+
+
# rm useless files
os.system("rm -rf ./insert*_res.txt*")
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
index 4c2baf5a11d3f5dff3a98664be11cac78ebb9c6b..f1eee8d0cff9f3ca22e70c683343f57ec7baca2b 100644
--- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
@@ -56,12 +56,8 @@ class TDTestCase:
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
- tdSql.query("select count(*) from stb00_0")
- tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1000)
- tdSql.query("select count(*) from stb01_1")
- tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
@@ -73,31 +69,27 @@ class TDTestCase:
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 15)
- tdSql.query("select count(*) from stb00_0")
- tdSql.checkData(0, 0, 150)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1500)
- tdSql.query("select count(*) from stb01_0")
- tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 3000)
- # insert: using parament "insert_interval to controls spped of insert.
- # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
- os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath)
- tdSql.execute("use db")
- tdSql.query("select tbname from stb0")
- tdSql.checkRows(100 )
- tdSql.query("select count(*) from stb00_0")
- tdSql.checkData(0, 0, 20)
- tdSql.query("select count(*) from stb0")
- tdSql.checkData(0, 0, 2000)
- tdSql.query("show stables")
- tdSql.checkData(1, 4, 20)
- tdSql.query("select count(*) from stb01_0")
- tdSql.checkData(0, 0, 35)
- tdSql.query("select count(*) from stb1")
- tdSql.checkData(0, 0, 700)
+ # # insert: using parament "insert_interval to controls spped of insert.
+ # # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
+ # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath)
+ # tdSql.execute("use db")
+ # tdSql.query("select tbname from db.stb0")
+ # tdSql.checkRows(100 )
+ # # tdSql.query("select count(*) from stb00_0")
+ # # tdSql.checkData(0, 0, 20)
+ # tdSql.query("select count(*) from stb0")
+ # tdSql.checkData(0, 0, 2000)
+ # tdSql.query("show stables")
+ # tdSql.checkData(1, 4, 20)
+ # # tdSql.query("select count(*) from stb01_0")
+ # # tdSql.checkData(0, 0, 35)
+ # tdSql.query("select count(*) from stb1")
+ # tdSql.checkData(0, 0, 700)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
@@ -142,10 +134,10 @@ class TDTestCase:
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkData(0, 0, 10000)
- tdSql.execute("drop database if exists db")
- os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath)
- tdSql.query("select count(*) from db.stb0")
- tdSql.checkRows(0)
+ # tdSql.execute("drop database if exists db")
+ # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath)
+ # tdSql.query("select count(*) from db.stb0")
+ # tdSql.checkRows(0)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath)
tdSql.execute("use db")
@@ -160,11 +152,13 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.query("select count(*) from db.stb1")
tdSql.checkRows(1)
- tdSql.error("select * from db.stb4")
- tdSql.error("select * from db.stb2")
tdSql.query("select count(*) from db.stb3")
tdSql.checkRows(1)
tdSql.execute("drop database if exists db")
+ os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json -y " % binPath)
+ tdSql.error("select * from db.stb4")
+ tdSql.error("select * from db.stb2")
+ tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json -y " % binPath)
tdSql.error("select count(*) from db.stb0")
tdSql.execute("drop database if exists db")
@@ -177,14 +171,17 @@ class TDTestCase:
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists blf")
- os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath)
- tdSql.execute("use blf")
- tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
- tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
- tdSql.query("select first(ts) from blf.p_0_topics_2")
- tdSql.checkData(0, 0, "2019-10-01 00:00:00")
- tdSql.query("select last(ts) from blf.p_0_topics_6 ")
- tdSql.checkData(0, 0, "2020-09-29 23:59:00")
+
+ # child table name is invalid reading,so
+ # os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath)
+ # tdSql.execute("use blf")
+ # tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
+ # tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
+ # tdSql.query("select first(ts) from blf.p_0_topics_2")
+ # tdSql.checkData(0, 0, "2019-10-01 00:00:00")
+ # tdSql.query("select last(ts) from blf.p_0_topics_6 ")
+ # tdSql.checkData(0, 0, "2020-09-29 23:59:00")
+
# it will be commented in ci because it spend too much time to insert data, but when you can excute it when you want to test this case.
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json -y " % binPath)
# tdSql.execute("use db")
@@ -200,6 +197,7 @@ class TDTestCase:
# tdSql.checkData(0, 0, 5000000)
+
# insert: timestamp and step
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-timestep-sml.json -y " % binPath)
tdSql.execute("use db")
@@ -207,12 +205,12 @@ class TDTestCase:
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
- tdSql.query("select last(ts) from db.stb00_0")
- tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
+ # tdSql.query("select last(ts) from db.stb00_0")
+ # tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 200)
- tdSql.query("select last(ts) from db.stb01_0")
- tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
+ # tdSql.query("select last(ts) from db.stb01_0")
+ # tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 400)
@@ -228,17 +226,17 @@ class TDTestCase:
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 10)
- # insert: sample json
- os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath)
- tdSql.execute("use dbtest123")
- tdSql.query("select c2 from stb0")
- tdSql.checkData(0, 0, 2147483647)
- tdSql.query("select * from stb1 where t1=-127")
- tdSql.checkRows(20)
- tdSql.query("select * from stb1 where t2=127")
- tdSql.checkRows(10)
- tdSql.query("select * from stb1 where t2=126")
- tdSql.checkRows(10)
+ # insert: doesn‘t currently supported sample json
+ assert os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y " % binPath) != 0
+ # tdSql.execute("use dbtest123")
+ # tdSql.query("select c2 from stb0")
+ # tdSql.checkData(0, 0, 2147483647)
+ # tdSql.query("select * from stb1 where t1=-127")
+ # tdSql.checkRows(20)
+ # tdSql.query("select * from stb1 where t2=127")
+ # tdSql.checkRows(10)
+ # tdSql.query("select * from stb1 where t2=126")
+ # tdSql.checkRows(10)
# insert: test interlace parament
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interlace-row-sml.json -y " % binPath)
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
index 5dba103ef9eafaf15d3159cae94e2b3a264cd8a9..05ccce79101b5bec1b541bd0436b86fc0151492c 100644
--- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
@@ -187,6 +187,10 @@ class TDTestCase:
tdSql.query("select count(*) from db.stb3")
tdSql.checkRows(1)
tdSql.execute("drop database if exists db")
+ os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json -y " % binPath)
+ tdSql.error("select * from db.stb4")
+ tdSql.error("select * from db.stb2")
+ tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json -y " % binPath)
tdSql.error("select count(*) from db.stb0")
tdSql.execute("drop database if exists db")
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
index e0b56b93ba0ed2c1e0a3e25bdc176059ea1ef61a..06dcda48064913d69b18cfa004a8218958e35413 100644
--- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
@@ -174,15 +174,15 @@ class TDTestCase:
"2020-11-01 00:00:00.004")
# query times less than or equal to 100
- os.system(
+ assert os.system(
"%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json" %
- binPath)
- os.system(
+ binPath) == 0
+ assert os.system(
"%staosBenchmark -f tools/taosdemoAllTest/querySpeciMutisql100.json" %
- binPath)
- os.system(
+ binPath) != 0
+ assert os.system(
"%staosBenchmark -f tools/taosdemoAllTest/querySuperMutisql100.json" %
- binPath)
+ binPath) == 0
# query result print QPS
os.system(
diff --git a/tests/pytest/tools/taosdemoTestTblAlt.py b/tests/pytest/tools/taosdemoTestTblAlt.py
index 7587ab9eb3e89275451864d28ccf985bcaac949a..444aab519bf7089b792125ffa3caa6de5ad4eb8d 100644
--- a/tests/pytest/tools/taosdemoTestTblAlt.py
+++ b/tests/pytest/tools/taosdemoTestTblAlt.py
@@ -30,6 +30,7 @@ class TDTestCase:
self.numberOfRecords = 1000000
def getBuildPath(self):
+ buildPath=""
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
@@ -38,7 +39,7 @@ class TDTestCase:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
- if ("taosd" in files):
+ if ("taosd" in files and "taosBenchmark" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
@@ -48,7 +49,7 @@ class TDTestCase:
def insertDataAndAlterTable(self, threadID):
buildPath = self.getBuildPath()
if (buildPath == ""):
- tdLog.exit("taosd not found!")
+ tdLog.exit("taosd or staosBenchmark not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
diff --git a/tests/pytest/tools/taosdumpTest2.py b/tests/pytest/tools/taosdumpTest2.py
index 839988375b652b0cfad09d8a6de7697de19609ea..c60fb42266c6d23ad9aeabc9bf9f48ac5feec17b 100644
--- a/tests/pytest/tools/taosdumpTest2.py
+++ b/tests/pytest/tools/taosdumpTest2.py
@@ -69,7 +69,7 @@ class TDTestCase:
os.system("rm /tmp/*.sql")
os.system(
- "%staosdump --databases db -o /tmp -B 32766 -L 1048576" %
+ "%staosdump --databases db -o /tmp -B 16384 -L 1048576" %
binPath)
tdSql.execute("drop database db")
diff --git a/tests/pytest/tools/taosdumpTest3.py b/tests/pytest/tools/taosdumpTest3.py
index d13c502fd5887d47b5094ef5bd08691372f9648b..ed83fe1ffb39f24f6eb7073d91bcaf62437527c3 100644
--- a/tests/pytest/tools/taosdumpTest3.py
+++ b/tests/pytest/tools/taosdumpTest3.py
@@ -137,7 +137,6 @@ class TDTestCase:
# verify ns
os.system("%staosdump -o ./taosdumptest/tmp6 dp3 st0_0" % binPath)
- assert os.system("%staosdump -o ./taosdumptest/tmp6 dp3 st0_0 -C ns " % binPath) != 0
# verify -D:--database
os.system("%staosdump -o ./taosdumptest/tmp5 --databases dp1,dp2 " % binPath)
diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim
index 6cec3895eb5e24bda398f8ce7472da83b403fbe7..e2ab5e6ffcd9dd499fda37ac3433023d85d4a446 100644
--- a/tests/script/fullGeneralSuite.sim
+++ b/tests/script/fullGeneralSuite.sim
@@ -238,3 +238,4 @@ run general/parser/tbname_escape.sim
run general/parser/columnName_escape.sim
run general/parser/tagName_escape.sim
run general/parser/interp_blocks.sim
+run general/parser/create_tb_with_timestamp_tag.sim
diff --git a/tests/script/general/parser/col_arithmetic_query.sim b/tests/script/general/parser/col_arithmetic_query.sim
index 9b0dc8e964cf39909b803fe5ea20a7bdff8ceb59..fa1bf5e54fc1570f21160161371833b1e701f846 100644
--- a/tests/script/general/parser/col_arithmetic_query.sim
+++ b/tests/script/general/parser/col_arithmetic_query.sim
@@ -660,6 +660,19 @@ sql select c2-c2 from $tb
sql select first(c1)-last(c1), spread(c2), max(c3) - min(c3), avg(c4)*count(c4) from $tb
+# arithmetic operation with now [d.21]===============================================================
+sql_error select now from $tb
+sql_error select now + 123 from $tb
+sql_error select 123 + now from $tb
+sql_error select now - 123 from $tb
+sql_error select 123 - now from $tb
+sql_error select now * 123 from $tb
+sql_error select 123 * now from $tb
+sql_error select now / 123 from $tb
+sql_error select 123 / now from $tb
+sql_error select now % 123 from $tb
+sql_error select 123 % now from $tb
+sql_error select 12 * now / 12 + 12 - 12 * 12 from $tb
#====================================================super table query==================================================
diff --git a/tests/script/general/parser/create_tb_with_timestamp_tag.sim b/tests/script/general/parser/create_tb_with_timestamp_tag.sim
new file mode 100644
index 0000000000000000000000000000000000000000..452fd2ddbf7d475a00f2fdd334e5065b6da71dc9
--- /dev/null
+++ b/tests/script/general/parser/create_tb_with_timestamp_tag.sim
@@ -0,0 +1,115 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/cfg.sh -n dnode1 -c walLevel -v 1
+system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2
+system sh/exec.sh -n dnode1 -s start
+
+sleep 100
+sql connect
+print ======================== dnode1 start
+
+$db = testdb
+
+sql create database $db precision 'ns'
+sql use $db
+
+sql create stable st1 (ts timestamp , c1 int) tags(t1 timestamp, t2 int)
+
+sql create table t1_0 using st1 tags(now, 0)
+#nanoseconds
+sql create table t1_1 using st1 tags(now + 1b, 0)
+#microseconds
+sql create table t1_2 using st1 tags(now + 1u, 0)
+#milliseconds
+sql create table t1_3 using st1 tags(now + 1a, 0)
+#seconds
+sql create table t1_4 using st1 tags(now + 1s, 0)
+#minutes
+sql create table t1_5 using st1 tags(now + 1m, 0)
+#hours
+sql create table t1_6 using st1 tags(now + 1h, 0)
+#days
+sql create table t1_7 using st1 tags(now + 1d, 0)
+#weeks
+sql create table t1_8 using st1 tags(now + 1w, 0)
+#months(not supported)
+sql_error create table t1_9 using st1 tags(now + 1n, 0)
+#years(not supported)
+sql_error create table t1_10 using st1 tags(now + 1y, 0)
+
+
+sql create stable st2 (ts timestamp , c1 int) tags(t1 timestamp, t2 int)
+
+sql create table t2_0 using st2 tags(now, 0)
+#nanoseconds
+sql create table t2_1 using st2 tags(now - 1b, 0)
+#microseconds
+sql create table t2_2 using st2 tags(now - 1u, 0)
+#milliseconds
+sql create table t2_3 using st2 tags(now - 1a, 0)
+#seconds
+sql create table t2_4 using st2 tags(now - 1s, 0)
+#minutes
+sql create table t2_5 using st2 tags(now - 1m, 0)
+#hours
+sql create table t2_6 using st2 tags(now - 1h, 0)
+#days
+sql create table t2_7 using st2 tags(now - 1d, 0)
+#weeks
+sql create table t2_8 using st2 tags(now - 1w, 0)
+#months(not supported)
+sql_error create table t2_9 using st2 tags(now - 1n, 0)
+#years(not supported)
+sql_error create table t2_10 using st2 tags(now - 1y, 0)
+
+sql insert into t1_0 values (now, 0)
+sql insert into t1_1 values (now, 1)
+sql insert into t1_2 values (now, 2)
+sql insert into t1_3 values (now, 3)
+sql insert into t1_4 values (now, 4)
+sql insert into t1_5 values (now, 5)
+sql insert into t1_6 values (now, 6)
+sql insert into t1_7 values (now, 7)
+sql insert into t1_8 values (now, 8)
+
+sql insert into t2_0 values (now, 0)
+sql insert into t2_1 values (now, 1)
+sql insert into t2_2 values (now, 2)
+sql insert into t2_3 values (now, 3)
+sql insert into t2_4 values (now, 4)
+sql insert into t2_5 values (now, 5)
+sql insert into t2_6 values (now, 6)
+sql insert into t2_7 values (now, 7)
+sql insert into t2_8 values (now, 8)
+
+sql select * from st1
+
+if $rows != 9 then
+ return -1
+endi
+
+sql select * from st2
+
+if $rows != 9 then
+ return -1
+endi
+
+sql create stable st3 (ts timestamp , c1 int) tags (t1 timestamp, t2 timestamp, t3 timestamp, t4 timestamp, t5 timestamp, t6 timestamp, t7 timestamp, t8 timestamp, t9 timestamp)
+sql create table t3 using st3 tags(now, now + 1b, now + 1u, now + 1a, now + 1s, now + 1m, now + 1h, now + 1d, now + 1w)
+sql insert into t3 values (now, 1)
+
+sql select * from st3
+if $rows != 1 then
+ return -1
+endi
+
+sql create stable st4 (ts timestamp , c1 int) tags (t1 timestamp, t2 timestamp, t3 timestamp, t4 timestamp, t5 timestamp, t6 timestamp, t7 timestamp, t8 timestamp, t9 timestamp)
+sql create table t4 using st4 tags(now, now - 1b, now - 1u, now - 1a, now - 1s, now - 1m, now - 1h, now - 1d, now - 1w)
+sql insert into t4 values (now, 1)
+
+sql select * from st4
+if $rows != 1 then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/general/parser/nestquery.sim
index 16803ea0965a66107a90aaf7ad37d715314a8258..3653efe0be35340c3aa68b678f63de7f0a0dda10 100644
--- a/tests/script/general/parser/nestquery.sim
+++ b/tests/script/general/parser/nestquery.sim
@@ -941,4 +941,219 @@ if $data02 != 0 then
return -1
endi
+print ==============> TD-11969
+sql create database test11969;
+sql use test11969;
+sql create stable st (ts timestamp , id int ) tags (ind int );
+sql insert into sub1 using st tags(1) values(now ,1);
+sql insert into sub1 using st tags(1) values(now ,2);
+sql insert into sub2 using st tags(2) values(now ,3);
+sql insert into sub2 using st tags(2) values(now ,4);
+sql_error select max(ts_inter) ,tbname from (select elapsed(ts) ts_inter ,tbname from st interval (1s) group by tbname) order by ts
+sql drop database test11969
+
+print ==========================================> TD-11097
+sql create database td11097
+sql use td11097
+sql create table meters2 (ts timestamp, voltage bigint,num int) tags (location binary(30), groupid int);
+sql create table D001 using meters2 tags ("Beijing.Chaoyang", 1);
+sql create table D002 using meters2 tags ("Beijing.haidian", 2);
+sql create table D003 using meters2 tags ('"Beijing.Tongzhou"', 3);
+$ts = 1639556426000
+sql insert into d001 values ( $ts ,1,2);
+sql insert into d001 values ( $ts +1m,2,3);
+sql insert into d001 values ( $ts +2m,4,3);
+sql insert into d001 values ( $ts +4m,8,3);
+sql insert into d002 values ( $ts ,4,3);
+sql insert into d002 values ( $ts +3m,40,3);
+sql insert into d002 values ( $ts +1m,46,3);
+sql insert into d001 values ( $ts +20m,1,2);
+sql insert into d002 values ( $ts +21m,4,3);
+sql select diff(voltage) value from meters2 group by tbname;
+sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ;
+sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts;
+sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc;
+
+$emptyString = @@
+print execute sql select diff(voltage) value from meters2 group by tbname;
+sql select diff(voltage) value from meters2 group by tbname;
+if $data00 != @21-12-15 16:21:26.000@ then
+ return -1
+endi
+if $data01 != @1@ then
+ return -1
+endi
+if $data02 != @d001@ then
+ return -1
+endi
+if $data10 != @21-12-15 16:22:26.000@ then
+ return -1
+endi
+if $data11 != @2@ then
+ return -1
+endi
+if $data12 != @d001@ then
+ return -1
+endi
+if $data20 != @21-12-15 16:24:26.000@ then
+ return -1
+endi
+if $data21 != @4@ then
+ return -1
+endi
+if $data22 != @d001@ then
+ return -1
+endi
+if $data30 != @21-12-15 16:40:26.000@ then
+ return -1
+endi
+if $data31 != @-7@ then
+ return -1
+endi
+if $data32 != @d001@ then
+ return -1
+endi
+if $data40 != @21-12-15 16:21:26.000@ then
+ return -1
+endi
+if $data41 != @42@ then
+ return -1
+endi
+if $data42 != @d002@ then
+ return -1
+endi
+if $data50 != @21-12-15 16:23:26.000@ then
+ return -1
+endi
+if $data51 != @-6@ then
+ return -1
+endi
+if $data52 != @d002@ then
+ return -1
+endi
+if $data60 != @21-12-15 16:41:26.000@ then
+ return -1
+endi
+if $data61 != @-36@ then
+ return -1
+endi
+if $data62 != @d002@ then
+ return -1
+endi
+print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ;
+sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ;
+if $data00 != @21-12-15 16:21:00.000@ then
+ return -1
+endi
+if $data01 != @43@ then
+ return -1
+endi
+if $data10 != @21-12-15 16:22:00.000@ then
+ return -1
+endi
+if $data11 != @2@ then
+ return -1
+endi
+if $data20 != @21-12-15 16:23:00.000@ then
+ return -1
+endi
+if $data21 != @-6@ then
+ return -1
+endi
+if $data30 != @21-12-15 16:24:00.000@ then
+ return -1
+endi
+if $data31 != @4@ then
+ return -1
+endi
+if $data40 != @21-12-15 16:40:00.000@ then
+ return -1
+endi
+if $data41 != @-7@ then
+ return -1
+endi
+if $data50 != @21-12-15 16:41:00.000@ then
+ return -1
+endi
+if $data51 != @-36@ then
+ return -1
+endi
+print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts;
+sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts;
+if $data00 != @21-12-15 16:21:00.000@ then
+ return -1
+endi
+if $data01 != @43@ then
+ return -1
+endi
+if $data10 != @21-12-15 16:22:00.000@ then
+ return -1
+endi
+if $data11 != @2@ then
+ return -1
+endi
+if $data20 != @21-12-15 16:23:00.000@ then
+ return -1
+endi
+if $data21 != @-6@ then
+ return -1
+endi
+if $data30 != @21-12-15 16:24:00.000@ then
+ return -1
+endi
+if $data31 != @4@ then
+ return -1
+endi
+if $data40 != @21-12-15 16:40:00.000@ then
+ return -1
+endi
+if $data41 != @-7@ then
+ return -1
+endi
+if $data50 != @21-12-15 16:41:00.000@ then
+ return -1
+endi
+if $data51 != @-36@ then
+ return -1
+endi
+print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc;
+sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc;
+if $data00 != @21-12-15 16:41:00.000@ then
+ return -1
+endi
+if $data01 != @-36@ then
+ return -1
+endi
+if $data10 != @21-12-15 16:40:00.000@ then
+ return -1
+endi
+if $data11 != @-7@ then
+ return -1
+endi
+if $data20 != @21-12-15 16:24:00.000@ then
+ return -1
+endi
+if $data21 != @4@ then
+ return -1
+endi
+if $data30 != @21-12-15 16:23:00.000@ then
+ return -1
+endi
+if $data31 != @-6@ then
+ return -1
+endi
+if $data40 != @21-12-15 16:22:00.000@ then
+ return -1
+endi
+if $data41 != @2@ then
+ return -1
+endi
+if $data50 != @21-12-15 16:21:00.000@ then
+ return -1
+endi
+if $data51 != @43@ then
+ return -1
+endi
+sql drop database td11097
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim
index 195eca928fa4ddbf3795ae3e40f973ea0a5e8def..be8d691f59e1fbd00e41b5bd625e09bfc6783845 100644
--- a/tests/script/general/parser/select_with_tags.sim
+++ b/tests/script/general/parser/select_with_tags.sim
@@ -956,4 +956,39 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group
#sql select count(c1) from select_tags_mt0 where c1=99 group by tbname;
#sql select count(*),tbname from select_tags_mt0 group by tbname
+print ==================================> TD-11943
+sql create database test11943;
+sql use test11943;
+sql create stable st (ts timestamp , id int ) tags (ind int );
+sql insert into sub1 using st tags(1) values(now ,1);
+sql insert into sub1 using st tags(1) values(now+1s ,2);
+sql insert into sub2 using st tags(2) values(now+2s ,3);
+sql insert into sub2 using st tags(2) values(now+3s ,4);
+sql select tbname ,max(id)+5 from sub1;
+if $data00 != @sub1@ then
+ return -1
+endi
+if $data01 != @7.000000000@ then
+ return -1
+endi
+sql select ind, max(id)+5 from st group by tbname
+if $data00 != @1@ then
+ return -1
+endi
+if $data01 != @7.000000000@ then
+ return -1
+endi
+if $data02 != @sub1@ then
+ return -1
+endi
+if $data10 != @2@ then
+ return -1
+endi
+if $data11 != @9.000000000@ then
+ return -1
+endi
+if $data12 != @sub2@ then
+ return -1
+endi
+sql drop database test11943
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/system-test/0-management/1-stable/create_col_tag.py b/tests/system-test/0-management/1-stable/create_col_tag.py
index d195e73321ea24a8b9de1f2ca5f9c07f9182dd65..826e68f3211e80b4b8dc029895b9145a70f654c6 100644
--- a/tests/system-test/0-management/1-stable/create_col_tag.py
+++ b/tests/system-test/0-management/1-stable/create_col_tag.py
@@ -23,10 +23,10 @@ from util.sql import tdSql
class TDTestCase:
def caseDescription(self):
'''
- case1:The escape char "`" can be used for both tag name and column name
- case2:create stable(column&tag); insert data; show stable; show create table; add stable(column&tag);change stable(tag);drop stable(column&tag);modify stable(column&tag)(binary和nchar);drop stable;
- case3:create stable_child; insert data; show stable_child; show create stable_child; drop stable_child;
- case4:create regular_table(column); insert data; show regular_table; show create regular_table; add regular_table(column);drop regular_table(column);modify regular_table(column)(binary和nchar);drop regular_table;
+ case1:The escape char "`" can be used for both tag name and column name
+ case2:create stable(column&tag); insert data; show stable; show create table; add stable(column&tag);change stable(tag);drop stable(column&tag);modify stable(column&tag)(binary and nchar);drop stable;
+ case3:create stable_child; insert data; show stable_child; show create stable_child; drop stable_child;
+ case4:create regular_table(column); insert data; show regular_table; show create regular_table; add regular_table(column);drop regular_table(column);modify regular_table(column)(binary and nchar);drop regular_table;
'''
return
diff --git a/tests/system-test/1-insert/0-sql/basic.py b/tests/system-test/1-insert/0-sql/basic.py
deleted file mode 100644
index 3604224c512d4a9f85de30a9069136801d343503..0000000000000000000000000000000000000000
--- a/tests/system-test/1-insert/0-sql/basic.py
+++ /dev/null
@@ -1,67 +0,0 @@
-###################################################################
-# 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
-#
-###################################################################
-
-# -*- coding: utf-8 -*-
-
-import sys
-from util.log import *
-from util.cases import *
-from util.sql import *
-
-
-class TDTestCase:
- def caseDescription(self):
- '''
- case1: insert 倒序插入
- case2: 语法解析错误同时meta请求也发出去了导致callback中处理逻辑失效
- case3: [TD-XXXX]insert语句在values之间加入多个逗号
- '''
- return
- def init(self, conn, logSql):
- tdLog.debug("start to execute %s" % __file__)
- tdSql.init(conn.cursor(), logSql)
-
- def run(self):
- tdSql.prepare()
-
- ret = tdSql.execute('create table tb (ts timestamp, speed int)')
-
- insertRows = 10
- tdLog.info("insert %d rows" % (insertRows))
- for i in range(0, insertRows):
- ret = tdSql.execute(
- 'insert into tb values (now + %dm, %d)' %
- (i, i))
-
- tdLog.info("insert earlier data")
- tdSql.execute('insert into tb values (now - 5m , 10)')
- tdSql.execute('insert into tb values (now - 6m , 10)')
- tdSql.execute('insert into tb values (now - 7m , 10)')
- tdSql.execute('insert into tb values (now - 8m , 10)')
-
- tdSql.query("select * from tb")
- tdSql.checkRows(insertRows + 4)
-
- # test case for https://jira.taosdata.com:18080/browse/TD-3716:
- tdSql.error("insert into tb(now, 1)")
- # test case for TD-10717
- tdSql.error("insert into tb values(now,1),,(now+1s,1)")
- tdSql.execute("insert into tb values(now+2s,1),(now+3s,1),(now+4s,1)")
- tdSql.query("select * from tb")
- tdSql.checkRows(insertRows + 4 +3)
-
- def stop(self):
- tdSql.close()
- tdLog.success("%s successfully executed" % __file__)
-
-
-tdCases.addWindows(__file__, TDTestCase())
-tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh
index 531043c6bd558fa5494f109afe36fcc76e36dde0..353b07439f7048b24c87290fa2f58522e1224768 100755
--- a/tests/system-test/fulltest.sh
+++ b/tests/system-test/fulltest.sh
@@ -1,5 +1,7 @@
-python3 test.py -f 1-insert/0-sql/basic.py
python3 test.py -f 0-management/1-stable/create_col_tag.py
# python3 test.py -f 2-query/9-others/TD-11945_crash.py # this test case must need TD-6140 merge into develop
#python3 test.py -f 2-query/9-others/TD-11389.py # this case will run when this bug fix TD-11389
+
+#python3 test.py -f 2-query/9-others/TD-11389.py # this case will run when this bug fix TD-11389
+