Merge branch '3.0' of https://github.com/taosdata/TDengine into refact/tsdb_last

This commit is contained in:
Hongze Cheng 2022-08-19 11:53:49 +08:00
commit f9eb3e9d35
40 changed files with 380 additions and 307 deletions

View File

@ -2,7 +2,7 @@
# taosadapter # taosadapter
ExternalProject_Add(taosadapter ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
GIT_TAG 3d21433 GIT_TAG abed566
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE

View File

@ -28,8 +28,7 @@ function runConsumer() {
console.log(msg.topicPartition); console.log(msg.topicPartition);
console.log(msg.block); console.log(msg.block);
console.log(msg.fields) console.log(msg.fields)
// fixme(@xiaolei): commented temp, should be fixed. consumer.commit(msg);
//consumer.commit(msg);
console.log(`=======consumer ${i} done`) console.log(`=======consumer ${i} done`)
} }

View File

@ -4,7 +4,7 @@
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@tdengine/client": "^3.0.0", "@tdengine/client": "^3.0.1",
"@tdengine/rest": "^3.0.0" "@tdengine/rest": "^3.0.0"
} }
} }

View File

@ -11,10 +11,10 @@ TDengine 采用类关系型数据模型,需要建库、建表。因此对于
不同类型的数据采集点往往具有不同的数据特征,包括数据采集频率的高低,数据保留时间的长短,副本的数目,数据块的大小,是否允许更新数据等等。为了在各种场景下 TDengine 都能最大效率的工作TDengine 建议将不同数据特征的表创建在不同的库里,因为每个库可以配置不同的存储策略。创建一个库时,除 SQL 标准的选项外,还可以指定保留时长、副本数、缓存大小、时间精度、文件块里最大最小记录条数、是否压缩、一个数据文件覆盖的天数等多种参数。比如: 不同类型的数据采集点往往具有不同的数据特征,包括数据采集频率的高低,数据保留时间的长短,副本的数目,数据块的大小,是否允许更新数据等等。为了在各种场景下 TDengine 都能最大效率的工作TDengine 建议将不同数据特征的表创建在不同的库里,因为每个库可以配置不同的存储策略。创建一个库时,除 SQL 标准的选项外,还可以指定保留时长、副本数、缓存大小、时间精度、文件块里最大最小记录条数、是否压缩、一个数据文件覆盖的天数等多种参数。比如:
```sql ```sql
CREATE DATABASE power KEEP 365 DURATION 10 BUFFER 16 VGROUPS 100 WAL 1; CREATE DATABASE power KEEP 365 DURATION 10 BUFFER 16 WAL_LEVEL 1;
``` ```
上述语句将创建一个名为 power 的库,这个库的数据将保留 365 天(超过 365 天将被自动删除),每 10 天一个数据文件,每个 VNODE 的写入内存池的大小为 16 MB数据库的 VGROUPS 数量,对该数据库入会写 WAL 但不执行 FSYNC。详细的语法及参数请见 [数据库管理](/taos-sql/database) 章节。 上述语句将创建一个名为 power 的库,这个库的数据将保留 365 天(超过 365 天将被自动删除),每 10 天一个数据文件,每个 VNODE 的写入内存池的大小为 16 MB对该数据库入会写 WAL 但不执行 FSYNC。详细的语法及参数请见 [数据库管理](/taos-sql/database) 章节。
创建库之后,需要使用 SQL 命令 `USE` 将当前库切换过来,例如: 创建库之后,需要使用 SQL 命令 `USE` 将当前库切换过来,例如:

View File

@ -28,6 +28,13 @@ if not exist %tagert_dir%\\driver (
if not exist C:\\TDengine\\cfg\\taos.cfg ( if not exist C:\\TDengine\\cfg\\taos.cfg (
copy %source_dir%\\packaging\\cfg\\taos.cfg %tagert_dir%\\cfg\\taos.cfg > nul copy %source_dir%\\packaging\\cfg\\taos.cfg %tagert_dir%\\cfg\\taos.cfg > nul
) )
if exist %binary_dir%\\test\\cfg\\taosadapter.toml (
if not exist %tagert_dir%\\cfg\\taosadapter.toml (
copy %binary_dir%\\test\\cfg\\taosadapter.toml %tagert_dir%\\cfg\\taosadapter.toml > nul
)
)
copy %source_dir%\\include\\client\\taos.h %tagert_dir%\\include > nul copy %source_dir%\\include\\client\\taos.h %tagert_dir%\\include > nul
copy %source_dir%\\include\\util\\taoserror.h %tagert_dir%\\include > nul copy %source_dir%\\include\\util\\taoserror.h %tagert_dir%\\include > nul
copy %source_dir%\\include\\libs\\function\\taosudf.h %tagert_dir%\\include > nul copy %source_dir%\\include\\libs\\function\\taosudf.h %tagert_dir%\\include > nul
@ -40,6 +47,9 @@ copy %binary_dir%\\build\\bin\\udfd.exe %tagert_dir% > nul
if exist %binary_dir%\\build\\bin\\taosBenchmark.exe ( if exist %binary_dir%\\build\\bin\\taosBenchmark.exe (
copy %binary_dir%\\build\\bin\\taosBenchmark.exe %tagert_dir% > nul copy %binary_dir%\\build\\bin\\taosBenchmark.exe %tagert_dir% > nul
) )
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
copy %binary_dir%\\build\\bin\\taosadapter.exe %tagert_dir% > nul
)
mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof mshta vbscript:createobject("shell.application").shellexecute("%~s0",":hasAdmin","","runas",1)(window.close)&& echo To start/stop TDengine with administrator privileges: sc start/stop taosd &goto :eof
:hasAdmin :hasAdmin

