140 lines
2.2 KiB
Plaintext
140 lines
2.2 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
|
|
|
|
$dbPrefix = m_in_db
|
|
$tbPrefix = m_in_tb
|
|
$mtPrefix = m_in_mt
|
|
$tbNum = 1
|
|
$rowNum = 200
|
|
$totalNum = 400
|
|
|
|
print =============== step1
|
|
$i = 0
|
|
$db = $dbPrefix . $i
|
|
$mt = $mtPrefix . $i
|
|
|
|
sql drop database if exists $db
|
|
sql create database $db vgroups 1 maxrows 200 minrows 10;
|
|
sql use $db
|
|
sql create table $mt (ts timestamp, f1 int, f2 float) TAGS(tgcol int)
|
|
|
|
print ====== start create child tables and insert data
|
|
$i = 0
|
|
while $i < $tbNum
|
|
$tb = $tbPrefix . $i
|
|
sql create table $tb using $mt tags( $i )
|
|
|
|
$x = 0
|
|
while $x < $rowNum
|
|
$cc = $x * 1
|
|
$ms = 1601481600000 + $cc
|
|
|
|
sql insert into $tb values ($ms , NULL , $x )
|
|
$x = $x + 1
|
|
endw
|
|
|
|
$i = $i + 1
|
|
endw
|
|
|
|
$i = 1
|
|
$tb = $tbPrefix . $i
|
|
sql create table $tb using $mt tags( $i )
|
|
|
|
$x = 0
|
|
while $x < $rowNum
|
|
$cc = $x * 1
|
|
$ms = 1601481600000 + $cc
|
|
|
|
sql insert into $tb values ($ms , $x , NULL )
|
|
$x = $x + 1
|
|
endw
|
|
|
|
sql flush database $db
|
|
|
|
print =============== step2
|
|
$i = 0
|
|
$tb = $tbPrefix . $i
|
|
sql select max(f1) from $tb
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
if $data00 != NULL then
|
|
return -1
|
|
endi
|
|
|
|
$i = 1
|
|
$tb = $tbPrefix . $i
|
|
sql select max(f2) from $tb
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
if $data00 != NULL then
|
|
return -1
|
|
endi
|
|
|
|
$rowNum = 10
|
|
|
|
print ====== insert more data
|
|
$i = 0
|
|
while $i < $tbNum
|
|
$tb = $tbPrefix . $i
|
|
|
|
$x = 0
|
|
while $x < $rowNum
|
|
$cc = $x * 1
|
|
$ms = 1601481700000 + $cc
|
|
|
|
sql insert into $tb values ($ms , $x , $x )
|
|
$x = $x + 1
|
|
endw
|
|
|
|
$i = $i + 1
|
|
endw
|
|
|
|
$i = 1
|
|
$tb = $tbPrefix . $i
|
|
$x = 0
|
|
while $x < $rowNum
|
|
$cc = $x * 1
|
|
$ms = 1601481700000 + $cc
|
|
|
|
sql insert into $tb values ($ms , $x , $x )
|
|
$x = $x + 1
|
|
endw
|
|
|
|
sql flush database $db
|
|
|
|
print =============== step3
|
|
$i = 0
|
|
$tb = $tbPrefix . $i
|
|
sql select max(f1) from $tb
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
if $data00 != 9 then
|
|
return -1
|
|
endi
|
|
|
|
$i = 1
|
|
$tb = $tbPrefix . $i
|
|
sql select max(f2) from $tb
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
if $data00 != 9.00000 then
|
|
print $data00
|
|
return -1
|
|
endi
|
|
|
|
|
|
print =============== clear
|
|
#sql drop database $db
|
|
#sql select * from information_schema.ins_databases
|
|
#if $rows != 0 then
|
|
# return -1
|
|
#endi
|
|
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|