未验证 提交 68895b4d 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #14321 from taosdata/fix/tsim

test: case for drop dnode
......@@ -40,6 +40,7 @@
./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim
./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim
./test.sh -f tsim/dnode/vnode_clean.sim
# ---- insert
./test.sh -f tsim/insert/basic0.sim
......
#!/bin/bash
echo "Executing move_dnode.sh"
UNAME_BIN=`which uname`
OS_TYPE=`$UNAME_BIN`
SCRIPT_DIR=`dirname $0`
cd $SCRIPT_DIR/../
SCRIPT_DIR=`pwd`
echo "SCRIPT_DIR: $SCRIPT_DIR"
IN_TDINTERNAL="community"
if [[ "$SCRIPT_DIR" == *"$IN_TDINTERNAL"* ]]; then
cd ../../..
else
cd ../../
fi
TAOS_DIR=`pwd`
TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1`
if [[ "$OS_TYPE" != "Darwin" ]]; then
cut_opt="--field="
else
cut_opt="-f "
fi
if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3`
else
BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2`
fi
BUILD_DIR=$TAOS_DIR/$BIN_DIR/build
SIM_DIR=$TAOS_DIR/sim
NODE_DIR=$SIM_DIR/$NODE_NAME
if [ -d "$SIM_DIR/$2" ];then
rm -rf $SIM_DIR/$2
fi
mv $SIM_DIR/$1 $SIM_DIR/$2
if [[ $2 =~ "dnode2" ]];then
sed -i 's/serverPort 7100/serverPort 7200/g' $SIM_DIR/$2/cfg/taos.cfg
sed -i 's/dnode1/dnode2/g' $SIM_DIR/$2/cfg/taos.cfg
sed -i 's/7100/7200/g' $SIM_DIR/$2/data/dnode/dnodeEps.json
elif [[ $2 =~ "dnode4" ]];then
sed -i 's/serverPort 7100/serverPort 7400/g' $SIM_DIR/$2/cfg/taos.cfg
sed -i 's/dnode1/dnode4/g' $SIM_DIR/$2/cfg/taos.cfg
sed -i 's/7100/7400/g' $SIM_DIR/dnode2/data/dnode/dnodeEps.json
sed -i 's/7100/7400/g' $SIM_DIR/dnode3/data/dnode/dnodeEps.json
sed -i 's/7100/7400/g' $SIM_DIR/$2/data/dnode/dnodeEps.json
fi
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c wallevel -v 1
system sh/cfg.sh -n dnode2 -c wallevel -v 1
system sh/cfg.sh -n dnode3 -c wallevel -v 1
system sh/cfg.sh -n dnode4 -c wallevel -v 1
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create database d1
sql create database d1 vgroups 1
sql create table d1.t1 (t timestamp, i int)
sql insert into d1.t1 values(now+1s, 15)
sql insert into d1.t1 values(now+2s, 14)
......@@ -33,34 +17,49 @@ sql insert into d1.t1 values(now+4s, 12)
sql insert into d1.t1 values(now+5s, 11)
sql show dnodes
print dnode1 openVnodes $data2_1
if $data2_1 != 1 then
print dnode1 openVnodes $data(1)[2]
if $data(1)[2] != 1 then
return -1
endi
print ========== step2
sql create dnode $hostname2
sql create dnode $hostname port 7200
system sh/exec.sh -n dnode2 -s start
$x = 0
show2:
step2:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
if $x == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
if $data2_1 != 0 then
goto show2
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
if $rows != 2 then
return -1
endi
if $data2_2 != 1 then
goto show2
if $data(1)[4] != ready then
goto step2
endi
if $data(2)[4] != ready then
goto step2
endi
sql balance vgroup
sql show dnodes
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(2)[2]
if $data(1)[2] != 0 then
return -1
endi
if $data(2)[2] != 1 then
return -1
endi
print ========== step3
sql create database d2
sql create database d2 vgroups 1
sql create table d2.t2 (t timestamp, i int)
sql insert into d2.t2 values(now+1s, 25)
......@@ -69,65 +68,68 @@ sql insert into d2.t2 values(now+3s, 23)
sql insert into d2.t2 values(now+4s, 22)
sql insert into d2.t2 values(now+5s, 21)
$x = 0
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
if $data2_1 != 0 then
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(2)[2]
if $data(1)[2] != 0 then
return -1
endi
if $data2_2 != 2 then
if $data(2)[2] != 2 then
return -1
endi
print ========== step4
sql drop dnode $hostname2
$x = 0
show4:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql drop dnode 2
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
if $data2_1 != 2 then
goto show4
endi
if $data2_2 != null then
goto show4
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(2)[2]
if $data(1)[2] != 2 then
return -1
endi
if $rows != 1 then
goto show4
if $data(2)[2] != null then
return -1
endi
system sh/exec.sh -n dnode2 -s stop -x SIGINT
print ========== step5
sql create dnode $hostname3
sql create dnode $hostname port 7300
system sh/exec.sh -n dnode3 -s start
$x = 0
show5:
step5:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
if $x == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode3 openVnodes $data2_3
if $data2_1 != 0 then
goto show5
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
if $rows != 2 then
return -1
endi
if $data(1)[4] != ready then
goto step5
endi
if $data(3)[4] != ready then
goto step5
endi
sql balance vgroup
sql show dnodes
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(3)[2]
if $data(1)[2] != 1 then
return -1
endi
if $data2_3 != 2 then
goto show5
if $data(3)[2] != 1 then
return -1
endi
print ========== step6
sql create database d3
sql create database d3 vgroups 1
sql create table d3.t3 (t timestamp, i int)
sql insert into d3.t3 values(now+1s, 35)
sql insert into d3.t3 values(now+2s, 34)
......@@ -136,43 +138,61 @@ sql insert into d3.t3 values(now+4s, 32)
sql insert into d3.t3 values(now+5s, 31)
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_3
if $data2_1 != 0 then
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(3)[2]
if $data(1)[2] != 1 then
return -1
endi
if $data2_3 != 3 then
if $data(3)[2] != 2 then
return -1
endi
print ========== step7
sql create dnode $hostname4
sql create dnode $hostname port 7400
system sh/exec.sh -n dnode4 -s start
$x = 0
show7:
step7:
$x = $x + 1
sleep 1000
if $x == 40 then
if $x == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show7
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25
if $rows != 3 then
return -1
endi
if $data(1)[4] != ready then
goto step7
endi
if $data2_3 != 2 then
goto show7
if $data(3)[4] != ready then
goto step7
endi
if $data2_4 != 1 then
goto show7
if $data(4)[4] != ready then
goto step7
endi
sql balance vgroup
sql show dnodes
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(3)[2]
print dnode2 openVnodes $data(4)[2]
if $data(1)[2] != 0 then
return -1
endi
if $data(3)[2] != 2 then
return -1
endi
if $data(4)[2] != 1 then
return -1
endi
print ========== step8
sql create database d4
sql create database d4 vgroups 1
sql create table d4.t4 (t timestamp, i int)
sql insert into d4.t4 values(now+1s, 45)
sql insert into d4.t4 values(now+2s, 44)
......@@ -180,53 +200,39 @@ sql insert into d4.t4 values(now+3s, 43)
sql insert into d4.t4 values(now+4s, 42)
sql insert into d4.t4 values(now+5s, 41)
$x = 0
show8:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show8
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(3)[2]
print dnode2 openVnodes $data(4)[2]
if $data(1)[2] != 0 then
return -1
endi
if $data2_3 != 2 then
goto show8
if $data(3)[2] != 2 then
return -1
endi
if $data2_4 != 2 then
goto show8
if $data(4)[2] != 2 then
return -1
endi
print ========== step9
sql drop dnode $hostname3
$x = 0
show9:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql drop dnode 3
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show9
print dnode1 openVnodes $data(1)[2]
print dnode2 openVnodes $data(3)[2]
print dnode2 openVnodes $data(4)[2]
if $data(1)[2] != 1 then
return -1
endi
if $data2_3 != null then
goto show9
if $data(3)[2] != null then
return -1
endi
if $data2_4 != 4 then
goto show9
if $data(4)[2] != 3 then
return -1
endi
system sh/exec.sh -n dnode3 -s stop
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sql reset query cache
sleep 100
print ========== step10
sql select * from d1.t1 order by t desc
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
system sh/cfg.sh -n dnode3 -c wallevel -v 2
system sh/cfg.sh -n dnode4 -c wallevel -v 2
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sleep 2000
print ========== step2
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start
sql create dnode $hostname4
system sh/exec.sh -n dnode4 -s start
$x = 0
show2:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show2
endi
if $data2_2 != 0 then
goto show2
endi
if $data2_3 != 0 then
goto show2
endi
if $data2_4 != 0 then
goto show2
endi
print ========== step3
sql create database d1 replica 3
sql create table d1.t1 (t timestamp, i int)
sql insert into d1.t1 values(now+1s, 35)
sql insert into d1.t1 values(now+2s, 34)
sql insert into d1.t1 values(now+3s, 33)
sql insert into d1.t1 values(now+4s, 32)
sql insert into d1.t1 values(now+5s, 31)
$x = 0
show3:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show3
endi
if $data2_2 != 1 then
goto show3
endi
if $data2_3 != 1 then
goto show3
endi
if $data2_4 != 1 then
goto show3
endi
print ========== step4
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 dnode4 -s stop -x SIGINT
print ========== step5
system_content rm -rf ../../../sim/dnode4/data/vnode/vnode2/tsdb/data
print ========== step6
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
sleep 10000
print ========== step7
sql select * from d1.t1 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 31 then
return -1
endi
if $data11 != 32 then
return -1
endi
if $data21 != 33 then
return -1
endi
if $data31 != 34 then
return -1
endi
if $data41 != 35 then
return -1
endi
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 dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode5 -s stop -x SIGINT
system sh/exec.sh -n dnode6 -s stop -x SIGINT
system sh/exec.sh -n dnode7 -s stop -x SIGINT
system sh/exec.sh -n dnode8 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print =============== step1
sql drop database -x step1
step1:
sql create database db
sql use db
sql create table m1 (ts timestamp, speed int)
print =============== step 2
$x = 0
while $x < 10
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into m1 values ($ms , $x )
$x = $x + 1
endw
sql select * from m1
print $rows points data are retrieved
if $rows != 10 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
print =============== step 3
system sh/move_dnode.sh dnode1 dnode2
system sh/exec.sh -n dnode2 -s start
print =============== step 4
sleep 2000
sql connect
sql select * from db.m1
print $rows points data are retrieved
if $rows != 10 then
return -1
endi
system sh/exec.sh -n dnode2 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode1 -c walLevel -v 2
system sh/cfg.sh -n dnode2 -c walLevel -v 2
system sh/cfg.sh -n dnode3 -c walLevel -v 2
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode1 -c role -v 2
system sh/cfg.sh -n dnode2 -c role -v 2
system sh/cfg.sh -n dnode3 -c role -v 2
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
print ============== step1: start dnode1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
sql create dnode $hostname2
sql create dnode $hostname3
sleep 2000
# create table
sql drop database -x step1
step1:
sql create database db
sql use db
sql create table m1 (ts timestamp, speed int)
# insert data
$x = 0
while $x < 10
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into m1 values ($ms , $x )
$x = $x + 1
endw
sql select * from m1
print $rows points data are retrieved
if $rows != 10 then
return -1
endi
print ============== step3: stop cluster , then move_dnode1 ,start cluster
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 dnode3 -s stop -x SIGINT
system sh/move_dnode.sh dnode1 dnode4
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
print =============== step 4
sleep 2000
sql connect
sql select * from db.m1
print $rows points data are retrieved
if $rows != 10 then
return -1
endi
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 dnode4 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode1 -c walLevel -v 2
system sh/cfg.sh -n dnode2 -c walLevel -v 2
system sh/cfg.sh -n dnode3 -c walLevel -v 2
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode1 -c role -v 2
system sh/cfg.sh -n dnode2 -c role -v 2
system sh/cfg.sh -n dnode3 -c role -v 2
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
print ============== step1: start dnode1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
sql create dnode $hostname2
sql create dnode $hostname3
sleep 2000
# create table
sql drop database -x step1
step1:
sql create database db replica 2
sql use db
sql create table m1 (ts timestamp, speed int)
# insert data
$x = 0
while $x < 10
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into m1 values ($ms , $x )
$x = $x + 1
endw
sql select * from m1
print $rows points data are retrieved
if $rows != 10 then
return -1
endi
print ============== step3: stop cluster , then move_dnode1 ,start cluster
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 dnode3 -s stop -x SIGINT
system sh/move_dnode.sh dnode1 dnode4
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
print =============== step 4
sleep 2000
sql connect
sql select * from db.m1
print $rows points data are retrieved
if $rows != 10 then
return -1
endi
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 dnode4 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/deploy.sh -n dnode5 -i 5
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
system sh/cfg.sh -n dnode5 -c balanceInterval -v 10
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
sql create dnode $hostname3
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
$x = 0
step1:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 $data4_1
print dnode2 $data4_2
print dnode3 $data4_3
if $data4_1 != ready then
goto step1
endi
if $data4_2 != ready then
goto step1
endi
if $data4_3 != ready then
goto step1
endi
print ========== step2
sql create database d1 replica 2
sql create table d1.t1 (t timestamp, i int)
print ========== step2.1
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
return -1
endi
if $data2_2 != 1 then
return -1
endi
if $data2_3 != 1 then
return -1
endi
print ========== step3
sql create dnode $hostname4
system sh/exec.sh -n dnode4 -s start
$x = 0
show3:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_2 != 1 then
goto show3
endi
if $data2_3 != 1 then
goto show3
endi
if $data2_4 != 0 then
goto show3
endi
sql show d1.vgroups;
print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ========== step4
sql drop dnode $hostname3
$i = 0
$rowNum = 10000
while $i < $rowNum
$ts = 1500000000000 + $i
sql insert into d1.t1 values( $ts , $i )
$i = $i + 1
endw
print insert $rowNum finished
$x = 0
show4:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
print dnode5 openVnodes $data2_5
if $data2_2 != 1 then
goto show4
endi
if $data2_3 != null then
goto show4
endi
if $data2_4 != 1 then
goto show4
endi
system sh/exec.sh -n dnode3 -s stop -x SIGINT
print ========== step5
sql select count(*) from d1.t1
print select count(*) from d1.t1 ==> $data00
if $data00 != $rowNum then
return -1
endi
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 dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode5 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start
sleep 2000
sql create database d1 replica 2
sql create table d1.t1 (t timestamp, i int)
sql insert into d1.t1 values(now+1s, 15)
sql insert into d1.t1 values(now+2s, 14)
sql insert into d1.t1 values(now+3s, 13)
sql insert into d1.t1 values(now+4s, 12)
sql insert into d1.t1 values(now+5s, 11)
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
return -1
endi
if $data2_2 != 1 then
return -1
endi
if $data2_3 != 1 then
return -1
endi
if $data2_4 != null then
return -1
endi
print ========== step2
sql create dnode $hostname4
system sh/exec.sh -n dnode4 -s start
sleep 2000
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
return -1
endi
if $data2_2 != 1 then
return -1
endi
if $data2_3 != 1 then
return -1
endi
if $data2_4 != 0 then
return -1
endi
print ========== step3
sql drop dnode $hostname2
$x = 0
show3:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
goto show3
endi
if $data2_2 != null then
goto show3
endi
if $data2_3 != 1 then
goto show3
endi
if $data2_4 != 1 then
goto show3
endi
print ========== step4
sql drop dnode $hostname3
$x = 0
show4:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 1 then
goto show4
endi
if $data2_2 != null then
goto show4
endi
if $data2_3 != null then
goto show4
endi
if $data2_4 != 1 then
goto show4
endi
print ========== step5
sql select * from d1.t1 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 11 then
return -1
endi
if $data11 != 12 then
return -1
endi
if $data21 != 13 then
return -1
endi
if $data31 != 14 then
return -1
endi
if $data41 != 15 then
return -1
endi
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 dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
run unique/dnode/balance1.sim
run unique/dnode/balance2.sim
run unique/dnode/balance3.sim
run unique/dnode/balancex.sim
run unique/dnode/offline1.sim
run unique/dnode/offline2.sim
run unique/dnode/remove1.sim
run unique/dnode/remove2.sim
run unique/dnode/vnode_clean.sim
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
print ======== step1
sql create database d2
sql use d2
sql create table mt (ts timestamp, a int) TAGS (t int)
sql create table tb using mt tags (1)
sql insert into tb values(now-28d, -28)
sql insert into tb values(now-27d, -27)
sql insert into tb values(now-26d, -26)
sql select * from tb
if $rows != 3 then
return -1
endi
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != t then
return -1
endi
if $data21 != INT then
return -1
endi
print ======== step2
sql alter table mt add column b smallint
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != t then
return -1
endi
if $data31 != INT then
return -1
endi
print ======== step3
sql alter table mt add column c tinyint
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != t then
return -1
endi
if $data41 != INT then
return -1
endi
print ======== step4
sql alter table mt add column d int
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != t then
return -1
endi
if $data51 != INT then
return -1
endi
print ======== step5
sql alter table mt add column e bigint
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != t then
return -1
endi
if $data61 != INT then
return -1
endi
print ======== step6
sql alter table mt add column f float
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != t then
return -1
endi
if $data71 != INT then
return -1
endi
print ======== step7
sql alter table mt add column g double
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != g then
return -1
endi
if $data71 != DOUBLE then
return -1
endi
if $data80 != t then
return -1
endi
if $data81 != INT then
return -1
endi
print ======== step8
sql alter table mt add column h binary(10)
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != g then
return -1
endi
if $data71 != DOUBLE then
return -1
endi
if $data80 != h then
return -1
endi
if $data81 != BINARY then
return -1
endi
if $data82 != 10 then
return -1
endi
if $data90 != t then
return -1
endi
if $data91 != INT then
return -1
endi
print ======== step9
print ======== step10
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 3000
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql use d2
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != g then
return -1
endi
if $data71 != DOUBLE then
return -1
endi
if $data80 != h then
return -1
endi
if $data81 != BINARY then
return -1
endi
if $data82 != 10 then
return -1
endi
if $data90 != t then
return -1
endi
if $data91 != INT then
return -1
endi
print ======== step11
#sql alter table mt drop column a -x step111
# return -1
#step111:
#sql alter table mt drop column ts -x step112
# return -1
#step112:
#sql alter table mt drop column cdfg -x step113
# return -1
#step113:
#sql alter table mt add column a -x step114
# return -1
#step114:
#sql alter table mt add column b -x step115
# return -1
#step115:
print ======== step12
sql alter table mt drop column b
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != c then
return -1
endi
if $data21 != TINYINT then
return -1
endi
if $data30 != d then
return -1
endi
if $data31 != INT then
return -1
endi
if $data40 != e then
return -1
endi
if $data41 != BIGINT then
return -1
endi
if $data50 != f then
return -1
endi
if $data51 != FLOAT then
return -1
endi
if $data60 != g then
return -1
endi
if $data61 != DOUBLE then
return -1
endi
if $data70 != h then
return -1
endi
if $data71 != BINARY then
return -1
endi
if $data72 != 10 then
return -1
endi
if $data80 != t then
return -1
endi
if $data81 != INT then
return -1
endi
print ======== step13
sql alter table mt drop column c
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != d then
return -1
endi
if $data21 != INT then
return -1
endi
if $data30 != e then
return -1
endi
if $data31 != BIGINT then
return -1
endi
if $data40 != f then
return -1
endi
if $data41 != FLOAT then
return -1
endi
if $data50 != g then
return -1
endi
if $data51 != DOUBLE then
return -1
endi
if $data60 != h then
return -1
endi
if $data61 != BINARY then
return -1
endi
if $data62 != 10 then
return -1
endi
if $data70 != t then
return -1
endi
if $data71 != INT then
return -1
endi
print ======== step14
sql alter table mt drop column d
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != e then
return -1
endi
if $data21 != BIGINT then
return -1
endi
if $data30 != f then
return -1
endi
if $data31 != FLOAT then
return -1
endi
if $data40 != g then
return -1
endi
if $data41 != DOUBLE then
return -1
endi
if $data50 != h then
return -1
endi
if $data51 != BINARY then
return -1
endi
if $data52 != 10 then
return -1
endi
if $data60 != t then
return -1
endi
if $data61 != INT then
return -1
endi
print ======== step15
sql alter table mt drop column e
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != f then
return -1
endi
if $data21 != FLOAT then
return -1
endi
if $data30 != g then
return -1
endi
if $data31 != DOUBLE then
return -1
endi
if $data40 != h then
return -1
endi
if $data41 != BINARY then
return -1
endi
if $data42 != 10 then
return -1
endi
if $data50 != t then
return -1
endi
if $data51 != INT then
return -1
endi
print ======== step16
sql alter table mt drop column f
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != g then
return -1
endi
if $data21 != DOUBLE then
return -1
endi
if $data30 != h then
return -1
endi
if $data31 != BINARY then
return -1
endi
if $data32 != 10 then
return -1
endi
if $data40 != t then
return -1
endi
if $data41 != INT then
return -1
endi
print ======== step17
sql alter table mt drop column g
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != h then
return -1
endi
if $data21 != BINARY then
return -1
endi
if $data22 != 10 then
return -1
endi
if $data30 != t then
return -1
endi
if $data31 != INT then
return -1
endi
print ============= step18
sql alter table mt drop column h
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != t then
return -1
endi
if $data21 != INT then
return -1
endi
if $data30 != null then
return -1
endi
print ======= over
sql drop database d2
sql show databases
if $rows != 0 then
return -1
endi
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
print ======== step1
sql create database d1
sql use d1
sql create table tb (ts timestamp, a int)
sql insert into tb values(now-28d, -28)
sql insert into tb values(now-27d, -27)
sql insert into tb values(now-26d, -26)
sql select * from tb
if $rows != 3 then
return -1
endi
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
print ======== step2
sql alter table tb add column b smallint
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
print ======== step3
sql alter table tb add column c tinyint
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
print ======== step4
sql alter table tb add column d int
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
print ======== step5
sql alter table tb add column e bigint
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
print ======== step6
sql alter table tb add column f float
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
print ======== step7
sql alter table tb add column g double
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != g then
return -1
endi
if $data71 != DOUBLE then
return -1
endi
print ======== step8
sql alter table tb add column h binary(10)
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != g then
return -1
endi
if $data71 != DOUBLE then
return -1
endi
if $data80 != h then
return -1
endi
if $data81 != BINARY then
return -1
endi
if $data82 != 10 then
return -1
endi
print ======== step9
print ======== step10
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 3000
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql use d1
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != b then
return -1
endi
if $data21 != SMALLINT then
return -1
endi
if $data30 != c then
return -1
endi
if $data31 != TINYINT then
return -1
endi
if $data40 != d then
return -1
endi
if $data41 != INT then
return -1
endi
if $data50 != e then
return -1
endi
if $data51 != BIGINT then
return -1
endi
if $data60 != f then
return -1
endi
if $data61 != FLOAT then
return -1
endi
if $data70 != g then
return -1
endi
if $data71 != DOUBLE then
return -1
endi
if $data80 != h then
return -1
endi
if $data81 != BINARY then
return -1
endi
if $data82 != 10 then
return -1
endi
print ======== step11
sql alter table drop column a -x step111
return -1
step111:
sql alter table drop column ts -x step112
return -1
step112:
sql alter table drop column cdfg -x step113
return -1
step113:
sql alter table add column a -x step114
return -1
step114:
sql alter table add column b -x step115
return -1
step115:
print ======== step12
sql alter table tb drop column b
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != c then
return -1
endi
if $data21 != TINYINT then
return -1
endi
if $data30 != d then
return -1
endi
if $data31 != INT then
return -1
endi
if $data40 != e then
return -1
endi
if $data41 != BIGINT then
return -1
endi
if $data50 != f then
return -1
endi
if $data51 != FLOAT then
return -1
endi
if $data60 != g then
return -1
endi
if $data61 != DOUBLE then
return -1
endi
if $data70 != h then
return -1
endi
if $data71 != BINARY then
return -1
endi
if $data72 != 10 then
return -1
endi
print ======== step13
sql alter table tb drop column c
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != d then
return -1
endi
if $data21 != INT then
return -1
endi
if $data30 != e then
return -1
endi
if $data31 != BIGINT then
return -1
endi
if $data40 != f then
return -1
endi
if $data41 != FLOAT then
return -1
endi
if $data50 != g then
return -1
endi
if $data51 != DOUBLE then
return -1
endi
if $data60 != h then
return -1
endi
if $data61 != BINARY then
return -1
endi
if $data62 != 10 then
return -1
endi
print ======== step14
sql alter table tb drop column d
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != e then
return -1
endi
if $data21 != BIGINT then
return -1
endi
if $data30 != f then
return -1
endi
if $data31 != FLOAT then
return -1
endi
if $data40 != g then
return -1
endi
if $data41 != DOUBLE then
return -1
endi
if $data50 != h then
return -1
endi
if $data51 != BINARY then
return -1
endi
if $data52 != 10 then
return -1
endi
print ======== step15
sql alter table tb drop column e
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != f then
return -1
endi
if $data21 != FLOAT then
return -1
endi
if $data30 != g then
return -1
endi
if $data31 != DOUBLE then
return -1
endi
if $data40 != h then
return -1
endi
if $data41 != BINARY then
return -1
endi
if $data42 != 10 then
return -1
endi
print ======== step16
sql alter table tb drop column f
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != g then
return -1
endi
if $data21 != DOUBLE then
return -1
endi
if $data30 != h then
return -1
endi
if $data31 != BINARY then
return -1
endi
if $data32 != 10 then
return -1
endi
print ======== step17
sql alter table tb drop column g
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != h then
return -1
endi
if $data21 != BINARY then
return -1
endi
if $data22 != 10 then
return -1
endi
print ============= step18
sql alter table tb drop column h
sql describe tb
if $data00 != ts then
return -1
endi
if $data01 != TIMESTAMP then
return -1
endi
if $data10 != a then
return -1
endi
if $data11 != INT then
return -1
endi
if $data20 != null then
return -1
endi
print ======= over
sql drop database d1
sql show databases
if $rows != 0 then
return -1
endi
sql connect
sleep 2000
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_av_db
$tbPrefix = m_av_tb
$mtPrefix = m_av_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select avg(tbcol) from $tb
print ===> $data00
if $data00 != 9.500000000 then
return -1
endi
print =============== step3
sql select avg(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 2.000000000 then
return -1
endi
print =============== step4
sql select avg(tbcol) as b from $tb
print ===> $data00
if $data00 != 9.500000000 then
return -1
endi
print =============== step5
sql select avg(tbcol) as b from $tb interval(1m)
print ===> $data01
if $data11 != 1.000000000 then
return -1
endi
sql select avg(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 9.500000000 then
return -1
endi
print =============== step6
sql select avg(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data01
if $data41 != 4.000000000 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select avg(tbcol) from $mt
print ===> $data00
if $data00 != 9.500000000 then
return -1
endi
print =============== step8
sql select avg(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 2.000000000 then
return -1
endi
sql select avg(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 9.500000000 then
return -1
endi
sql select avg(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 2.000000000 then
return -1
endi
print =============== step9
sql select avg(tbcol) as b from $mt interval(1m)
print ===> $data11
if $data11 != 1.000000000 then
return -1
endi
sql select avg(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 9.500000000 then
return -1
endi
print =============== step10
sql select avg(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != 9.500000000 then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select avg(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
print ===> $data11
if $data11 != 1.000000000 then
return -1
endi
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sql connect
sleep 2000
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_bo_db
$tbPrefix = m_bo_tb
$mtPrefix = m_bo_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select bottom(tbcol, 1) from $tb
print ===> $data01
if $data01 != 0 then
return -1
endi
print =============== step3
sql select bottom(tbcol, 1) from $tb where ts > now + 4m
print ===> $data01
if $data01 != 5 then
return -1
endi
print =============== step4
sql select bottom(tbcol, 1) as b from $tb
print ===> $data01
if $data01 != 0 then
return -1
endi
print =============== step5
sql select bottom(tbcol, 2) as b from $tb
print ===> $data01 $data11
if $data01 != 0 then
return -1
endi
if $data11 != 1 then
return -1
endi
print =============== step6
sql select bottom(tbcol, 2) as b from $tb where ts > now + 4m
print ===> $data01 $data11
if $data01 != 5 then
return -1
endi
if $data11 != 6 then
return -1
endi
sql select bottom(tbcol, 122) as b from $tb -x step6
return -1
step6:
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sql connect
sleep 2000
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_co_db
$tbPrefix = m_co_tb
$mtPrefix = m_co_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select count(*) from $tb
print ===> select count(*) from $tb => $data00
if $data00 != $rowNum then
return -1
endi
sql select count(tbcol) from $tb
print ===> $data00
if $data00 != $rowNum then
return -1
endi
print =============== step3
sql select count(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 5 then
return -1
endi
print =============== step4
sql select count(tbcol) as b from $tb
print ===> $data00
if $data00 != $rowNum then
return -1
endi
print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
print ===> $data01
if $data01 != 1 then
return -1
endi
sql select count(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != $rowNum then
return -1
endi
print =============== step6
sql select count(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data01
if $data01 != 1 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select count(*) from $mt
print ===> $data00
if $data00 != $totalNum then
return -1
endi
sql select count(tbcol) from $mt
print ===> $data00
if $data00 != $totalNum then
return -1
endi
print =============== step8
sql select count(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 50 then
return -1
endi
sql select count(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 100 then
return -1
endi
sql select count(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 25 then
return -1
endi
print =============== step9
sql select count(tbcol) as b from $mt interval(1m)
print ===> $data01
if $data01 != 10 then
return -1
endi
if $data11 != 10 then
return -1
endi
sql select count(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 200 then
return -1
endi
print =============== step10
sql select count(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != $rowNum then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select count(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
print ===> $data01
if $data01 != 1 then
return -1
endi
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_di_db
$tbPrefix = m_di_tb
$mtPrefix = m_di_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select diff(tbcol) from $tb
print ===> $data11
if $data11 != 1 then
return -1
endi
print =============== step3
sql select diff(tbcol) from $tb where ts > now + 4m
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select diff(tbcol) from $tb where ts < now + 4m
print ===> $data11
if $data11 != 1 then
return -1
endi
print =============== step4
sql select diff(tbcol) as b from $tb
print ===> $data11
if $data11 != 1 then
return -1
endi
print =============== step5
sql select diff(tbcol) as b from $tb interval(1m) -x step5
return -1
step5:
print =============== step6
sql select diff(tbcol) as b from $tb where ts < now + 4m interval(1m) -x step6
return -1
step6:
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_fi_db
$tbPrefix = m_fi_tb
$mtPrefix = m_fi_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select first(tbcol) from $tb
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step3
sql select first(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step4
sql select first(tbcol) as b from $tb
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step5
sql select first(tbcol) as b from $tb interval(1m)
print ===> $data01
if $data01 != 0 then
return -1
endi
sql select first(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 0 then
return -1
endi
print =============== step6
sql select first(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data01
if $data41 != 4 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select first(tbcol) from $mt
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step8
sql select first(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 0 then
return -1
endi
sql select first(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 0 then
return -1
endi
sql select first(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step9
sql select first(tbcol) as b from $mt interval(1m)
print select first(tbcol) as b from $mt interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select first(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 0 then
return -1
endi
print =============== step10
sql select first(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != 0 then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select first(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
endi
print ===> $rows
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_in_db
$tbPrefix = m_in_tb
$mtPrefix = m_in_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m)
print ===> $rows
if $rows < $rowNum then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data05 != 1 then
return -1
endi
print =============== step3
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now + 4m interval(1m)
print ===> $rows
if $rows > 10 then
return -1
endi
if $rows < 3 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data05 != 1 then
return -1
endi
print =============== step4
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now-1m interval(1m)
print ===> $rows
if $rows < 18 then
return -1
endi
if $rows > 22 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data05 != 1 then
return -1
endi
print =============== step5
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now+1m interval(1m) fill(value,0)
print ===> $rows
if $rows < 30 then
return -1
endi
if $rows > 50 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data25 != 1 then
return -1
endi
print =============== step6
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m)
print ===> $rows
if $rows < 18 then
return -1
endi
if $rows > 22 then
return -1
endi
if $data11 > 15 then
return -1
endi
if $data11 < 5 then
return -1
endi
print =============== step7
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now + 4m interval(1m)
print ===> $rows
if $rows < 3 then
return -1
endi
if $rows > 7 then
return -1
endi
if $data11 > 15 then
return -1
endi
if $data11 < 5 then
return -1
endi
print =============== step8
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now-1m interval(1m)
print ===> $rows
if $rows < 18 then
return -1
endi
if $rows > 22 then
return -1
endi
if $data11 > 15 then
return -1
endi
if $data11 < 5 then
return -1
endi
print =============== step9
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now+1m interval(1m) fill(value, 0)
if $rows < 30 then
return -1
endi
if $rows > 50 then
return -1
endi
if $data11 > 15 then
return -1
endi
if $data11 < 5 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_la_db
$tbPrefix = m_la_tb
$mtPrefix = m_la_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select last(tbcol) from $tb
print ===> $data00
if $data00 != 19 then
return -1
endi
print =============== step3
sql select last(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 4 then
return -1
endi
print =============== step4
sql select last(tbcol) as b from $tb
print ===> $data00
if $data00 != 19 then
return -1
endi
print =============== step5
sql select last(tbcol) as b from $tb interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select last(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 19 then
return -1
endi
print =============== step6
sql select last(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select last(tbcol) from $mt
print ===> $data00
if $data00 != 19 then
return -1
endi
print =============== step8
sql select last(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 4 then
return -1
endi
sql select last(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 19 then
return -1
endi
sql select last(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 4 then
return -1
endi
print =============== step9
sql select last(tbcol) as b from $mt interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select last(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 19 then
return -1
endi
print =============== step10
sql select last(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != 19 then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select last(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
endi
print ===> $rows
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_le_db
$tbPrefix = m_le_tb
$mtPrefix = m_le_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db keep 36500
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 2
$ms = 1000
while $x < $rowNum
$ms = $ms + 1000
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select leastsquares(tbcol, 1, 1) from $tb
print ===> $data00
if $data00 != @{slop:1.000000, intercept:1.000000}@ then
return -1
endi
print =============== step3
sql select leastsquares(tbcol, 1, 1) from $tb where ts < now + 4m
print ===> $data00
if $data00 != @{slop:1.000000, intercept:1.000000}@ then
return -1
endi
print =============== step4
sql select leastsquares(tbcol, 1, 1) as b from $tb
print ===> $data00
if $data00 != @{slop:1.000000, intercept:1.000000}@ then
return -1
endi
print =============== step5
print select leastsquares(tbcol, 1, 1) as b from $tb interval(1d)
sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m)
print ===> $data01
if $data01 != @{slop:1.000000, intercept:1.000000}@ then
return -1
endi
print select leastsquares(tbcol, 1, 1) as b from $tb interval(1d)
sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1d)
print ===> $data01
if $data01 != @{slop:1.000000, intercept:1.000000}@ then
return -1
endi
print =============== step6
sql select leastsquares(tbcol, 1, 1) as b from $tb where ts < now + 4m interval(1m)
print ===> $data01
if $data01 != @{slop:1.000000, intercept:1.000000}@ then
return -1
endi
print ===> $rows
if $rows != 1 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_ma_db
$tbPrefix = m_ma_tb
$mtPrefix = m_ma_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select max(tbcol) from $tb
print ===> $data00
if $data00 != 19 then
return -1
endi
print =============== step3
sql select max(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 4 then
return -1
endi
print =============== step4
sql select max(tbcol) as b from $tb
print ===> $data00
if $data00 != 19 then
return -1
endi
print =============== step5
sql select max(tbcol) as b from $tb interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select max(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 19 then
return -1
endi
print =============== step6
sql select max(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select max(tbcol) from $mt
print ===> $data00
if $data00 != 19 then
return -1
endi
print =============== step8
sql select max(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 4 then
return -1
endi
sql select max(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 19 then
return -1
endi
sql select max(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 4 then
return -1
endi
print =============== step9
sql select max(tbcol) as b from $mt interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select max(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 19 then
return -1
endi
print =============== step10
sql select max(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != 19 then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select max(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
endi
print ===> $rows
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_mi_db
$tbPrefix = m_mi_tb
$mtPrefix = m_mi_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select min(tbcol) from $tb
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step3
sql select min(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step4
sql select min(tbcol) as b from $tb
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step5
sql select min(tbcol) as b from $tb interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select min(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 0 then
return -1
endi
print =============== step6
sql select min(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select min(tbcol) from $mt
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step8
sql select min(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 0 then
return -1
endi
sql select min(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 0 then
return -1
endi
sql select min(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 0 then
return -1
endi
print =============== step9
sql select min(tbcol) as b from $mt interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select min(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 0 then
return -1
endi
print =============== step10
sql select min(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != 0 then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select min(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol
print ===> $data11
if $data11 != 1 then
return -1
endi
print ===> $rows
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_pe_db
$tbPrefix = m_pe_tb
$mtPrefix = m_pe_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select percentile(tbcol, 10) from $tb
print ===> $data00
if $data00 != 1.900000000 then
return -1
endi
sql select percentile(tbcol, 20) from $tb
print ===> $data00
if $data00 != 3.800000000 then
return -1
endi
sql select percentile(tbcol, 100) from $tb
print ===> $data00
if $data00 != 19.000000000 then
return -1
endi
sql select percentile(tbcol, 110) from $tb -x step2
return -1
step2:
print =============== step3
sql select percentile(tbcol, 1) from $tb where ts > now + 4m
print ===> $data00
if $data00 != 5.140000000 then
return -1
endi
sql select percentile(tbcol, 5) from $tb where ts > now + 4m
print ===> $data00
if $data00 != 5.700000000 then
return -1
endi
sql select percentile(tbcol, 0) from $tb where ts > now + 4m
print ===> $data00
if $data00 != 5.000000000 then
return -1
endi
print =============== step4
sql select percentile(tbcol, 1) as c from $tb where ts > now + 4m
print ===> $data00
if $data00 != 5.140000000 then
return -1
endi
sql select percentile(tbcol, 5) as c from $tb where ts > now + 4m
print ===> $data00
if $data00 != 5.700000000 then
return -1
endi
sql select percentile(tbcol, 0) as c from $tb where ts > now + 4m
print ===> $data00
if $data00 != 5.000000000 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_st_db
$tbPrefix = m_st_tb
$mtPrefix = m_st_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select stddev(tbcol) from $tb
print ===> $data00
if $data00 != 5.766281297 then
return -1
endi
print =============== step3
sql select stddev(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 1.414213562 then
return -1
endi
print =============== step4
sql select stddev(tbcol) as b from $tb
print ===> $data00
if $data00 != 5.766281297 then
return -1
endi
print =============== step5
sql select stddev(tbcol) as b from $tb interval(1m)
print ===> $data01
if $data01 != 0.000000000 then
return -1
endi
sql select stddev(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 5.766281297 then
return -1
endi
print =============== step6
sql select stddev(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data01
if $data01 != 0.000000000 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_su_db
$tbPrefix = m_su_tb
$mtPrefix = m_su_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select sum(tbcol) from $tb
print ===> $data00
if $data00 != 190 then
return -1
endi
print =============== step3
sql select sum(tbcol) from $tb where ts < now + 4m
print ===> $data00
if $data00 != 10 then
return -1
endi
print =============== step4
sql select sum(tbcol) as b from $tb
print ===> $data00
if $data00 != 190 then
return -1
endi
print =============== step5
sql select sum(tbcol) as b from $tb interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
sql select sum(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != 190 then
return -1
endi
print =============== step6
sql select sum(tbcol) as b from $tb where ts < now + 4m interval(1m)
print ===> $data11
if $data11 != 1 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
sql select sum(tbcol) from $mt
print ===> $data00
if $data00 != 1900 then
return -1
endi
print =============== step8
sql select sum(tbcol) as c from $mt where ts < now + 4m
print ===> $data00
if $data00 != 100 then
return -1
endi
sql select sum(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 950 then
return -1
endi
sql select sum(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m
print ===> $data00
if $data00 != 50 then
return -1
endi
print =============== step9
sql select sum(tbcol) as b from $mt interval(1m)
print ===> $data11
if $data11 < 5 then
return -1
endi
sql select sum(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 1900 then
return -1
endi
print =============== step10
sql select sum(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != 190 then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol
print select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol
print ===> $data01
if $data01 != 10 then
return -1
endi
if $rows != 10 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = m_to_db
$tbPrefix = m_to_tb
$mtPrefix = m_to_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select top(tbcol, 1) from $tb
print ===> $data01
if $data01 != 19 then
return -1
endi
print =============== step3
sql select top(tbcol, 1) from $tb where ts < now + 4m
print ===> $data01
if $data01 != 4 then
return -1
endi
print =============== step4
sql select top(tbcol, 1) as b from $tb
print ===> $data01
if $data01 != 19 then
return -1
endi
print =============== step5
sql select top(tbcol, 2) as b from $tb
print ===> $data01 $data11
if $data01 != 18 then
return -1
endi
if $data11 != 19 then
return -1
endi
print =============== step6
sql select top(tbcol, 2) as b from $tb where ts < now + 4m
print ===> $data01 $data11
if $data01 != 3 then
return -1
endi
if $data11 != 4 then
return -1
endi
sql select top(tbcol, 122) as b from $tb -x step6
return -1
step6:
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
print ============================ dnode1 start
$i = 0
$dbPrefix = ob_db_db
$tbPrefix = ob_db_tb
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
print =============== step1
sql create database $db replica 1 duration 20 keep 2000 cache 16
sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data03 != 0 then
return -1
endi
if $data04 != 1 then
return -1
endi
if $data06 != 20 then
return -1
endi
if $data08 != 16 then
return -1
endi
print =============== step2
sql create database $db
sql show databases
if $rows != 1 then
return -1
endi
print =============== step3
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
print =============== step4
sql_error drop database $db
print =============== step5
sql create database $db replica 1 duration 15 keep 1500
sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data03 != 0 then
return -1
endi
if $data04 != 1 then
return -1
endi
if $data06 != 15 then
return -1
endi
print =============== step6
sql use $db
sql create table $tb (ts timestamp, speed int)
$i = 1
while $i < 4
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
sql create database $db
sql use $db
sql create table $tb (ts timestamp, speed int)
$i = $i + 1
endw
sql show databases
if $rows != 4 then
return -1
endi
$i = 4
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
sql create database $db
sql use $db
sql create table $tb (ts timestamp, speed int)
print =============== step7
$i = 0
while $i < 5
$db = $dbPrefix . $i
sql drop database $db
$i = $i + 1
endw
print =============== step8
$i = 0
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
sql create database $db
sql use $db
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then
return -1
endi
print =============== step9
sql drop database $db
print =============== step10
sql create database $db
sql use $db
sql show tables
if $rows != 0 then
return -1
endi
print =============== step11
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then
return -1
endi
print =============== step12
sql drop database $db
print =============== step13
sql create database $db
sql use $db
sql show tables
if $rows != 0 then
return -1
endi
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then
return -1
endi
sql insert into $tb values (now+1a, 0)
sql insert into $tb values (now+2a, 1)
sql insert into $tb values (now+3a, 2)
sql insert into $tb values (now+4a, 3)
sql insert into $tb values (now+5a, 4)
sql select * from $tb
if $rows != 5 then
return -1
endi
print =============== step14
sql drop database $db
print =============== step15
sql create database $db
sql use $db
sql show tables
if $rows != 0 then
return -1
endi
print =============== step16
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then
return -1
endi
sql select * from $tb
if $rows != 0 then
return -1
endi
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sleep 2000
sql connect
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
print =============== step1
sql_error drop database dd
sql create database -x step1
return -1
step1:
sql show databases
if $rows != 0 then
return -1
endi
print =============== step2
sql create database a
sql show databases
if $rows != 1 then
return -1
endi
sql drop database a
sql show databases
if $rows != 0 then
return -1
endi
print =============== step3
sql create database a12345678
sql show databases
if $rows != 1 then
return -1
endi
sql drop database a12345678
sql show databases
if $rows != 0 then
return -1
endi
print =============== step4
sql create database a012345678901201234567890120123456789012a012345678901201234567890120123456789012 -x step4
return -1
step4:
sql show databases
if $rows != 0 then
return -1
endi
print =============== step5
sql create database a;1
sql drop database a
sql show databases
if $rows != 0 then
return -1
endi
print =============== step6
sql create database a'1 -x step6
return -1
step6:
sql show databases
if $rows != 0 then
return -1
endi
print =============== step7
sql create database (a) -x step7
return -1
step7:
sql show databases
if $rows != 0 then
return -1
endi
print =============== step8
sql create database a.1 -x step8
return -1
step8:
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
sql connect
sleep 2000
print ======================== dnode1 start
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = fi_bi_db
$tbPrefix = fi_bi_tb
$mtPrefix = fi_bi_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol bigint) TAGS(tgcol bigint)
$i = 0
while $i < 5
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( 0 )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , 0 )
$x = $x + 1
endw
$i = $i + 1
endw
while $i < 10
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( 1 )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , 1 )
$x = $x + 1
endw
$i = $i + 1
endw
print =============== step2
sql select * from $mt where tbcol = 0
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol <> 0
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol <> 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol <> 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol = 0
if $rows != 100 then
return -1
endi
sql select * from $mt where tbcol <> 0
if $rows != 100 then
return -1
endi
print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1
if $rows != 75 then
return -1
endi
sql select * from $mt where ts > now + 4m and tbcol <> 1
if $rows != 75 then
return -1
endi
sql select * from $mt where ts < now + 4m and tbcol = 0
if $rows != 25 then
return -1
endi
sql select * from $mt where ts < now + 4m and tbcol <> 0
if $rows != 25 then
return -1
endi
sql select * from $mt where ts <= now + 4m and tbcol = 0
if $rows != 25 then
return -1
endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0
if $rows != 25 then
return -1
endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0
if $rows != 5 then
return -1
endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m
if $rows != 5 then
return -1
endi
print =============== step4
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 200 then
return -1
endi
print =============== step5
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 100 then
return -1
endi
print =============== step6
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 100 then
return -1
endi
print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then
return -1
endi
print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data01 != 100 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
sql connect
sleep 2000
print ======================== dnode1 start
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:
$dbPrefix = fi_by_db
$tbPrefix = fi_by_tb
$mtPrefix = fi_by_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol binary(10)) TAGS(tgcol binary(10))
$i = 0
while $i < 5
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( '0' )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , '0' )
$x = $x + 1
endw
$i = $i + 1
endw
while $i < 10
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( '1' )
$x = 0
while $x < $rowNum
$ms = $x . m
sql insert into $tb values (now + $ms , '1' )
$x = $x + 1
endw
$i = $i + 1
endw
print =============== step2
sql select * from $mt where tbcol = '0'
if $rows != 100 then
return -1
endi
sql select * from $mt where ts > now + 4m and tbcol = '1'
if $rows != 75 then
return -1
endi
print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1'
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol
#can't filter binary fields
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册