View File

@ -1503,11 +1503,17 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
} }
uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 0));
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
if (!IS_NUMERIC_TYPE(paraType) || QUERY_NODE_VALUE == nodeType) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
if (3 <= numOfParams) { if (3 <= numOfParams) {
int64_t timeVal[2] = {0}; int64_t timeVal[2] = {0};
for (int32_t i = 1; i < 3; ++i) { for (int32_t i = 1; i < 3; ++i) {
uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i)); nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i));
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type; paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type;
if (!IS_VAR_DATA_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) { if (!IS_VAR_DATA_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
} }
@ -1525,8 +1531,8 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
} }
if (4 == numOfParams) { if (4 == numOfParams) {
uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 3)); nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 3));
uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type; paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type;
if (!IS_INTEGER_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) { if (!IS_INTEGER_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
} }

View File

@ -14,7 +14,7 @@ print ========== cached_schema_after_alter.sim
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db sql create database $db
print ====== create tables print ====== create tables
sql use $db sql use $db
@ -32,10 +32,10 @@ if $rows != 1 then
endi endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
sql select * from $tb2 sql select * from $tb2
if $rows != 1 then if $rows != 1 then
@ -43,10 +43,10 @@ if $rows != 1 then
endi endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
@ -61,10 +61,10 @@ if $rows != 1 then
endi endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
sql select * from $tb2 sql select * from $tb2
print select * from $tb2 ==> $data00 $data01 $data02 print select * from $tb2 ==> $data00 $data01 $data02
@ -73,10 +73,10 @@ if $rows != 1 then
endi endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
$ts = $ts0 + $delta $ts = $ts0 + $delta
sql insert into $tb2 values ( $ts , 2, 2) sql insert into $tb2 values ( $ts , 2, 2)
@ -86,16 +86,16 @@ if $rows != 2 then
endi endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data11 != 2 then if $data11 != 2 then
return -1 return -1
endi endi
if $data12 != 2 then if $data12 != 2 then
return -1 return -1
endi endi
sql select * from $tb2 order by ts asc sql select * from $tb2 order by ts asc
if $rows != 2 then if $rows != 2 then
@ -103,15 +103,15 @@ if $rows != 2 then
endi endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data11 != 2 then if $data11 != 2 then
return -1 return -1
endi endi
if $data12 != 2 then if $data12 != 2 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql alter dnode 1 'resetlog' sql alter dnode 1 'resetlog'
sql alter dnode 1 'monitor' '1' sql alter dnode 1 'monitor' '1'
sql alter dnode 1 'monitor' '0' sql alter dnode 1 'monitor' '0'
@ -65,4 +65,4 @@ sql alter dnode 1 balance "vnode:2-dnode:1" -x step4
step4: step4:
print ======= over print ======= over
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql create database d1 sql create database d1
sql use d1 sql use d1
sql create table tb (ts timestamp, a int) sql create table tb (ts timestamp, a int)

View File

@ -7,24 +7,24 @@ sql connect
print =============== select * from information_schema.ins_dnodes print =============== select * from information_schema.ins_dnodes
sql select * from information_schema.ins_dnodes; sql select * from information_schema.ins_dnodes;
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 1 then if $data00 != 1 then
return -1 return -1
endi endi
sql select * from information_schema.ins_mnodes; sql select * from information_schema.ins_mnodes;
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 1 then if $data00 != 1 then
return -1 return -1
endi endi
if $data02 != leader then if $data02 != leader then
return -1 return -1
endi endi
@ -33,62 +33,62 @@ sql create dnode $hostname port 7200
sleep 2000 sleep 2000
sql select * from information_schema.ins_dnodes; sql select * from information_schema.ins_dnodes;
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
if $data00 != 1 then if $data00 != 1 then
return -1 return -1
endi endi
if $data10 != 2 then if $data10 != 2 then
return -1 return -1
endi endi
print $data02 print $data02
if $data02 != 0 then if $data02 != 0 then
return -1 return -1
endi endi
if $data12 != 0 then if $data12 != 0 then
return -1 return -1
endi endi
if $data04 != ready then if $data04 != ready then
return -1 return -1
endi endi
if $data14 != ready then if $data14 != ready then
return -1 return -1
endi endi
sql select * from information_schema.ins_mnodes; sql select * from information_schema.ins_mnodes;
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 1 then if $data00 != 1 then
return -1 return -1
endi endi
if $data02 != leader then if $data02 != leader then
return -1 return -1
endi endi
#print =============== create drop bnode 1 #print =============== create drop bnode 1
#sql create bnode on dnode 1 #sql create bnode on dnode 1
#sql show bnodes #sql show bnodes
#if $rows != 1 then #if $rows != 1 then
# return -1 # return -1
#endi #endi
#if $data00 != 1 then #if $data00 != 1 then
# return -1 # return -1
#endi #endi
#sql_error create bnode on dnode 1 #sql_error create bnode on dnode 1
# #
#sql drop bnode on dnode 1 #sql drop bnode on dnode 1
#sql show bnodes #sql show bnodes
#if $rows != 0 then #if $rows != 0 then
# return -1 # return -1
#endi #endi
#sql_error drop bnode on dnode 1 #sql_error drop bnode on dnode 1
@ -96,17 +96,17 @@ endi
#print =============== create drop bnode 2 #print =============== create drop bnode 2
#sql create bnode on dnode 2 #sql create bnode on dnode 2
#sql show bnodes #sql show bnodes
#if $rows != 1 then #if $rows != 1 then
# return -1 # return -1
#endi #endi
#if $data00 != 2 then #if $data00 != 2 then
# return -1 # return -1
#endi #endi
#sql_error create bnode on dnode 2 #sql_error create bnode on dnode 2
# #
#sql drop bnode on dnode 2 #sql drop bnode on dnode 2
#sql show bnodes #sql show bnodes
#if $rows != 0 then #if $rows != 0 then
# return -1 # return -1
#endi #endi
#sql_error drop bnode on dnode 2 #sql_error drop bnode on dnode 2
@ -115,7 +115,7 @@ endi
#sql create bnode on dnode 1 #sql create bnode on dnode 1
#sql create bnode on dnode 2 #sql create bnode on dnode 2
#sql show bnodes #sql show bnodes
#if $rows != 2 then #if $rows != 2 then
# return -1 # return -1
#endi #endi
@ -127,7 +127,7 @@ endi
# #
#sleep 2000 #sleep 2000
#sql show bnodes #sql show bnodes
#if $rows != 2 then #if $rows != 2 then
# return -1 # return -1
#endi #endi

