TDengine/tests/script/tsim/db/basic6.sim

319 lines
5.3 KiB
Text
Raw Normal View History

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
2022-08-18 11:32:14 +00:00
# quorum presicion
2022-07-27 03:55:19 +00:00
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'
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-03-14 10:43:40 +00:00
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
2022-04-14 03:36:06 +00:00
if $rows != 3 then
2022-03-14 10:43:40 +00:00
return -1
endi
2022-04-14 03:36:06 +00:00
if $data20 != $db then
return -1
endi
2022-04-14 03:36:06 +00:00
if $data22 != 8 then
return -1
endi
2022-04-14 03:36:06 +00:00
if $data23 != 0 then
return -1
endi
2022-04-14 03:36:06 +00:00
if $data24 != 1 then
return -1
endi
2022-06-17 09:30:57 +00:00
if $data26 != 2880m then
return -1
endi
2022-06-11 08:44:27 +00:00
if $data27 != 14400m,14400m,14400m then
2022-03-14 10:43:40 +00:00
return -1
endi
2022-04-27 10:18:37 +00:00
#if $data28 != 32 then
# return -1
#endi
#if $data29 != 12 then
# return -1
#endi
2022-08-18 11:32:14 +00:00
print =============== step2
2022-03-14 10:43:40 +00:00
sql_error create database $db
sql create database if not exists $db
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-04-14 03:36:06 +00:00
if $rows != 3 then
return -1
2022-03-14 10:43:40 +00:00
endi
print =============== step3
sql drop database $db
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-04-14 03:36:06 +00:00
if $rows != 2 then
2022-03-26 07:03:22 +00:00
return -1
2022-08-18 11:32:14 +00:00
endi
print =============== step4
sql_error drop database $db
print =============== step5
sql create database $db replica 1 duration 15 keep 1500
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
2022-04-14 03:36:06 +00:00
if $data20 != $db then
return -1
endi
2022-04-14 03:36:06 +00:00
if $data23 != 0 then
return -1
endi
2022-04-14 03:36:06 +00:00
if $data24 != 1 then
return -1
endi
2022-06-17 09:30:57 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
print $data00 $data01 $data02 $data03
2022-08-18 11:32:14 +00:00
if $data00 != $st then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
print $data00 $data01 $data02 $data03
2022-08-18 11:32:14 +00:00
if $data00 != $tb then
return -1
endi
$i = $i + 1
endw
print =============== step7
$i = 0
while $i < 5
2022-08-18 11:32:14 +00:00
$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
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
if $data00 != $st then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 0 then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
if $data00 != $st then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 0 then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
if $data00 != $st then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 5 then
return -1
endi
2022-08-09 12:46:37 +00:00
sql select * from $st
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 0 then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
if $data00 != $st then
return -1
endi
sql show tables
2022-08-18 11:32:14 +00:00
if $rows != 1 then
return -1
endi
2022-08-18 11:32:14 +00:00
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
2022-08-18 11:32:14 +00:00
if $rows != 5 then
return -1
endi
2022-08-09 12:46:37 +00:00
sql select * from $st
2022-08-18 11:32:14 +00:00
if $rows != 5 then
return -1
endi
sql drop database $db
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-04-14 03:36:06 +00:00
if $rows != 2 then
return -1
endi
2022-03-26 07:03:22 +00:00
system sh/exec.sh -n dnode1 -s stop -x SIGINT