提交 d3c17f50 编写于 作者: haoranc's avatar haoranc

test:modify testcase of muti-vgroups

上级 f38db7ad
...@@ -31,7 +31,7 @@ if $data[0][4] != ready then ...@@ -31,7 +31,7 @@ if $data[0][4] != ready then
goto check_dnode_ready goto check_dnode_ready
endi endi
#sql connect sql connect
sql create dnode $hostname port 7200 sql create dnode $hostname port 7200
sql create dnode $hostname port 7300 sql create dnode $hostname port 7300
sql create dnode $hostname port 7400 sql create dnode $hostname port 7400
...@@ -71,7 +71,7 @@ sql create database db replica $replica vgroups $vgroups ...@@ -71,7 +71,7 @@ sql create database db replica $replica vgroups $vgroups
$loop_cnt = 0 $loop_cnt = 0
check_db_ready: check_db_ready:
$loop_cnt = $loop_cnt + 1 $loop_cnt = $loop_cnt + 1
sleep 200 sleep 20
if $loop_cnt == 10 then if $loop_cnt == 10 then
print ====> db not ready! print ====> db not ready!
return -1 return -1
...@@ -93,49 +93,30 @@ $loop_cnt = 0 ...@@ -93,49 +93,30 @@ $loop_cnt = 0
check_vg_ready: check_vg_ready:
$loop_cnt = $loop_cnt + 1 $loop_cnt = $loop_cnt + 1
sleep 200 sleep 200
if $loop_cnt == 10 then if $loop_cnt == 300 then
print ====> vgroups not ready! print ====> vgroups not ready!
return -1 return -1
endi endi
sql show vgroups sql show vgroups
print ===> rows: $rows print ===> rows: $rows
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] $data[0][7] $data[0][8] $data[0][9] $data[10][6] $data[0][11] $data[0][12] $data[0][13] print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] $data[0][7] $data[0][8] $data[0][9] $data[10][6] $data[0][11] $data[0][12] $data[0][13]
if $rows != $vgroups then if $rows != $vgroups then
return -1 return -1
endi endi
if $data[0][4] == LEADER then if $data[0][4] == LEADER then
if $data[0][6] != NULL then
goto check_vg_ready
endi
if $data[0][8] != NULL then
goto check_vg_ready
endi
print ---- vgroup $data[0][0] leader locate on dnode $data[0][3] print ---- vgroup $data[0][0] leader locate on dnode $data[0][3]
goto vg_ready goto vg_ready
endi elif $data[0][6] == LEADER then
if $data[0][6] == LEADER then
if $data[0][4] != NULL then
goto check_vg_ready
endi
if $data[0][8] != NULL then
goto check_vg_ready
endi
print ---- vgroup $data[0][0] leader locate on dnode $data[0][5] print ---- vgroup $data[0][0] leader locate on dnode $data[0][5]
goto vg_ready goto vg_ready
endi elif $data[0][8] == LEADER then
if $data[0][8] == LEADER then
if $data[0][4] != NULL then
goto check_vg_ready
endi
if $data[0][6] != NULL then
goto check_vg_ready
endi
print ---- vgroup $data[0][0] leader locate on dnode $data[0][7] print ---- vgroup $data[0][0] leader locate on dnode $data[0][7]
goto vg_ready goto vg_ready
else
goto check_vg_ready
endi endi
vg_ready:
vg_ready:
print ====> create stable/child table print ====> create stable/child table
sql create table stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) sql create table stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int)
...@@ -156,27 +137,13 @@ while $i < $tbNum ...@@ -156,27 +137,13 @@ while $i < $tbNum
sql create table $ctb using stb tags( $i ) sql create table $ctb using stb tags( $i )
$ntb = $ntbPrefix . $i $ntb = $ntbPrefix . $i
sql create table $ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) sql create table $ntb (ts timestamp, c1 int, c2 float, c3 binary(10))
# $x = 0
# while $x < $rowNum
# $binary = ' . binary
# $binary = $binary . $i
# $binary = $binary . '
#
# sql insert into $ctb values ($tstart , $i , $x , $binary )
# sql insert into $ntb values ($tstart , 999 , 999 , 'binary-ntb' )
# $tstart = $tstart + 1
# $x = $x + 1
# endw
# print ====> insert rows: $rowNum into $ctb and $ntb
$i = $i + 1 $i = $i + 1
# $tstart = 1640966400000
endw endw
$totalTblNum = $tbNum * 2 $totalTblNum = $tbNum * 2
sleep 1000
sql show tables sql show tables
print ====> expect $totalTblNum and infinsert $rows in fact
if $rows != $totalTblNum then if $rows != $totalTblNum then
return -1 return -1
endi endi
...@@ -185,7 +152,7 @@ print ====> create a normal table for interaction between main and back threads ...@@ -185,7 +152,7 @@ print ====> create a normal table for interaction between main and back threads
sql create table interaction (ts timestamp, flag binary(10), childrows int, stbrows int) sql create table interaction (ts timestamp, flag binary(10), childrows int, stbrows int)
print ====> start to run_back to insert data print ====> start to run_back to insert data
run_back tsim/tmq/insertDataByRunBack.sim run_back tsim/sync/insertDataByRunBack.sim
print ====> waiting insert thread starting insert data print ====> waiting insert thread starting insert data
...@@ -222,12 +189,15 @@ endi ...@@ -222,12 +189,15 @@ endi
$dnodeId = dnode . $dnodeId $dnodeId = dnode . $dnodeId
print ====> stop $dnodeId print ====> stop $dnodeId
system sh/exec.sh -n $dnodeId -s stop -x SIGINT system sh/exec.sh -n $dnodeId -s stop -x SIGINT
sleep 1000
print ====> start $dnodeId
system sh/exec.sh -n $dnodeId -s start
$loop_cnt = 0 $loop_cnt = 0
check_vg_ready_2: check_vg_ready_2:
$loop_cnt = $loop_cnt + 1 $loop_cnt = $loop_cnt + 1
sleep 200 sleep 200
if $loop_cnt == 10 then if $loop_cnt == 300 then
print ====> vgroups switch fail!!! print ====> vgroups switch fail!!!
return -1 return -1
endi endi
...@@ -239,41 +209,39 @@ if $rows != $vgroups then ...@@ -239,41 +209,39 @@ if $rows != $vgroups then
return -1 return -1
endi endi
if $data[0][4] == LEADER then if $data[0][4] == LEADER then
if $data[0][6] != NULL then if $data[0][6] != FOLLOWER then
goto check_vg_ready_2 goto check_vg_ready_2
endi endi
if $data[0][8] != NULL then if $data[0][8] != FOLLOWER then
goto check_vg_ready_2 goto check_vg_ready_2
endi endi
print ---- vgroup $data[0][0] leader switch to dnode $data[0][3] print ---- vgroup $dnodeId leader switch to dnode $data[0][3]
goto vg_ready_2 goto vg_ready_2
endi elif $data[0][6] == LEADER then
if $data[0][6] == LEADER then if $data[0][4] != FOLLOWER then
if $data[0][4] != NULL then
goto check_vg_ready_2 goto check_vg_ready_2
endi endi
if $data[0][8] != NULL then if $data[0][8] != FOLLOWER then
goto check_vg_ready_2 goto check_vg_ready_2
endi endi
print ---- vgroup $data[0][0] leader switch to dnode $data[0][5] print ---- vgroup $dnodeId leader switch to dnode $data[0][5]
goto vg_ready_2 goto vg_ready_2
endi elif $data[0][8] == LEADER then
if $data[0][8] == LEADER then if $data[0][4] != FOLLOWER then
if $data[0][4] != NULL then
goto check_vg_ready_2 goto check_vg_ready_2
endi endi
if $data[0][6] != NULL then if $data[0][6] != FOLLOWER then
goto check_vg_ready_2 goto check_vg_ready_2
endi endi
print ---- vgroup $data[0][0] leader switch to dnode $data[0][7] print ---- vgroup $dnodeId leader switch to dnode $data[0][7]
goto vg_ready_2 goto vg_ready_2
else
goto check_vg_ready_2
endi endi
vg_ready_2: vg_ready_2:
$switch_loop_cnt = $switch_loop_cnt + 1 $switch_loop_cnt = $switch_loop_cnt + 1
if $switch_loop_cnt < 3 then if $switch_loop_cnt < 3 then
print ====> start $dnodeId
system sh/exec.sh -n $dnodeId -s start
goto switch_leader_loop goto switch_leader_loop
endi endi
...@@ -344,28 +312,28 @@ if $rows != $vgroups then ...@@ -344,28 +312,28 @@ if $rows != $vgroups then
return -1 return -1
endi endi
if $data[0][4] == LEADER then if $data[0][4] == LEADER then
if $data[0][6] != NULL then if $data[0][6] != FOLLOWER then
goto check_vg_ready_1 goto check_vg_ready_1
endi endi
if $data[0][8] != NULL then if $data[0][8] != FOLLOWER then
goto check_vg_ready_1 goto check_vg_ready_1
endi endi
goto vg_ready_1 goto vg_ready_1
endi endi
if $data[0][6] == LEADER then if $data[0][6] == LEADER then
if $data[0][4] != NULL then if $data[0][4] != FOLLOWER then
goto check_vg_ready_1 goto check_vg_ready_1
endi endi
if $data[0][8] != NULL then if $data[0][8] != FOLLOWER then
goto check_vg_ready_1 goto check_vg_ready_1
endi endi
goto vg_ready_1 goto vg_ready_1
endi endi
if $data[0][8] == LEADER then if $data[0][8] == LEADER then
if $data[0][4] != NULL then if $data[0][4] != FOLLOWER then
goto check_vg_ready_1 goto check_vg_ready_1
endi endi
if $data[0][6] != NULL then if $data[0][6] != FOLLOWER then
goto check_vg_ready_1 goto check_vg_ready_1
endi endi
goto vg_ready_1 goto vg_ready_1
...@@ -394,6 +362,73 @@ if $data[0][0] != $totalRowsOfStb then ...@@ -394,6 +362,73 @@ if $data[0][0] != $totalRowsOfStb then
return -1 return -1
endi endi
print ====> once stop one dnode by loop, and do query every time
$i = 2
loop_stop_dnode:
$dnodeId = dnode . $i
print ====> stop $dnodeId
system sh/exec.sh -n $dnodeId -s stop -x SIGINT
check_vg_ready_3:
sql show vgroups
print $data(2)[0] $data(2)[1] $data(2)[2] $data(2)[3] $data(2)[4] $data(2)[5] $data(2)[6] $data(2)[7] $data(2)[8] $data(2)[9] $data(2)[10] $data(2)[11] $data(2)[12] $data(2)[13]
if $data[0][4] == LEADER then
if $data[0][6] == LEADER then
goto check_vg_ready_3
endi
if $data[0][8] == LEADER then
goto check_vg_ready_3
endi
print ---- vgroup $data[0][0] leader locating dnode $data[0][5]
elif $data[0][6] == LEADER then
if $data[0][4] == LEADER then
goto check_vg_ready_3
endi
if $data[0][8] == LEADER then
goto check_vg_ready_3
endi
print ---- vgroup $data[0][0] leader locating dnode $data[0][7]
elif $data[0][8] == LEADER then
if $data[0][4] == LEADER then
goto check_vg_ready_3
endi
if $data[0][6] == LEADER then
goto check_vg_ready_3
endi
print ---- vgroup $data[0][0] leader locating dnode $data[0][9]
else
print ====> no leader vnode!!!
return -1
endi
sql select count(*) from ntb0
print rows: $rows
print $data[0][0] $data[0][1]
if $data[0][0] != $totalRowsOfCtb then
return -1
endi
sql select count(*) from ctb0
print rows: $rows
print $data[0][0] $data[0][1]
if $data[0][0] != $totalRowsOfCtb then
return -1
endi
sql select count(*) from stb
print rows: $rows
print $data[0][0] $data[0][1]
if $data[0][0] != $totalRowsOfStb then
return -1
endi
$i = $i + 1
if $i <= 4 then
print ====> start $dnodeId
system sh/exec.sh -n $dnodeId -s start
goto loop_stop_dnode
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册