View File

@ -25,7 +25,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -46,7 +46,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -67,7 +67,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -83,7 +83,7 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -93,18 +93,18 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
$i = 2 $i = 2
$db = $dbPrefix . $i $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -25,7 +25,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -47,7 +47,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -69,7 +69,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -85,7 +85,7 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -95,18 +95,18 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
$i = 2 $i = 2
$db = $dbPrefix . $i $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -26,7 +26,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -48,7 +48,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -70,7 +70,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -86,7 +86,7 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -96,18 +96,18 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
$i = 2 $i = 2
$db = $dbPrefix . $i $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -26,7 +26,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -48,7 +48,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -70,7 +70,7 @@ while $count < $N
endw endw
sql select * from $tb sql select * from $tb
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -85,7 +85,7 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
@ -95,18 +95,18 @@ $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
$i = 2 $i = 2
$db = $dbPrefix . $i $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql use $db sql use $db
sql select * from $tb sql select * from $tb
print select * from $tb ==> $rows points print select * from $tb ==> $rows points
if $rows != $N then if $rows != $N then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -186,13 +186,13 @@ sql_error alter database db replica 0
#sql alter database db replica 1 #sql alter database db replica 1
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print replica: $data4_db #print replica: $data4_db
#if $data4_db != 1 then #if $data4_db != 1 then
# return -1 # return -1
#endi #endi
#sql alter database db replica 3 #sql alter database db replica 3
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print replica: $data4_db #print replica: $data4_db
#if $data4_db != 3 then #if $data4_db != 3 then
# return -1 # return -1
#endi #endi
@ -200,13 +200,13 @@ sql_error alter database db replica 0
#sql alter database db quorum 2 #sql alter database db quorum 2
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print quorum $data5_db #print quorum $data5_db
#if $data5_db != 2 then #if $data5_db != 2 then
# return -1 # return -1
#endi #endi
#sql alter database db quorum 1 #sql alter database db quorum 1
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print quorum $data5_db #print quorum $data5_db
#if $data5_db != 1 then #if $data5_db != 1 then
# return -1 # return -1
#endi #endi
@ -233,7 +233,7 @@ endi
#sql alter database db keep 1000,2000 #sql alter database db keep 1000,2000
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print keep $data7_db #print keep $data7_db
#if $data7_db != 500,500,500 then #if $data7_db != 500,500,500 then
# return -1 # return -1
#endi #endi
@ -263,13 +263,13 @@ sql_error alter database db keep -1
#sql alter database db blocks 3 #sql alter database db blocks 3
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print blocks $data9_db #print blocks $data9_db
#if $data9_db != 3 then #if $data9_db != 3 then
# return -1 # return -1
#endi #endi
#sql alter database db blocks 11 #sql alter database db blocks 11
#sql select * from information_schema.ins_databases #sql select * from information_schema.ins_databases
#print blocks $data9_db #print blocks $data9_db
#if $data9_db != 11 then #if $data9_db != 11 then
# return -1 # return -1
#endi #endi
@ -300,13 +300,13 @@ print ============== step wal_level
sql alter database db wal_level 1 sql alter database db wal_level 1
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print wal_level $data20_db print wal_level $data20_db
if $data20_db != 1 then if $data20_db != 1 then
return -1 return -1
endi endi
sql alter database db wal_level 2 sql alter database db wal_level 2
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print wal_level $data20_db print wal_level $data20_db
if $data20_db != 2 then if $data20_db != 2 then
return -1 return -1
endi endi
@ -319,19 +319,19 @@ print ============== modify wal_fsync_period
sql alter database db wal_fsync_period 2000 sql alter database db wal_fsync_period 2000
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print wal_fsync_period $data21_db print wal_fsync_period $data21_db
if $data21_db != 2000 then if $data21_db != 2000 then
return -1 return -1
endi endi
sql alter database db wal_fsync_period 500 sql alter database db wal_fsync_period 500
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print wal_fsync_period $data21_db print wal_fsync_period $data21_db
if $data21_db != 500 then if $data21_db != 500 then
return -1 return -1
endi endi
sql alter database db wal_fsync_period 0 sql alter database db wal_fsync_period 0
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print wal_fsync_period $data21_db print wal_fsync_period $data21_db
if $data21_db != 0 then if $data21_db != 0 then
return -1 return -1
endi endi
sql_error alter database db wal_fsync_period 180001 sql_error alter database db wal_fsync_period 180001
@ -351,31 +351,31 @@ print ============== modify cachelast [0, 1, 2, 3]
sql alter database db cachemodel 'last_value' sql alter database db cachemodel 'last_value'
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print cachelast $data18_db print cachelast $data18_db
if $data18_db != last_value then if $data18_db != last_value then
return -1 return -1
endi endi
sql alter database db cachemodel 'last_row' sql alter database db cachemodel 'last_row'
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print cachelast $data18_db print cachelast $data18_db
if $data18_db != last_row then if $data18_db != last_row then
return -1 return -1
endi endi
sql alter database db cachemodel 'none' sql alter database db cachemodel 'none'
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print cachelast $data18_db print cachelast $data18_db
if $data18_db != none then if $data18_db != none then
return -1 return -1
endi endi
sql alter database db cachemodel 'last_value' sql alter database db cachemodel 'last_value'
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print cachelast $data18_db print cachelast $data18_db
if $data18_db != last_value then if $data18_db != last_value then
return -1 return -1
endi endi
sql alter database db cachemodel 'both' sql alter database db cachemodel 'both'
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print cachelast $data18_db print cachelast $data18_db
if $data18_db != both then if $data18_db != both then
return -1 return -1
endi endi

