TDengine/tests/script/unique/vnode/replica2_basic.sim

193 lines
3.6 KiB
Text
Raw Normal View History

2020-04-19 15:28:22 +00:00
system sh/stop_dnodes.sh
2020-04-29 09:30:03 +00:00
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
2020-05-07 08:08:51 +00:00
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
2020-04-19 15:28:22 +00:00
system sh/cfg.sh -n dnode1 -c numofMpeers -v 3
system sh/cfg.sh -n dnode2 -c numofMpeers -v 3
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode1 -s start
2020-04-19 15:28:22 +00:00
sql connect
2020-05-01 07:22:27 +00:00
sql create dnode $hostname2
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode2 -s start
2020-04-19 15:28:22 +00:00
sleep 3000
$N = 10
$db = d1
$table = table_r2
print =================== step 1
sql create database $db replica 3
sql use $db
sql create table $table (ts timestamp, speed int) -x error_create
return -1
error_create:
sql drop database $db
print =================== step 2
sql create database $db replica 2
sql use $db
sql create table $table (ts timestamp, speed int)
sleep 1000
print =================== step 3
$x = 1
$y = $x + $N
$expect = $N
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 4
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode2 -s stop
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 2
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 5
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode2 -s start
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 3
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 6
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode1 -s stop
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 4
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 7
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode1 -s start
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 5
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 8
system sh/ip.sh -i 1 -s down
2020-04-29 09:30:03 +00:00
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 6
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 9
2020-04-29 09:30:03 +00:00
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 7
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 10
system sh/ip.sh -i 2 -s down
2020-04-29 09:30:03 +00:00
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 8
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 11
2020-04-29 09:30:03 +00:00
2020-04-19 15:28:22 +00:00
sleep 2000
$y = $x + $N
$expect = $N * 9
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 12
2020-05-04 13:18:24 +00:00
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop