homework-jianmu/tests/script/unique/stream/table_replica1_dnode2.sim

137 lines
3.0 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/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/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_192.168.0.2 == offline then
goto createDnode
endi
print ======================== dnode1 start
$dbPrefix = t1d_db
$tbPrefix = t1d_tb
$mtPrefix = t1d_mt
$stPrefix = t1d_st
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$st = $stPrefix . $i
sql drop databae $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = -1440
$y = 0
while $y < $rowNum
$ms = $x . m
sql insert into $tb values (now $ms , $y , $y )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print select count(*), count(tbcol), count(tbcol2) from $tb interval(1d) --> $data00 $data01 $data02 $data03
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
$i = 5
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print select count(*), count(tbcol), count(tbcol2) from $tb interval(1d) --> $data00 $data01 $data02 $data03
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
$i = 8
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
print select count(*), count(tbcol), count(tbcol2) from $tb interval(1d) --> $data00 $data01 $data02 $data03
sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(1d)
sql show tables
if $rows != 13 then
return -1
endi
print =============== step3
print sleep 22 seconds
sleep 22000
print =============== step4
$i = 1
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $st
print $st ==> $rows $data00 $data01 $data10 $data11
$rows1 = $rows
if $data01 != 20 then
return -1
endi
$i = 5
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $st
print $st => $rows $data00 $data01 $data10 $data11
$rows5 = $rows
if $data01 != 20 then
return -1
endi
$i = 8
$tb = $tbPrefix . $i
$st = $stPrefix . $i
sql select * from $st
print $st ==> $rows $data00 $data01 $data10 $data11
$rows8 = $rows
if $data01 != 20 then
return -1
endi
if $rows8 != $rows5 then
return -1
endi
if $rows8 != $rows1 then
return -1
endi