auto_create_tb_drop_tb.sim 1.6 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2
system sh/deploy.sh -n dnode1 -i 1
H
hjxilinx 已提交
3
system sh/cfg.sh -n dnode1 -c walLevel -v 1
S
TD-1486  
Shengliang Guan 已提交
4
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
S
scripts  
Shengliang Guan 已提交
5
system sh/cfg.sh -n dnode1 -c ctime -v 30
S
slguan 已提交
6
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
7
sleep 500
S
slguan 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
sql connect

$dbPrefix = db
$tbPrefix = tb
$stbPrefix = stb
$tbNum = 5
$rowNum = 1361
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== auto_create_tb_drop_tb.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i

sql drop database $db -x step1
step1:
H
Haojun Liao 已提交
25
sql create database $db maxrows 200 cache 2
S
slguan 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
print ====== create tables
sql use $db

$i = 0
$ts = $ts0
$tb = $tbPrefix . $i
sql create table $stb (ts timestamp, c1 int) tags (t1 binary(10))
$x = 0
$t = 0
while $t < $tbNum
  $t1 = 'tb . $t
  $t1 = $t1 . '
  $tbname = tb . $t
  print t = $t
  print tbname = $tbname
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
    sql insert into $tbname using $stb tags( $t1 ) values ( $ts , $x ) 
    $x = $x + 1
  endw 
  $t = $t + 1
  $x = 0
endw
print ====== tables created

H
Haojun Liao 已提交
52
sleep 500
S
slguan 已提交
53 54 55 56 57 58 59 60 61

sql drop table tb2
$x = 0
while $x < $rowNum 
  $ts = $ts + $delta
  $t1 = 'tb . $t
  $t1 = $t1 . '
  sql insert into tb1 using $stb tags( $t1 ) values ( $ts , $x ) 
  $x = $x + 1
H
Haojun Liao 已提交
62
endw
S
slguan 已提交
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

$ts = $ts0 + $delta
$ts = $ts + 1

$x = 0
while $x < 100
  $ts = $ts + $delta
  sql insert into tb2 using stb0 tags('tb2') values ( $ts , 1)
  sql select * from tb2 
  $res = $x + 1
  if $rows != $res then
    return -1
  endi
  if $data01 != 1 then
    return -1
  endi
  $x = $x + 1
  print loop $x
endw
S
scripts  
Shengliang Guan 已提交
82 83

system sh/exec.sh -n dnode1 -s stop -x SIGINT