insert_drop.sim 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
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
Shengliang Guan 已提交
18
sql create database $db
19 20 21 22 23 24 25 26 27
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 )
G
Ganlin Zhao 已提交
28

29 30 31 32
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
G
Ganlin Zhao 已提交
33
    sql insert into $tb values ( $ts , $x )
34
    $x = $x + 1
G
Ganlin Zhao 已提交
35
  endw
36
  $i = $i + 1
G
Ganlin Zhao 已提交
37
endw
38 39 40 41 42 43 44 45 46 47 48
print ====== tables created

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed

sql use $db
sql drop table tb5
$i = 0
while $i < 4
G
Ganlin Zhao 已提交
49

50 51 52 53 54
  $tb = tb . $i
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
G
Ganlin Zhao 已提交
55
    sql insert into $tb values ( $ts , $x )
56
    $x = $x + 1
G
Ganlin Zhao 已提交
57
  endw
58 59

  $i = $i + 1
G
Ganlin Zhao 已提交
60
endw
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed

sql use $db

sql create table tb5 using $stb tags(5)
sql select * from tb5
print $rows should be 0
if $rows != 0 then
  return -1
endi

G
Ganlin Zhao 已提交
76
system sh/exec.sh -n dnode1 -s stop -x SIGINT