select_from_cache_disk.sim 1.6 KB
Newer Older
1 2 3 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/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
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
sleep 500
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql connect
sleep 100
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

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