insert_drop.sim 1.7 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3

system sh/deploy.sh -n dnode1 -i 1
H
hjxilinx 已提交
4
system sh/cfg.sh -n dnode1 -c walLevel -v 1
S
slguan 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
system sh/exec.sh -n dnode1 -s start

sleep 3000
sql connect

$tbNum = 10
$rowNum = 10
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== insert_drop.sim
$i = 0
$db = iddb
$stb = stb

sql drop database $db -x step1
step1:
S
scripts  
slguan 已提交
22
sql create database $db maxtables 10 ctime 30
S
slguan 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
print ====== create tables
sql use $db
sql create table $stb (ts timestamp, c1 int) tags(t1 int)

$i = 0
$ts = $ts0
while $i < 10
  $tb = tb . $i
  sql create table $tb using $stb tags( $i )
 
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
    sql insert into $tb values ( $ts , $x ) 
    $x = $x + 1
  endw 
  $i = $i + 1
endw 
print ====== tables created

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
scripts  
Shengliang Guan 已提交
46
sleep 5000
S
slguan 已提交
47 48
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
guanshengliang's avatar
scripts  
guanshengliang 已提交
49 50 51

sql reset query cache
sleep 1000
S
slguan 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

sql use $db
sql drop table tb5

while $i < 4
  $tbId = $i + $halfNum
  $tb = $tbPrefix . $i
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
    sql insert into $tb values ( $ts , $x ) 
    $x = $x + 1
  endw 

  $i = $i + 1
endw 

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
scripts  
Shengliang Guan 已提交
72
sleep 5000
S
slguan 已提交
73 74
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
guanshengliang's avatar
scripts  
guanshengliang 已提交
75 76 77

sql reset query cache
sleep 1000
S
slguan 已提交
78 79

sql use $db
S
scripts  
slguan 已提交
80

S
slguan 已提交
81 82
sql create table tb5 using $stb tags(5)
sql select * from tb5
guanshengliang's avatar
scripts  
guanshengliang 已提交
83
print $rows should be 0
S
slguan 已提交
84 85 86 87
if $rows != 0 then
  return -1
endi

S
scripts  
slguan 已提交
88
system sh/exec.sh -n dnode1 -s stop -x SIGINT