View File

@ -36,10 +36,10 @@ endi
print =============== step2: create database print =============== step2: create database
sql create database db vgroups 1 sql create database db vgroups 1
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data(db)[4] != 1 then if $data(db)[4] != 1 then
return -1 return -1
endi endi
@ -82,7 +82,7 @@ step3:
return -1 return -1
endi endi
sql select * from information_schema.ins_dnodes sql select * from information_schema.ins_dnodes
print ===> rows: $rows print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25 print ===> $data20 $data21 $data22 $data23 $data24 $data25
@ -115,7 +115,7 @@ step4:
return -1 return -1
endi endi
sql show db.vgroups sql show db.vgroups
print ===> rows: $rows print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data00 $data01 $data02 $data03 $data04 $data05
if $data[0][4] != leader then if $data[0][4] != leader then
goto step4 goto step4
@ -137,4 +137,4 @@ endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode4 -s stop -x SIGINT

View File

@ -23,7 +23,7 @@ step1:
return -1 return -1
endi endi
sql select * from information_schema.ins_dnodes sql select * from information_schema.ins_dnodes
print ===> rows: $rows print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25 print ===> $data20 $data21 $data22 $data23 $data24 $data25
@ -47,10 +47,10 @@ endi
print =============== step2: create database print =============== step2: create database
sql create database db vgroups 1 replica 3 sql create database db vgroups 1 replica 3
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data(db)[4] != 3 then if $data(db)[4] != 3 then
return -1 return -1
endi endi
@ -139,7 +139,7 @@ step3:
return -1 return -1
endi endi
sql show db.vgroups sql show db.vgroups
print ===> rows: $rows print ===> rows: $rows
if $rows != 1 then if $rows != 1 then
goto step3 goto step3
endi endi
@ -165,4 +165,4 @@ endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode4 -s stop -x SIGINT

View File

@ -2,8 +2,8 @@ sql connect
$x = 1 $x = 1
begin: begin:
sql reset query cache sql reset query cache
sleep 100 sleep 100
sql insert into db.tb values(now, $x ) -x begin sql insert into db.tb values(now, $x ) -x begin
#print ===> insert successed $x #print ===> insert successed $x
$x = $x + 1 $x = $x + 1
goto begin goto begin

View File

@ -25,15 +25,15 @@ endi
print =============== show vgroups1 print =============== show vgroups1
sql use d1 sql use d1
sql show vgroups sql show vgroups
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
if $data00 != 2 then if $data00 != 2 then
return -1 return -1
endi endi
if $data10 != 3 then if $data10 != 3 then
return -1 return -1
endi endi
@ -59,11 +59,11 @@ if $rows != 2 then
return -1 return -1
endi endi
if $data00 != 4 then if $data00 != 4 then
return -1 return -1
endi endi
if $data10 != 5 then if $data10 != 5 then
return -1 return -1
endi endi
@ -73,15 +73,15 @@ if $rows != 3 then
return -1 return -1
endi endi
if $data00 != 6 then if $data00 != 6 then
return -1 return -1
endi endi
if $data10 != 7 then if $data10 != 7 then
return -1 return -1
endi endi
if $data20 != 8 then if $data20 != 8 then
return -1 return -1
endi endi
@ -91,19 +91,19 @@ if $rows != 4 then
return -1 return -1
endi endi
if $data00 != 9 then if $data00 != 9 then
return -1 return -1
endi endi
if $data10 != 10 then if $data10 != 10 then
return -1 return -1
endi endi
if $data20 != 11 then if $data20 != 11 then
return -1 return -1
endi endi
if $data30 != 12 then if $data30 != 12 then
return -1 return -1
endi endi

View File

