未验证 提交 453a0e76 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #14334 from taosdata/fix/dnode

test: case for stable
......@@ -21,9 +21,6 @@
#./test.sh -f tsim/db/delete_part.sim
#./test.sh -f tsim/db/delete.sim
./test.sh -f tsim/db/error1.sim
#./test.sh -f tsim/db/replica_add13.sim
#./test.sh -f tsim/db/replica_part.sim
#./test.sh -f tsim/db/replica_reduce31.sim
./test.sh -f tsim/db/taosdlog.sim
# ---- dnode
......@@ -174,6 +171,12 @@
./test.sh -f tsim/vnode/replica3_vgroup.sim
#./test.sh -f tsim/vnode/replica3_many.sim
#./test.sh -f tsim/vnode/replica3_import.sim
#./test.sh -f tsim/vnode/stable_balance_replica1.sim
./test.sh -f tsim/vnode/stable_dnode2_stop.sim
./test.sh -f tsim/vnode/stable_dnode2.sim
#./test.sh -f tsim/vnode/stable_dnode3.sim
#./test.sh -f tsim/vnode/stable_replica3_dnode6.sim
#./test.sh -f tsim/vnode/stable_replica3_vnode3.sim
# --- sync
./test.sh -f tsim/sync/3Replica1VgElect.sim
......
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 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
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 dnode4 -c numOfMnodes -v 1
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 balanceInterval -v 1
system sh/cfg.sh -n dnode2 -c balanceInterval -v 1
system sh/cfg.sh -n dnode3 -c balanceInterval -v 1
system sh/cfg.sh -n dnode4 -c balanceInterval -v 1
print ========= start dnodes
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
sql create dnode $hostname4
system sh/exec.sh -n dnode4 -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
print dnode4 $data4_4
if $data4_1 != ready then
goto step1
endi
if $data4_2 != ready then
goto step1
endi
if $data4_3 != ready then
goto step1
endi
if $data4_4 != ready then
goto step1
endi
sql show mnodes
print mnode1 $data2_1
print mnode1 $data2_2
print mnode1 $data2_3
if $data2_1 != master then
goto step1
endi
print ======== step1
sql create database d1 replica 1
sql create database d2 replica 1
sql create database d3 replica 1
sql create database d4 replica 1
sql create table d1.t1 (ts timestamp, i int)
sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql insert into d1.t1 values(1589529000011, 1)
sql insert into d2.t2 values(1589529000021, 1)
sql insert into d3.t3 values(1589529000031, 1)
sql insert into d4.t4 values(1589529000041, 1)
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2
if $rows != 1 then
return -1
endi
sql select * from d3.t3
if $rows != 1 then
return -1
endi
sql select * from d4.t4
if $rows != 1 then
return -1
endi
print ======== step2
sql alter database d1 replica 3
sql alter database d2 replica 3
sql alter database d3 replica 3
sql alter database d4 replica 3
$x = 0
a1:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 3 then
goto a1
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 3 then
goto a1
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 3 then
goto a1
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 3 then
goto a1
endi
print ======== step3
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 != 4 then
return -1
endi
if $data2_3 != 4 then
return -1
endi
if $data2_3 != 4 then
return -1
endi
print ======== step4
sql insert into d1.t1 values(1589529000012, 2)
sql insert into d2.t2 values(1589529000022, 2)
sql insert into d3.t3 values(1589529000032, 2)
sql insert into d4.t4 values(1589529000042, 2)
sql select * from d1.t1
if $rows != 2 then
return -1
endi
sql select * from d2.t2
if $rows != 2 then
return -1
endi
sql select * from d3.t3
if $rows != 2 then
return -1
endi
sql select * from d4.t4
if $rows != 2 then
return -1
endi
print ========= step5
sql reset query cache
sleep 100
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sql insert into d1.t1 values(1589529000013, 3)
sql insert into d2.t2 values(1589529000023, 3)
sql insert into d3.t3 values(1589529000033, 3)
sql insert into d4.t4 values(1589529000043, 3)
sql select * from d1.t1
if $rows != 3 then
return -1
endi
sql select * from d2.t2
if $rows != 3 then
return -1
endi
sql select * from d3.t3
if $rows != 3 then
return -1
endi
sql select * from d4.t4
if $rows != 3 then
return -1
endi
print ========= step6
system sh/exec.sh -n dnode2 -s start
$x = 0
step6:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step6
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step6
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step6
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step6
endi
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sql insert into d1.t1 values(1589529000014, 4)
sql insert into d2.t2 values(1589529000024, 4)
sql insert into d3.t3 values(1589529000034, 4)
sql insert into d4.t4 values(1589529000044, 4)
sql select * from d1.t1
print select * from d1.t1 $rows
if $rows != 4 then
return -1
endi
sql select * from d2.t2
print select * from d2.t2 $rows
if $rows != 4 then
return -1
endi
sql select * from d3.t3
print select * from d3.t3 $rows
if $rows != 4 then
return -1
endi
sql select * from d4.t4
print select * from d4.t4 $rows
if $rows != 4 then
return -1
endi
print ========= step7
system sh/exec.sh -n dnode3 -s start
$x = 0
step7:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step7
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step7
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step7
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step7
endi
system sh/exec.sh -n dnode4 -s stop -x SIGINT
sql insert into d1.t1 values(1589529000015, 5)
sql insert into d2.t2 values(1589529000025, 5)
sql insert into d3.t3 values(1589529000035, 5)
sql insert into d4.t4 values(1589529000045, 5)
sql select * from d1.t1
if $rows != 5 then
return -1
endi
sql select * from d2.t2
if $rows != 5 then
return -1
endi
sql select * from d3.t3
if $rows != 5 then
return -1
endi
sql select * from d4.t4
if $rows != 5 then
return -1
endi
print ========= step8
system sh/exec.sh -n dnode4 -s start
$x = 0
step8:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step8
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step8
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step8
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 3 then
goto step8
endi
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sql insert into d1.t1 values(1589529000016, 6)
sql insert into d2.t2 values(1589529000026, 6)
sql insert into d3.t3 values(1589529000036, 6)
sql insert into d4.t4 values(1589529000046, 6)
sql select * from d1.t1
if $rows != 6 then
return -1
endi
sql select * from d2.t2
if $rows != 6 then
return -1
endi
sql select * from d3.t3
if $rows != 6 then
return -1
endi
sql select * from d4.t4
if $rows != 6 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
\ 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 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 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 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 dnode1 -c balanceInterval -v 1
system sh/cfg.sh -n dnode2 -c balanceInterval -v 1
system sh/cfg.sh -n dnode3 -c balanceInterval -v 1
print ========= start dnodes
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
$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
print dnode4 $data4_4
if $data4_1 != ready then
goto step1
endi
if $data4_2 != ready then
goto step1
endi
if $data4_3 != ready then
goto step1
endi
sql show mnodes
print mnode1 $data2_1
print mnode1 $data2_2
print mnode1 $data2_3
if $data2_1 != master then
goto step1
endi
print ======== step1
sql create database d1 replica 3
sql create database d2 replica 3
sql create database d3 replica 3
sql create database d4 replica 3
sql create table d1.t1 (ts timestamp, i int)
sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql insert into d2.t2 values(now, 1)
sql insert into d1.t1 values(now, 1)
sql insert into d3.t3 values(now, 1)
sql insert into d4.t4 values(now, 1)
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2
if $rows != 1 then
return -1
endi
sql select * from d3.t3
if $rows != 1 then
return -1
endi
sql select * from d4.t4
if $rows != 1 then
return -1
endi
print ========= step2 alter db
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sql alter database d4 replica 2
$x = 0
a1:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a1
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a1
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a1
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a1
endi
system sh/exec.sh -n dnode2 -s stop -x SIGINT
print ========= step3
system sh/exec.sh -n dnode2 -s start
$x = 0
step3:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step3
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step3
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step3
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step3
endi
print ========= step4
sql insert into d1.t1 values(now, 2)
sql insert into d2.t2 values(now, 2)
sql insert into d3.t3 values(now, 2)
sql insert into d4.t4 values(now, 2)
sql select * from d1.t1
if $rows != 2 then
return -1
endi
sql select * from d2.t2
if $rows != 2 then
return -1
endi
sql select * from d3.t3
if $rows != 2 then
return -1
endi
sql select * from d4.t4
if $rows != 2 then
return -1
endi
print ========= step5
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sql reset query cache
sleep 100
sql insert into d1.t1 values(now, 3) -x s1
s1:
#sql insert into d2.t2 values(now, 3) -x s2
#s2:
#sql insert into d3.t3 values(now, 3) -x s3
#s3:
#sql insert into d4.t4 values(now, 3) -x s4
#s4:
print ========= step6
system sh/exec.sh -n dnode2 -s start
$x = 0
step6:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step6
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step6
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step6
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step6
endi
system sh/exec.sh -n dnode3 -s stop -x SIGINT
#sql insert into d1.t1 values(now, 4) -x s5
#s5:
sql insert into d2.t2 values(now, 4) -x s6
s6:
#sql insert into d3.t3 values(now, 4) -x s7
#s7:
#sql insert into d4.t4 values(now, 4) -x s8
#s8:
print ========= step7
system sh/exec.sh -n dnode3 -s start
$x = 0
step7:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step7
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step7
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step7
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step7
endi
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d3.t3 values(now, 5)
sql insert into d4.t4 values(now, 5)
sql select * from d1.t1
sql select * from d2.t2
sql select * from d3.t3
sql select * from d4.t4
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
\ 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 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 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 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 dnode1 -c balanceInterval -v 1
system sh/cfg.sh -n dnode2 -c balanceInterval -v 1
system sh/cfg.sh -n dnode3 -c balanceInterval -v 1
system sh/cfg.sh -n dnode4 -c balanceInterval -v 1
print ========= start dnodes
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
$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
print dnode4 $data4_4
if $data4_1 != ready then
goto step1
endi
if $data4_2 != ready then
goto step1
endi
if $data4_3 != ready then
goto step1
endi
sql show mnodes
print mnode1 $data2_1
print mnode1 $data2_2
print mnode1 $data2_3
if $data2_1 != master then
goto step1
endi
print ======== step1
sql create database d1 replica 3
sql create database d2 replica 3
sql create database d3 replica 3
sql create database d4 replica 3
sql create table d1.t1 (ts timestamp, i int)
sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql insert into d1.t1 values(now, 1)
sql insert into d2.t2 values(now, 1)
sql insert into d3.t3 values(now, 1)
sql insert into d4.t4 values(now, 1)
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2
if $rows != 1 then
return -1
endi
sql select * from d3.t3
if $rows != 1 then
return -1
endi
sql select * from d4.t4
if $rows != 1 then
return -1
endi
print ========= step2 alter db
sql_error alter database d1 replica 1
sql_error alter database d2 replica 1
sql_error alter database d3 replica 1
sql_error alter database d4 replica 1
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sql alter database d4 replica 2
$x = 0
a2:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a2
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a2
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a2
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 2 then
goto a2
endi
sql alter database d1 replica 1
sql alter database d2 replica 1
sql alter database d3 replica 1
sql alter database d4 replica 1
$x = 0
a1:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 1 then
goto a1
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 1 then
goto a1
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 1 then
goto a1
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 1 then
goto a1
endi
sql show dnodes
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
print $data20 $data21 $data22 $data23
if $data02 != 0 then
goto a1
endi
if $data12 != 2 then
goto a1
endi
if $data22 != 2 then
goto a1
endi
print ========= step3
sql reset query cache
sleep 100
sql insert into d1.t1 values(now, 2)
sql insert into d2.t2 values(now, 2)
sql insert into d3.t3 values(now, 2)
sql insert into d4.t4 values(now, 2)
sql select * from d1.t1
if $rows != 2 then
return -1
endi
sql select * from d2.t2
if $rows != 2 then
return -1
endi
sql select * from d3.t3
if $rows != 2 then
return -1
endi
sql select * from d4.t4
if $rows != 2 then
return -1
endi
print ========= step4 alter db
sql alter database d1 replica 2
sql alter database d2 replica 2
sql alter database d3 replica 2
sql alter database d4 replica 2
$x = 0
step4:
$x = $x + 1
sleep 1000
if $x == 40 then
return -1
endi
sql show d1.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step4
endi
sql show d2.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step4
endi
sql show d3.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step4
endi
sql show d4.vgroups
print online vnodes $data03
if $data03 != 2 then
goto step4
endi
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d3.t3 values(now, 3)
sql insert into d4.t4 values(now, 3)
sql select * from d1.t1
if $rows != 3 then
return -1
endi
sql select * from d2.t2
if $rows != 3 then
return -1
endi
sql select * from d3.t3
if $rows != 3 then
return -1
endi
sql select * from d4.t4
if $rows != 3 then
return -1
endi
print ========= step4
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sql reset query cache
sleep 100
#sql insert into d1.t1 values(now, 4) -x step1
#step1:
#sql insert into d2.t2 values(now, 4) -x step2
#step2:
#sql insert into d3.t3 values(now, 4) -x step3
#step3:
#sql insert into d4.t4 values(now, 4) -x step4
#step4:
print ========= step5
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s stop -x SIGINT
#sql insert into d1.t1 values(now, 5) -x step5
#step5:
#sql insert into d2.t2 values(now, 5) -x step6
#step6:
#sql insert into d3.t3 values(now, 5) -x step7
#step7:
#sql insert into d4.t4 values(now, 5) -x step8
#step8:
print ========= step6
system sh/exec.sh -n dnode3 -s start
sql insert into d1.t1 values(now, 6)
sql insert into d2.t2 values(now, 6)
sql insert into d3.t3 values(now, 6)
sql insert into d4.t4 values(now, 6)
sql select * from d1.t1
sql select * from d2.t2
sql select * from d3.t3
sql select * from d4.t4
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
\ No newline at end of file
......@@ -61,10 +61,8 @@ step12:
endi
sql show d1.vgroups
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
if $rows != 4 then
$leaderExist = 0
if $rows != 1 then
return -1
endi
if $data(2)[4] == leader then
......@@ -91,10 +89,8 @@ step13:
endi
sql show d1.vgroups
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
if $rows != 4 then
$leaderExist = 0
if $rows != 1 then
return -1
endi
if $data(3)[4] == leader then
......@@ -121,12 +117,7 @@ step14:
endi
sql show d1.vgroups
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
if $rows != 4 then
return -1
endi
$leaderExist = 0
if $data(4)[4] == leader then
$leaderExist = 1
endi
......@@ -151,12 +142,7 @@ step15:
endi
sql show d1.vgroups
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
if $rows != 4 then
return -1
endi
$leaderExist = 0
if $data(4)[4] == leader then
$leaderExist = 1
endi
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
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 dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c supportVnodes -v 4
system sh/cfg.sh -n dnode2 -c supportVnodes -v 4
system sh/cfg.sh -n dnode3 -c supportVnodes -v 4
system sh/cfg.sh -n dnode4 -c supportVnodes -v 4
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
sql create dnode $hostname port 7200
system sh/exec.sh -n dnode2 -s start
$x = 0
createDnode:
step1:
$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;
if $data4_2 == offline then
goto createDnode
endi
sql show dnodes
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 step1
endi
if $data(2)[4] != ready then
goto step1
endi
print ======================== dnode1 start
......@@ -38,7 +50,7 @@ $i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db
sql create database $db vgroups 3
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
......@@ -97,20 +109,20 @@ if $data00 != $rowNum then
endi
print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
sql select _wstartts, 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)
sql select _wstartts, 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 <= 1519833840000 interval(1m)
sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m)
print ===> $data01
if $data01 != 1 then
return -1
......@@ -152,13 +164,13 @@ if $data00 != 25 then
endi
print =============== step9
sql select count(tbcol) as b from $mt interval(1m)
sql select _wstartts, count(tbcol) as b from $mt interval(1m)
print ===> $data01
if $data01 != 10 then
return -1
endi
sql select count(tbcol) as b from $mt interval(1d)
sql select _wstartts, count(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 200 then
return -1
......@@ -175,20 +187,10 @@ if $rows != $tbNum then
return -1
endi
print =============== step11
sql select count(tbcol) as b from $mt where ts <= 1519833840000 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
if $rows != 2 then
return -1
endi
......@@ -196,7 +198,4 @@ 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/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/cfg.sh -n dnode1 -c walLevel -v 2
system sh/cfg.sh -n dnode2 -c walLevel -v 2
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c supportVnodes -v 4
system sh/cfg.sh -n dnode2 -c supportVnodes -v 4
system sh/cfg.sh -n dnode3 -c supportVnodes -v 4
system sh/cfg.sh -n dnode4 -c supportVnodes -v 4
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
sql create dnode $hostname port 7200
system sh/exec.sh -n dnode2 -s start
$x = 0
createDnode:
step1:
$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;
if $data4_2 == offline then
goto createDnode
endi
sql show dnodes
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 step1
endi
if $data(2)[4] != ready then
goto step1
endi
print ======================== dnode1 start
......@@ -43,7 +56,7 @@ $i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db
sql create database $db vgroups 3
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
......@@ -72,7 +85,6 @@ endi
sleep 100
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 3000
print =============== step2
sql select count(*) from $mt -x step2
......@@ -84,7 +96,27 @@ sql select count(tbcol) from $mt -x step21
step21:
system sh/exec.sh -n dnode2 -s start
sleep 3000
$x = 0
dnode2:
$x = $x + 1
sleep 1000
if $x == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
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 dnode2
endi
if $data(2)[4] != ready then
goto dnode2
endi
print =============== step3
sql select count(tbcol) as c from $mt where ts <= 1519833840000
......@@ -106,13 +138,13 @@ if $data00 != 25 then
endi
print =============== step4
sql select count(tbcol) as b from $mt interval(1m)
sql select _wstartts, count(tbcol) as b from $mt interval(1m)
print ===> $data01
if $data01 != 10 then
return -1
endi
sql select count(tbcol) as b from $mt interval(1d)
sql select _wstartts, count(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 200 then
return -1
......@@ -129,28 +161,14 @@ if $rows != $tbNum then
return -1
endi
print =============== step6
sql select count(tbcol) as b from $mt where ts <= 1519833840000 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
if $rows != 2 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/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 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 numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
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
sql create database db replica 3
sql use db
sql create table db.mt (ts timestamp, f1 float, f2 float, f3 float, f4 float, f5 float, f6 float, f7 float, f8 float, f9 float, f10 float) tags (t1 int, t2 int)
sql create table db.tb1 using db.mt tags(1, 2)
sleep 3001
$x = 1000
while $x < 1010
sql insert into tb1 values (now+1s , $x , $x , $x , $x , $x , $x , $x , $x , $x , $x )
$x = $x + 1
endw
sql_error create database d1 replica 2 wallevel 0
sql_error create database d2 replica 1 wallevel 0
sql_error alter database d2 replica 2
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/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 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
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/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
sql create dnode $hostname3
sql create dnode $hostname4
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
$x = 0
createDnode:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show dnodes;
if $data4_2 == offline then
goto createDnode
endi
if $data4_3 == offline then
goto createDnode
endi
if $data4_4 == offline then
goto createDnode
endi
print ======================== dnode1 start
$dbPrefix = r2d4_db
$tbPrefix = r2d4_tb
$mtPrefix = r2d4_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db replica 2
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
$val = $x * 60000
$ms = 1519833600000 + $val
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sql show vgroups
print vgroups ==> $rows
if $rows != 3 then
return -1
endi
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select count(*) from $tb
print ===> $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 <= 1519833840000
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 <= 1519833840000 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 <= 1519833840000
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 <= 1519833840000
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
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 <= 1519833840000 interval(1m) group by tgcol
print ===> $data01
if $data01 != 1 then
return -1
endi
if $rows != 50 then
return -1
endi
return
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 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/deploy.sh -n dnode2 -i 2
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 dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
$x = 0
createDnode:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show dnodes;
if $data4_2 == offline then
goto createDnode
endi
print ======================== dnode1 start
$dbPrefix = r2v3_db
$tbPrefix = r2v3_tb
$mtPrefix = r2v3_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db replica 2
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
$val = $x * 60000
$ms = 1519833600000 + $val
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sql show vgroups
print vgroups ==> $rows
if $rows != 3 then
return -1
endi
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select count(*) from $tb
print ===> $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 <= 1519833840000
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 <= 1519833840000 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 <= 1519833840000
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 <= 1519833840000
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
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 <= 1519833840000 interval(1m) group by tgcol
print ===> $data01
if $data01 != 1 then
return -1
endi
if $rows != 50 then
return -1
endi
return
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 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
run unique/metrics/balance_replica1.sim
run unique/metrics/dnode2_stop.sim
run unique/metrics/dnode2.sim
run unique/metrics/dnode3.sim
run unique/metrics/replica2_dnode4.sim
run unique/metrics/replica2_vnode3.sim
run unique/metrics/replica3_dnode6.sim
run unique/metrics/replica3_vnode3.sim
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册