select_from_cache_disk.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 0
S
scripts  
slguan 已提交
5
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2
S
slguan 已提交
6
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
7
sleep 100
S
slguan 已提交
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
sql connect

$dbPrefix = scd_db
$tbPrefix = scd_tb
$stbPrefix = scd_stb
$tbNum = 20
$rowNum = 10
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== select_from_cache_disk.sim
$i = 0
$db = $dbPrefix
$stb = $stbPrefix
$tb = $tbPrefix

sql drop database if exists $db
sql create database $db
sql use $db
print ====== create tables
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
sql create table $tb using $stb tags( 1 )
# generate some data on disk
sql insert into $tb values ('2018-09-17 09:00:00.000', 0)
sql insert into $tb values ('2018-09-17 09:00:00.010', 1)
sql insert into $tb values ('2018-09-17 09:00:00.020', 2)
sql insert into $tb values ('2018-09-17 09:00:00.030', 3)

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
H
Haojun Liao 已提交
38
sleep 3000
S
slguan 已提交
39 40 41
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql connect
H
Haojun Liao 已提交
42
sleep 100
S
slguan 已提交
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 68 69
sql use $db

# generate some data in cache
sql insert into $tb values ('2018-09-17 09:00:04.000', 4)
sql insert into $tb values ('2018-09-17 09:00:04.010', 5)
sql select count(*) from $stb interval(1s) group by t1
if $rows != 2 then
  return -1
endi
if $data00 != @18-09-17 09:00:00.000@ then
  return -1
endi
if $data01 != 4 then
  return -1
endi
if $data02 != 1 then
  return -1
endi
if $data10 != @18-09-17 09:00:04.000@ then
  return -1
endi
if $data11 != 2 then
  return -1
endi
if $data12 != 1 then
  return -1
endi
S
scripts  
Shengliang Guan 已提交
70 71

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