@ -27,7 +27,7 @@ sql create table t3 (ts timestamp, i int);
sql create table t4 (ts timestamp, i int); sql create table t4 (ts timestamp, i int);
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print rows: $rows print rows: $rows
print $data00 $data01 $data02 $data03 print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13 print $data10 $data11 $data12 $data13
if $rows != 3 then if $rows != 3 then
@ -47,7 +47,7 @@ endi
#endi #endi
sql show tables sql show tables
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
@ -64,8 +64,8 @@ if $rows != 4 then
endi endi
sql show tables sql show tables
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -23,12 +23,12 @@ if $data22 != 2 then
return -1 return -1
endi endi
#if $data03 != 4 then #if $data03 != 4 then
# return -1 # return -1
#endi #endi
sql show d1.tables sql show d1.tables
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
@ -44,8 +44,8 @@ if $rows != 4 then
endi endi
sql show d2.tables sql show d2.tables
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -11,109 +11,109 @@ sql create table d1.t3 (ts timestamp, i int);
sql create table d1.t4 (ts timestamp, i int); sql create table d1.t4 (ts timestamp, i int);
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data20 != d1 then if $data20 != d1 then
return -1 return -1
endi endi
if $data22 != 1 then if $data22 != 1 then
return -1 return -1
endi endi
if $data24 != 1 then if $data24 != 1 then
return -1 return -1
endi endi
sql show d1.tables sql show d1.tables
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
sql show d1.vgroups sql show d1.vgroups
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 2 then if $data00 != 2 then
return -1 return -1
endi endi
if $data01 != d1 then if $data01 != d1 then
return -1 return -1
endi endi
print =============== drop table print =============== drop table
sql drop table d1.t1 sql drop table d1.t1
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data20 != d1 then if $data20 != d1 then
return -1 return -1
endi endi
if $data22 != 1 then if $data22 != 1 then
return -1 return -1
endi endi
if $data24 != 1 then if $data24 != 1 then
return -1 return -1
endi endi
sql show d1.tables sql show d1.tables
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
sql show d1.vgroups sql show d1.vgroups
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 2 then if $data00 != 2 then
return -1 return -1
endi endi
if $data01 != d1 then if $data01 != d1 then
return -1 return -1
endi endi
print =============== drop all table print =============== drop all table
sql drop table d1.t2 sql drop table d1.t2
sql drop table d1.t3 sql drop table d1.t3
sql drop table d1.t4 sql drop table d1.t4
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data20 != d1 then if $data20 != d1 then
return -1 return -1
endi endi
if $data22 != 1 then if $data22 != 1 then
return -1 return -1
endi endi
if $data24 != 1 then if $data24 != 1 then
return -1 return -1
endi endi
sql show d1.tables sql show d1.tables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql show d1.vgroups sql show d1.vgroups
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 2 then if $data00 != 2 then
return -1 return -1
endi endi
if $data01 != d1 then if $data01 != d1 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -13,13 +13,13 @@ sql create table tb1 using st1 tags(1);
sql insert into tb1 values (now, 1); sql insert into tb1 values (now, 1);
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
print $rows print $rows
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -35,12 +35,12 @@ sql use db1;
sql create stable st1 (ts timestamp, f1 int) tags(t1 int) sql create stable st1 (ts timestamp, f1 int) tags(t1 int)
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi

View File

@ -14,7 +14,7 @@ $st = $stPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
print =============== step1 print =============== step1
# quorum presicion # quorum presicion
sql create database $db vgroups 8 replica 1 duration 2 keep 10 minrows 80 maxrows 10000 wal_level 2 wal_fsync_period 1000 comp 0 cachemodel 'last_value' precision 'us' sql create database $db vgroups 8 replica 1 duration 2 keep 10 minrows 80 maxrows 10000 wal_level 2 wal_fsync_period 1000 comp 0 cachemodel 'last_value' precision 'us'
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
@ -46,7 +46,7 @@ endi
#if $data29 != 12 then #if $data29 != 12 then
# return -1 # return -1
#endi #endi
print =============== step2 print =============== step2
sql_error create database $db sql_error create database $db
sql create database if not exists $db sql create database if not exists $db
@ -60,7 +60,7 @@ sql drop database $db
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
print =============== step4 print =============== step4
sql_error drop database $db sql_error drop database $db
@ -102,22 +102,22 @@ while $i < 5
sql create table $tb using $st tags(1) sql create table $tb using $st tags(1)
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
print $data00 $data01 $data02 $data03 print $data00 $data01 $data02 $data03
if $data00 != $st then if $data00 != $st then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
print $data00 $data01 $data02 $data03 print $data00 $data01 $data02 $data03
if $data00 != $tb then if $data00 != $tb then
return -1 return -1
endi endi
@ -127,8 +127,8 @@ endw
print =============== step7 print =============== step7
$i = 0 $i = 0
while $i < 5 while $i < 5
$db = $dbPrefix . $i $db = $dbPrefix . $i
sql drop database $db sql drop database $db
$i = $i + 1 $i = $i + 1
endw endw
@ -143,20 +143,20 @@ sql create table $st (ts timestamp, i int) tags (j int)
sql create table $tb using $st tags(1) sql create table $tb using $st tags(1)
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $st then if $data00 != $st then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $tb then if $data00 != $tb then
return -1 return -1
endi endi
@ -168,12 +168,12 @@ sql create database $db
sql use $db sql use $db
sql show stables sql show stables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
@ -182,20 +182,20 @@ sql create table $st (ts timestamp, i int) tags (j int)
sql create table $tb using $st tags(1) sql create table $tb using $st tags(1)
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $st then if $data00 != $st then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $tb then if $data00 != $tb then
return -1 return -1
endi endi
@ -207,12 +207,12 @@ sql create database $db
sql use $db sql use $db
sql show stables sql show stables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
@ -221,20 +221,20 @@ sql create table $st (ts timestamp, i int) tags (j int)
sql create table $tb using $st tags(1) sql create table $tb using $st tags(1)
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $st then if $data00 != $st then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $tb then if $data00 != $tb then
return -1 return -1
endi endi
@ -245,12 +245,12 @@ sql insert into $tb values (now+4a, 3)
sql insert into $tb values (now+5a, 4) sql insert into $tb values (now+5a, 4)
sql select * from $tb sql select * from $tb
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $st sql select * from $st
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -262,12 +262,12 @@ sql create database $db
sql use $db sql use $db
sql show stables sql show stables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
@ -276,20 +276,20 @@ sql create table $st (ts timestamp, i int) tags (j int)
sql create table $tb using $st tags(1) sql create table $tb using $st tags(1)
sql show stables sql show stables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $st then if $data00 != $st then
return -1 return -1
endi endi
sql show tables sql show tables
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != $tb then if $data00 != $tb then
return -1 return -1
endi endi
@ -300,12 +300,12 @@ sql insert into $tb values (now+4a, 3)
sql insert into $tb values (now+5a, 4) sql insert into $tb values (now+5a, 4)
sql select * from $tb sql select * from $tb
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $st sql select * from $st
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi

