TDengine/tests/script/tsim/mnode/basic1.sim

150 lines
2.7 KiB
Text
Raw Normal View History

2022-04-09 11:38:49 +00:00
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect
2022-08-11 12:56:31 +00:00
print =============== select * from information_schema.ins_dnodes
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes;
2022-04-09 11:38:49 +00:00
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
2022-06-02 06:35:59 +00:00
if $data02 != leader then
2022-04-09 11:38:49 +00:00
return -1
endi
print =============== create dnodes
sql create dnode $hostname port 7200
2022-05-26 12:34:03 +00:00
$x = 0
step1:
$x = $x + 1
sleep 500
if $x == 20 then
return -1
endi
2022-08-11 12:56:31 +00:00
sql select * from information_schema.ins_dnodes -x step1
2022-05-26 12:34:03 +00:00
if $data(1)[4] != ready then
goto step1
endi
if $data(2)[4] != ready then
goto step1
endi
sql_error create mnode on dnode 1
sql_error drop mnode on dnode 1
2022-05-27 13:26:04 +00:00
print =============== create mnode 2
2022-05-26 12:34:03 +00:00
sql create mnode on dnode 2
print =============== create mnode 2 finished
2022-05-26 12:34:03 +00:00
$x = 0
2022-05-27 13:26:04 +00:00
step2:
2022-05-26 12:34:03 +00:00
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
2022-05-26 12:34:03 +00:00
print $data(1)[0] $data(1)[1] $data(1)[2]
print $data(2)[0] $data(2)[1] $data(2)[2]
2022-04-09 11:38:49 +00:00
if $rows != 2 then
return -1
endi
2022-05-26 12:34:03 +00:00
if $data(1)[0] != 1 then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(1)[2] != leader then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-05-26 12:34:03 +00:00
if $data(2)[0] != 2 then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(2)[2] != follower then
2022-05-27 13:26:04 +00:00
goto step2
2022-04-09 11:38:49 +00:00
endi
2022-05-27 13:26:04 +00:00
print ============ drop mnode 2
2022-05-26 12:34:03 +00:00
sql drop mnode on dnode 2
print ============ drop mnode 2 finished
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
2022-05-26 12:34:03 +00:00
if $rows != 1 then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-05-26 12:34:03 +00:00
sql_error drop mnode on dnode 2
2022-04-09 11:38:49 +00:00
2022-05-26 12:34:03 +00:00
$x = 0
step2:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
2022-05-26 12:34:03 +00:00
print $data(1)[0] $data(1)[1] $data(1)[2]
print $data(2)[0] $data(2)[1] $data(2)[2]
2022-04-09 11:38:49 +00:00
2022-05-27 01:48:25 +00:00
if $rows != 1 then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-05-26 12:34:03 +00:00
if $data(1)[0] != 1 then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(1)[2] != leader then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-05-27 01:48:25 +00:00
if $data(2)[0] != null then
2022-05-26 12:34:03 +00:00
goto step2
endi
2022-05-27 01:48:25 +00:00
if $data(2)[2] != null then
2022-05-26 12:34:03 +00:00
goto step2
endi
2022-04-09 11:38:49 +00:00
2022-05-26 12:34:03 +00:00
sleep 2000
2022-04-09 11:38:49 +00:00
2022-05-27 01:48:25 +00:00
print =============== create mnodes
2022-04-09 11:38:49 +00:00
sql create mnode on dnode 2
print =============== create mnode 2 finished
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
2022-04-09 11:38:49 +00:00
if $rows != 2 then
return -1
endi
2022-05-26 12:34:03 +00:00
$x = 0
step3:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
2022-05-26 12:34:03 +00:00
print $data(1)[0] $data(1)[1] $data(1)[2]
print $data(2)[0] $data(2)[1] $data(2)[2]
2022-04-09 11:38:49 +00:00
if $rows != 2 then
return -1
endi
2022-05-26 12:34:03 +00:00
if $data(1)[0] != 1 then
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(1)[2] != leader then
2022-05-26 12:34:03 +00:00
return -1
endi
if $data(2)[0] != 2 then
2022-04-09 11:38:49 +00:00
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(2)[2] != follower then
2022-05-26 12:34:03 +00:00
goto step3
endi
2022-04-09 11:38:49 +00:00
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT