tbnameIn.sim 1.9 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 0
S
slguan 已提交
5
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
6
sleep 100
S
slguan 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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 52 53 54 55 56 57
sql connect

$dbPrefix = ti_db
$tbPrefix = ti_tb
$stbPrefix = ti_stb
$tbNum = 2000
$rowNum = 10
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
$tsu = $rowNum * $delta
$tsu = $tsu - $delta
$tsu = $tsu + $ts0

print ========== tbnameIn.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i

sql drop database $db -x step1
step1:
sql create database $db 
print ====== create tables
sql use $db
sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double)

$i = 0
$ts = $ts0
$halfNum = $tbNum / 2
while $i < $halfNum
  $i1 = $i + $halfNum
  $tb = $tbPrefix . $i
  $tb1 = $tbPrefix . $i1
  $tgstr = 'tb . $i
  $tgstr = $tgstr . '
  $tgstr1 = 'tb . $i1
  $tgstr1 = $tgstr1 . '
  sql create table $tb using $stb tags( $i , $tgstr , $tgstr , $i , $i , $i )
  sql create table $tb1 using $stb tags( $i1 , $tgstr1 , $tgstr1 , $i , $i , $i )
 
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
    $c = $x / 10
    $c = $c * 10
    $c = $x - $c
    $binary = 'binary . $c 
    $binary = $binary . '
    $nchar = 'nchar . $c 
    $nchar = $nchar . '
H
Haojun Liao 已提交
58
    sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar )  $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar )
S
slguan 已提交
59 60 61 62 63 64 65
    $x = $x + 1
  endw 

  $i = $i + 1
endw 
print ====== tables created

S
scripts  
slguan 已提交
66
run general/parser/tbnameIn_query.sim
S
slguan 已提交
67 68 69

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
H
Haojun Liao 已提交
70
sleep 3000
S
slguan 已提交
71 72 73
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed

S
scripts  
slguan 已提交
74
run general/parser/tbnameIn_query.sim
S
scripts  
Shengliang Guan 已提交
75 76

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