View File

@ -39,9 +39,9 @@ sql create table tb (ts timestamp, i int)
$x = 1 $x = 1
while $x < 41 while $x < 41
$time = $x . m $time = $x . m
sql insert into tb values (now + $time , $x ) sql insert into tb values (now + $time , $x )
$x = $x + 1 $x = $x + 1
endw endw
sql select * from tb order by ts desc sql select * from tb order by ts desc
print ===> rows $rows print ===> rows $rows
@ -71,7 +71,7 @@ if $data01 != 40 then
return -1 return -1
endi endi
$oldnum = $rows $oldnum = $rows
$num = $rows + 2 $num = $rows + 2
print ======== step3 import old data print ======== step3 import old data
@ -120,4 +120,4 @@ if $data01 != 40 then
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql create database d1 replica 1 vgroups 1 sql create database d1 replica 1 vgroups 1
sql create database d2 replica 1 vgroups 1 sql create database d2 replica 1 vgroups 1
sql create database d3 replica 1 vgroups 1 sql create database d3 replica 1 vgroups 1
@ -47,7 +47,7 @@ step2:
print ========= step3 print ========= step3
sql reset query cache sql reset query cache
sleep 50 sleep 50
sql create database d1 replica 1 sql create database d1 replica 1
sql create table d1.t1 (ts timestamp, i int) sql create table d1.t1 (ts timestamp, i int)
@ -65,20 +65,20 @@ while $x < 20
sql insert into d1.t1 values(now, -1) -x step4 sql insert into d1.t1 values(now, -1) -x step4
return -1 return -1
step4: step4:
sql create database d1 replica 1 sql create database d1 replica 1
sql reset query cache sql reset query cache
sleep 50 sleep 50
sql create table d1.t1 (ts timestamp, i int) sql create table d1.t1 (ts timestamp, i int)
sql insert into d1.t1 values(now, $x ) sql insert into d1.t1 values(now, $x )
sql select * from d1.t1 sql select * from d1.t1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
$x = $x + 1
print ===> loop times: $x
endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT $x = $x + 1
print ===> loop times: $x
endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql create database d1 replica 1 sql create database d1 replica 1
sql create database d2 replica 1 sql create database d2 replica 1
sql create database d3 replica 1 sql create database d3 replica 1
@ -48,7 +48,7 @@ step2:
print ========= step3 print ========= step3
sql create database db1 replica 1 sql create database db1 replica 1
sql reset query cache sql reset query cache
sleep 50 sleep 50
sql create table db1.tb1 (ts timestamp, i int) sql create table db1.tb1 (ts timestamp, i int)
sql insert into db1.tb1 values(now, 2) sql insert into db1.tb1 values(now, 2)
@ -61,7 +61,7 @@ print ========= step4
$x = 1 $x = 1
while $x < 20 while $x < 20
$db = db . $x $db = db . $x
$tb = tb . $x $tb = tb . $x
sql use $db sql use $db
sql drop database $db sql drop database $db
@ -69,14 +69,14 @@ while $x < 20
sql insert into $tb values(now, -1) -x step4 sql insert into $tb values(now, -1) -x step4
return -1 return -1
step4: step4:
$x = $x + 1 $x = $x + 1
$db = db . $x $db = db . $x
$tb = tb . $x $tb = tb . $x
sql reset query cache sql reset query cache
sleep 50 sleep 50
sql create database $db replica 1 sql create database $db replica 1
sql use $db sql use $db
sql create table $tb (ts timestamp, i int) sql create table $tb (ts timestamp, i int)
@ -85,8 +85,8 @@ while $x < 20
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
print ===> loop times: $x
endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT print ===> loop times: $x
endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
$tbPrefix = t $tbPrefix = t
$i = 0 $i = 0
@ -21,13 +21,13 @@ while $i < 30
print times $i print times $i
$i = $i + 1 $i = $i + 1
endw endw
print ======== step2 print ======== step2
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
@ -94,4 +94,4 @@ if $rows != 2 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -62,4 +62,4 @@ if $rows != 2 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database db sql create database db
sql create table db.tb (ts timestamp, i int) sql create table db.tb (ts timestamp, i int)
sql insert into db.tb values(now, 1) sql insert into db.tb values(now, 1)
@ -11,18 +11,18 @@ print ======== start back
run_back tsim/db/back_insert.sim run_back tsim/db/back_insert.sim
sleep 1000 sleep 1000
print ======== step1 print ======== step1
$x = 1 $x = 1
while $x < 10 while $x < 10
print drop database times $x print drop database times $x
sql drop database if exists db sql drop database if exists db
sql create database db sql create database db
sql create table db.tb (ts timestamp, i int) sql create table db.tb (ts timestamp, i int)
sleep 1000 sleep 1000
$x = $x + 1 $x = $x + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql create database db sql create database db
sql create table db.tb (ts timestamp, i int) sql create table db.tb (ts timestamp, i int)
sql insert into db.tb values(now, 1) sql insert into db.tb values(now, 1)
@ -11,11 +11,11 @@ sql create database db2
sql create table db2.tb2 (ts timestamp, i int) sql create table db2.tb2 (ts timestamp, i int)
sql insert into db2.tb2 values(now, 1) sql insert into db2.tb2 values(now, 1)
sql create database db3 sql create database db3
sql create table db3.tb3 (ts timestamp, i int) sql create table db3.tb3 (ts timestamp, i int)
sql insert into db3.tb3 values(now, 1) sql insert into db3.tb3 values(now, 1)
sql create database db4 sql create database db4
sql create table db4.tb4 (ts timestamp, i int) sql create table db4.tb4 (ts timestamp, i int)
sql insert into db4.tb4 values(now, 1) sql insert into db4.tb4 values(now, 1)
@ -23,19 +23,19 @@ print ======== start back
run_back tsim/db/back_insert.sim run_back tsim/db/back_insert.sim
sleep 1000 sleep 1000
print ======== step1 print ======== step1
$x = 1 $x = 1
while $x < 10 while $x < 10
print drop database times $x print drop database times $x
sql drop database if exists db sql drop database if exists db
sql create database db sql create database db
sql create table db.tb (ts timestamp, i int) sql create table db.tb (ts timestamp, i int)
sleep 1000 sleep 1000
$x = $x + 1 $x = $x + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -12,7 +12,7 @@ system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode2 -s start
sleep 2000 sleep 2000
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
sleep 2000 sleep 2000
@ -61,13 +61,13 @@ sql show tables
print $rows print $rows
if $rows != 16 then if $rows != 16 then
return -1 return -1
endi endi
sql select * from mt sql select * from mt
print $rows print $rows
if $rows != 16 then if $rows != 16 then
return -1 return -1
endi endi
print ========== step3 print ========== step3
@ -82,26 +82,26 @@ sql show tables
print $rows print $rows
if $rows != 8 then if $rows != 8 then
return -1 return -1
endi endi
sql select * from mt sql select * from mt
print $rows print $rows
if $rows != 8 then if $rows != 8 then
return -1 return -1
endi endi
sql select * from db.t5 sql select * from db.t5
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
sql select * from db.t13 sql select * from db.t13
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
sql_error select * from db.t1 sql_error select * from db.t1
sql_error select * from db.t9 sql_error select * from db.t9
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT

