homework-jianmu/tests/script/tsim/trans/create_stb.sim

73 lines
1.6 KiB
Plaintext

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 transPullupInterval -v 1
system sh/cfg.sh -n dnode2 -c transPullupInterval -v 1
system sh/cfg.sh -n dnode3 -c transPullupInterval -v 1
system sh/cfg.sh -n dnode4 -c transPullupInterval -v 1
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
sql connect
print =============== step1: create dnodes
sql create dnode $hostname port 7200
sql create dnode $hostname port 7300
sql create dnode $hostname port 7400
$x = 0
step1:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql select * from information_schema.ins_dnodes -x step1
if $data(1)[4] != ready then
goto step1
endi
if $data(2)[4] != ready then
goto step1
endi
if $data(3)[4] != ready then
goto step1
endi
print =============== step2: create mnode 2 and 3
sql create mnode on dnode 2
sql create mnode on dnode 3
sql create database db vgroups 2
print =============== step3: kill dnode4
system sh/exec.sh -n dnode4 -s stop -x SIGKILL
sql use db
sql_error create table stb (ts timestamp, i int) tags (j int)
print =============== step4: create database
sql show transactions
if $rows != 1 then
return -1
endi
sleep 3000
system sh/exec.sh -n dnode4 -s start
$wt = 0
step4:
$wt = $wt + 1
sleep 1000
if $wt == 200 then
print ====> transaction already running
return -1
endi
sql show transactions
if $rows != 0 then
print wait 1 seconds to alter
goto step4
endi