319 lines
5.3 KiB
Plaintext
319 lines
5.3 KiB
Plaintext
system sh/stop_dnodes.sh
|
|
system sh/deploy.sh -n dnode1 -i 1
|
|
system sh/exec.sh -n dnode1 -s start
|
|
sql connect
|
|
|
|
print ============================ dnode1 start
|
|
|
|
$i = 0
|
|
$dbPrefix = db
|
|
$stPrefix = st
|
|
$tbPrefix = tb
|
|
$db = $dbPrefix . $i
|
|
$st = $stPrefix . $i
|
|
$tb = $tbPrefix . $i
|
|
|
|
print =============== step1
|
|
# quorum presicion
|
|
sql create database $db vgroups 8 replica 1 duration 2 keep 10 minrows 80 maxrows 10000 wal_level 2 wal_fsync_period 1000 comp 0 cachemodel 'last_value' precision 'us'
|
|
sql select * from information_schema.ins_databases
|
|
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
|
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
if $data20 != $db then
|
|
return -1
|
|
endi
|
|
if $data22 != 8 then
|
|
return -1
|
|
endi
|
|
if $data23 != 0 then
|
|
return -1
|
|
endi
|
|
if $data24 != 1 then
|
|
return -1
|
|
endi
|
|
if $data26 != 2880m then
|
|
return -1
|
|
endi
|
|
if $data27 != 14400m,14400m,14400m then
|
|
return -1
|
|
endi
|
|
#if $data28 != 32 then
|
|
# return -1
|
|
#endi
|
|
#if $data29 != 12 then
|
|
# return -1
|
|
#endi
|
|
|
|
print =============== step2
|
|
sql_error create database $db
|
|
sql create database if not exists $db
|
|
sql select * from information_schema.ins_databases
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step3
|
|
sql drop database $db
|
|
sql select * from information_schema.ins_databases
|
|
if $rows != 2 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step4
|
|
sql_error drop database $db
|
|
|
|
print =============== step5
|
|
sql create database $db replica 1 duration 15 keep 1500
|
|
sql select * from information_schema.ins_databases
|
|
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
|
|
if $data20 != $db then
|
|
return -1
|
|
endi
|
|
if $data23 != 0 then
|
|
return -1
|
|
endi
|
|
if $data24 != 1 then
|
|
return -1
|
|
endi
|
|
if $data26 != 21600m then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step6
|
|
$i = $i + 1
|
|
while $i < 5
|
|
$db = $dbPrefix . $i
|
|
$st = $stPrefix . $i
|
|
$tb = $tbPrefix . $i
|
|
|
|
print create database $db
|
|
sql create database $db
|
|
|
|
print use $db
|
|
sql use $db
|
|
|
|
print create table $st (ts timestamp, i int) tags (j int)
|
|
sql create table $st (ts timestamp, i int) tags (j int)
|
|
|
|
print create table $tb using $st tags(1)
|
|
sql create table $tb using $st tags(1)
|
|
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01 $data02 $data03
|
|
if $data00 != $st then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01 $data02 $data03
|
|
if $data00 != $tb then
|
|
return -1
|
|
endi
|
|
|
|
$i = $i + 1
|
|
endw
|
|
|
|
print =============== step7
|
|
$i = 0
|
|
while $i < 5
|
|
$db = $dbPrefix . $i
|
|
sql drop database $db
|
|
$i = $i + 1
|
|
endw
|
|
|
|
print =============== step8
|
|
$i = 1
|
|
$db = $dbPrefix . $i
|
|
$st = $stPrefix . $i
|
|
$tb = $tbPrefix . $i
|
|
sql create database $db
|
|
sql use $db
|
|
sql create table $st (ts timestamp, i int) tags (j int)
|
|
sql create table $tb using $st tags(1)
|
|
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $st then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $tb then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step9
|
|
sql drop database $db
|
|
|
|
print =============== step10
|
|
sql create database $db
|
|
sql use $db
|
|
|
|
sql show stables
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step11
|
|
sql create table $st (ts timestamp, i int) tags (j int)
|
|
sql create table $tb using $st tags(1)
|
|
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $st then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $tb then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step12
|
|
sql drop database $db
|
|
|
|
print =============== step13
|
|
sql create database $db
|
|
sql use $db
|
|
|
|
sql show stables
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
print ============== step14
|
|
sql create table $st (ts timestamp, i int) tags (j int)
|
|
sql create table $tb using $st tags(1)
|
|
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $st then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $tb then
|
|
return -1
|
|
endi
|
|
|
|
sql insert into $tb values (now+1a, 0)
|
|
sql insert into $tb values (now+2a, 1)
|
|
sql insert into $tb values (now+3a, 2)
|
|
sql insert into $tb values (now+4a, 3)
|
|
sql insert into $tb values (now+5a, 4)
|
|
|
|
sql select * from $tb
|
|
if $rows != 5 then
|
|
return -1
|
|
endi
|
|
|
|
sql select * from $st
|
|
if $rows != 5 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step14
|
|
sql drop database $db
|
|
|
|
print =============== step15
|
|
sql create database $db
|
|
sql use $db
|
|
|
|
sql show stables
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== step16
|
|
sql create table $st (ts timestamp, i int) tags (j int)
|
|
sql create table $tb using $st tags(1)
|
|
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $st then
|
|
return -1
|
|
endi
|
|
|
|
sql show tables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != $tb then
|
|
return -1
|
|
endi
|
|
|
|
sql insert into $tb values (now+1a, 0)
|
|
sql insert into $tb values (now+2a, 1)
|
|
sql insert into $tb values (now+3a, 2)
|
|
sql insert into $tb values (now+4a, 3)
|
|
sql insert into $tb values (now+5a, 4)
|
|
|
|
sql select * from $tb
|
|
if $rows != 5 then
|
|
return -1
|
|
endi
|
|
|
|
sql select * from $st
|
|
if $rows != 5 then
|
|
return -1
|
|
endi
|
|
|
|
sql drop database $db
|
|
sql select * from information_schema.ins_databases
|
|
if $rows != 2 then
|
|
return -1
|
|
endi
|
|
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|