View File

@ -14,7 +14,7 @@ while $x < 41
sql insert into tb values (now - $time , $x ) -x step2 sql insert into tb values (now - $time , $x ) -x step2
step2: step2:
$x = $x + 1 $x = $x + 1
endw endw
sql select * from tb sql select * from tb
print ===> rows $rows last $data01 print ===> rows $rows last $data01
@ -42,10 +42,10 @@ sql alter database keepdb keep 60
sql flush database keepdb sql flush database keepdb
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data22 != 2 then if $data22 != 2 then
return -1 return -1
endi endi
if $data27 != 86400m,86400m,86400m then if $data27 != 86400m,86400m,86400m then
return -1 return -1
endi endi
@ -56,7 +56,7 @@ while $x < 81
sql insert into tb values (now - $time , $x ) -x step4 sql insert into tb values (now - $time , $x ) -x step4
step4: step4:
$x = $x + 1 $x = $x + 1
endw endw
sql select * from tb sql select * from tb
print ===> rows $rows last $data01 print ===> rows $rows last $data01
@ -83,10 +83,10 @@ endi
print ======== step6 alter db print ======== step6 alter db
sql alter database keepdb keep 30 sql alter database keepdb keep 30
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $data22 != 2 then if $data22 != 2 then
return -1 return -1
endi endi
if $data27 != 43200m,43200m,43200m then if $data27 != 43200m,43200m,43200m then
return -1 return -1
endi endi
@ -110,7 +110,7 @@ while $x < 121
sql insert into tb values (now - $time , $x ) -x step8 sql insert into tb values (now - $time , $x ) -x step8
step8: step8:
$x = $x + 1 $x = $x + 1
endw endw
sql select * from tb sql select * from tb
print ===> rows $rows last $data01 print ===> rows $rows last $data01
@ -137,4 +137,4 @@ error3:
print ======= test success print ======= test success
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT

View File

