128 lines
3.6 KiB
Plaintext
128 lines
3.6 KiB
Plaintext
system sh/stop_dnodes.sh
|
|
system sh/deploy.sh -n dnode1 -i 1
|
|
system sh/exec.sh -n dnode1 -s start
|
|
sleep 50
|
|
sql connect
|
|
|
|
print =============== create database
|
|
sql create database d1
|
|
sql show databases
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01 $data02
|
|
|
|
sql use d1
|
|
|
|
print =============== create super table, include all type
|
|
sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned)
|
|
|
|
sql create stable if not exists stb_1 (ts timestamp, i int) tags (j int)
|
|
sql create table stb_2 (ts timestamp, i int) tags (j int)
|
|
sql create stable stb_3 (ts timestamp, i int) tags (j int)
|
|
|
|
sql show stables
|
|
if $rows != 4 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== create child table
|
|
sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
|
sql create table c2 using stb tags(false, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 2', 'child tbl 2', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
|
|
|
sql show tables
|
|
if $rows != 2 then
|
|
return -1
|
|
endi
|
|
|
|
|
|
print =============== insert data, mode1: one row one table in sql
|
|
print =============== insert data, mode1: mulit rows one table in sql
|
|
print =============== insert data, mode1: one rows mulit table in sql
|
|
print =============== insert data, mode1: mulit rows mulit table in sql
|
|
sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
|
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
|
|
|
print =============== query data
|
|
sql select * from c1
|
|
print rows: $rows
|
|
print $data00 $data01
|
|
print $data10 $data11
|
|
print $data20 $data21
|
|
print $data30 $data31
|
|
if $rows != 4 then
|
|
return -1
|
|
endi
|
|
|
|
if $data01 != 1 then
|
|
print expect 1, actual: $data01
|
|
return -1
|
|
endi
|
|
|
|
if $data02 != -1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data03 != -2 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== query data from st, but not support select * from super table, waiting fix
|
|
#sql select * from st
|
|
#if $rows != 4 then
|
|
# return -1
|
|
#endi
|
|
|
|
print =============== stop and restart taosd
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
system sh/exec.sh -n dnode1 -s start
|
|
|
|
$loop_cnt = 0
|
|
check_dnode_ready:
|
|
$loop_cnt = $loop_cnt + 1
|
|
sleep 200
|
|
if $loop_cnt == 10 then
|
|
print ====> dnode not ready!
|
|
return -1
|
|
endi
|
|
sql show dnodes
|
|
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
|
|
if $data00 != 1 then
|
|
return -1
|
|
endi
|
|
if $data04 != ready then
|
|
goto check_dnode_ready
|
|
endi
|
|
|
|
print =============== query data
|
|
sql select * from c1
|
|
print rows: $rows
|
|
print $data00 $data01
|
|
print $data10 $data11
|
|
print $data20 $data21
|
|
print $data30 $data31
|
|
if $rows != 4 then
|
|
return -1
|
|
endi
|
|
|
|
if $data01 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data02 != -1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data03 != -2 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== query data from st, but not support select * from super table, waiting fix
|
|
#sql select * from st
|
|
#if $rows != 4 then
|
|
# return -1
|
|
#endi
|
|
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|