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

system sh/deploy.sh -n dnode1 -i 1
S
slguan 已提交
4 5 6 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 58 59 60 61 62 63 64 65 66 67
system sh/cfg.sh -n dnode1 -c commitLog -v 0
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect

$dbPrefix = ts_db
$tbPrefix = ts_tb
$stbPrefix = ts_stb
$tbNum = 10
$rowNum = 300
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== timestamp.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i

sql drop database if exists $db
sql create database $db rows 200 cache 1024 tblocks 200 tables 4
print ====== create tables
sql use $db
sql create table $stb (ts timestamp, c1 timestamp, c2 int) tags(t1 binary(20))

$i = 0
$ts = $ts0
$halfNum = $tbNum / 2
while $i < $tbNum
  $tb = $tbPrefix . $i
  $t1 = ' . $tb
  $t1 = $t1 . '
  sql create table $tb using $stb tags( $t1 )
 
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
    $c = $x / 10
    $c = $c * 10
    $c = $x - $c
    $binary = binary . $c
    $nchar = '涛思nchar . $c
    $nchar = $nchar . '
    sql insert into $tb values ( $ts , $ts , $c ) 
    $x = $x + 1
  endw 
  $ts = $ts + $delta
  sql insert into $tb values ( $ts , null, null )
  $i = $i + 1
endw
print ====== $db tables created
  
run lite/parser/timestamp_query.sim

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

run lite/parser/timestamp_query.sim