@ -11,33 +11,33 @@ sql create database -x step1
step1: step1:
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
print =============== step2 print =============== step2
sql create database a sql create database a
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
sql drop database a sql drop database a
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
print =============== step3 print =============== step3
sql create database a12345678 sql create database a12345678
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
sql drop database a12345678 sql drop database a12345678
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -46,15 +46,15 @@ sql create database a012345678901201234567890120123456789012a0123456789012012345
return -1 return -1
step4: step4:
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
print =============== step5 print =============== step5
sql create database a;1 sql create database a;1
sql drop database a sql drop database a
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -64,7 +64,7 @@ sql create database a'1 -x step6
step6: step6:
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -73,7 +73,7 @@ sql create database (a) -x step7
return -1 return -1
step7: step7:
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
@ -82,8 +82,8 @@ sql create database a.1 -x step8
return -1 return -1
step8: step8:
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -56,4 +56,4 @@ sql drop database d10
sql drop database d11 sql drop database d11
sql drop database d12 sql drop database d12
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -7,7 +7,7 @@ print =============== step2
sql create database db sql create database db
sql show create database db sql show create database db
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -15,13 +15,13 @@ print =============== step3
sql use db sql use db
sql show create database db sql show create database db
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != db then if $data00 != db then
return -1 return -1
endi endi
sql drop database db sql drop database db

View File

@ -11,14 +11,14 @@ sql create table t0 using meters tags(1,'ch')
sql create table normalTbl(ts timestamp, zone binary(8)) sql create table normalTbl(ts timestamp, zone binary(8))
sql use db sql use db
sql show create table meters sql show create table meters
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
print ===============check sub table print ===============check sub table
sql show create table t0 sql show create table t0
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 == 't0' then if $data00 == 't0' then
@ -27,8 +27,8 @@ endi
print ===============check normal table print ===============check normal table
sql show create table normalTbl sql show create table normalTbl
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -37,8 +37,8 @@ if $data00 == 'normalTbl' then
endi endi
print ===============check super table print ===============check super table
sql show create table meters sql show create table meters
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -49,7 +49,7 @@ endi
print ===============check sub table with prefix print ===============check sub table with prefix
sql show create table db.t0 sql show create table db.t0
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -58,8 +58,8 @@ if $data00 == 't0' then
endi endi
print ===============check normal table with prefix print ===============check normal table with prefix
sql show create table db.normalTbl sql show create table db.normalTbl
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -69,8 +69,8 @@ endi
print ===============check super table with prefix print ===============check super table with prefix
sql show create table db.meters sql show create table db.meters
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi

View File

@ -8,7 +8,7 @@ sql create database db
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
print $rows $data07 print $rows $data07
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
@ -125,4 +125,4 @@ if $data01 != 4 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -551,6 +551,29 @@ class TDTestCase:
tdSql.checkData(0, 0, 15) tdSql.checkData(0, 0, 15)
tdSql.checkData(1, 0, 15) tdSql.checkData(1, 0, 15)
tdLog.printNoPrefix("==========step9:test error cases")
tdSql.error(f"select interp(c0) from {dbname}.{tbname}")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05')")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d)")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') fill(null)")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} every(1s) fill(null)")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} where ts >= '2020-02-10 00:00:05' and ts <= '2020-02-15 00:00:05' every(1s) fill(null)")
# input can only be numerical types
tdSql.error(f"select interp(ts) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(c6) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(c7) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(c8) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
# input can only be columns
tdSql.error(f"select interp(1) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(1.5) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(true) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp(false) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp('abcd') from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp('中文字符') from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")

View File

@ -128,6 +128,7 @@ ELSE ()
COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/ COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy taosadapter-debug ${CMAKE_BINARY_DIR}/build/bin COMMAND cmake -E copy taosadapter-debug ${CMAKE_BINARY_DIR}/build/bin
) )
unset(_upx_prefix)
ELSEIF (TD_DARWIN) ELSEIF (TD_DARWIN)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(taosadapter ExternalProject_Add(taosadapter
@ -149,8 +150,42 @@ ELSE ()
COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/ COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy taosadapter-debug ${CMAKE_BINARY_DIR}/build/bin COMMAND cmake -E copy taosadapter-debug ${CMAKE_BINARY_DIR}/build/bin
) )
# unset(_upx_prefix)
ELSEIF (TD_WINDOWS)
include(ExternalProject)
set(_upx_prefix "${CMAKE_BINARY_DIR}/.taos/externals/upx")
ExternalProject_Add(upx
PREFIX "${_upx_prefix}"
URL https://github.com/upx/upx/releases/download/v3.96/upx-3.96-win32.zip
CONFIGURE_COMMAND cmake -E true
BUILD_COMMAND cmake -E true
INSTALL_COMMAND cmake -E true
)
ExternalProject_Add(taosadapter
PREFIX "taosadapter"
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/taosadapter
BUILD_ALWAYS off
DEPENDS taos
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cmake -E echo "taosadapter no need cmake to config"
PATCH_COMMAND
COMMAND git clean -f -d
BUILD_COMMAND
COMMAND set CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../include/client
COMMAND set CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib
COMMAND go build -ldflags "-s -w -X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
COMMAND go build -o taosadapter-debug -ldflags "-X github.com/taosdata/taosadapter/version.Version=${taos_version} -X github.com/taosdata/taosadapter/version.CommitID=${taosadapter_commit_sha1}"
INSTALL_COMMAND
COMMAND ${_upx_prefix}/src/upx/upx taosadapter.exe
COMMAND cmake -E copy taosadapter.exe ${CMAKE_BINARY_DIR}/build/bin
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy ./example/config/taosadapter.toml ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy ./taosadapter.service ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy taosadapter-debug ${CMAKE_BINARY_DIR}/build/bin
)
unset(_upx_prefix) unset(_upx_prefix)
ELSE () ELSE ()
MESSAGE("${Yellow} Windows system still use original embedded httpd ${ColourReset}") MESSAGE("${Yellow} taosAdapter Not supported yet ${ColourReset}")
ENDIF () ENDIF ()
ENDIF () ENDIF ()