interval.sim 4.5 KB
Newer Older
P
plum-lihui 已提交
1 2 3 4 5
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wal -v 1
system sh/exec.sh -n dnode1 -s start
P
plum-lihui 已提交
6
sleep 500
P
plum-lihui 已提交
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
sql connect

$dbPrefix = m_in_db
$tbPrefix = m_in_tb
$mtPrefix = m_in_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i

sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)

print ====== start create child tables and insert data
$i = 0
while $i < $tbNum
  $tb = $tbPrefix . $i
  sql create table $tb using $mt tags( $i )
C
cpwu 已提交
32

P
plum-lihui 已提交
33 34 35 36 37
  $x = 0
  while $x < $rowNum
    $cc = $x * 60000
    $ms = 1601481600000 + $cc

C
cpwu 已提交
38
    sql insert into $tb values ($ms , $x )
P
plum-lihui 已提交
39
    $x = $x + 1
C
cpwu 已提交
40 41
  endw

P
plum-lihui 已提交
42
  $i = $i + 1
C
cpwu 已提交
43
endw
P
plum-lihui 已提交
44 45 46 47 48 49

print =============== step2
$i = 1
$tb = $tbPrefix . $i

sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m)
P
plum-lihui 已提交
50 51
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m)
print ===> $rows $data01 $data05
C
cpwu 已提交
52
if $rows != $rowNum then
P
plum-lihui 已提交
53 54
  return -1
endi
C
cpwu 已提交
55
if $data00 != 1 then
P
plum-lihui 已提交
56 57
  return -1
endi
C
cpwu 已提交
58
if $data04 != 1 then
P
plum-lihui 已提交
59 60 61
  return -1
endi

C
cpwu 已提交
62
print =============== step3
P
plum-lihui 已提交
63 64 65 66 67
#$cc = 4 * 60000
#$ms = 1601481600000 + $cc
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb  where ts <= $ms interval(1m)
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb  where ts <= $ms interval(1m)
#print ===> $rows $data01 $data05
C
cpwu 已提交
68
#if $rows != 5 then
P
plum-lihui 已提交
69 70
#  return -1
#endi
C
cpwu 已提交
71
#if $data00 != 1 then
P
plum-lihui 已提交
72 73
#  return -1
#endi
C
cpwu 已提交
74
#if $data04 != 1 then
P
plum-lihui 已提交
75 76 77
#  return -1
#endi

C
cpwu 已提交
78
print =============== step4
P
plum-lihui 已提交
79 80 81 82 83 84
#$cc = 40 * 60000
#$ms = 1601481600000 + $cc

#$cc = 1 * 60000
#$ms2 = 1601481600000 - $cc

C
cpwu 已提交
85 86 87 88 89 90 91 92 93 94 95 96
sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb  interval(1m)
print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb  interval(1m)
print ===> $rows $data01 $data05
if $rows != $rowNum then
  return -1
endi
if $data05 != 1 then
  return -1
endi
if $data02 != 60000 then
  return -1
endi
P
plum-lihui 已提交
97 98 99 100 101 102 103 104 105 106 107

#print =============== step5
#$cc = 40 * 60000
#$ms = 1601481600000 + $cc

#$cc = 1 * 60000
#$ms2 = 1601481600000 - $cc

#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb  where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb  where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
#print ===> $rows $data21 $data25
C
cpwu 已提交
108
#if $rows != 42 then
P
plum-lihui 已提交
109 110
#  return -1
#endi
C
cpwu 已提交
111
#if $data20 != 1 then
P
plum-lihui 已提交
112 113
#  return -1
#endi
C
cpwu 已提交
114
#if $data24 != 1 then
P
plum-lihui 已提交
115 116 117 118 119 120 121
#  return -1
#endi

#print =============== step6
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m)
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m)
#print ===> $rows $data11
C
cpwu 已提交
122
#if $rows != 20 then
P
plum-lihui 已提交
123 124
#  return -1
#endi
C
cpwu 已提交
125
#if $data11 != 10 then
P
plum-lihui 已提交
126 127 128 129 130 131 132 133 134
#  return -1
#endi

#print =============== step7
#$cc = 4 * 60000
#$ms = 1601481600000 + $cc
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt  where ts <= $ms interval(1m)
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt  where ts <= $ms interval(1m)
#print ===> $rows $data11
C
cpwu 已提交
135
#if $rows != 5 then
P
plum-lihui 已提交
136 137
#  return -1
#endi
C
cpwu 已提交
138
#if $data11 != 10 then
P
plum-lihui 已提交
139 140 141 142 143 144 145 146 147 148 149 150 151
#  return -1
#endi

#print =============== step8
#$cc = 40 * 60000
#$ms1 = 1601481600000 + $cc
#
#$cc = 1 * 60000
#$ms2 = 1601481600000 - $cc
#
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt  where ts <= $ms1 and ts > $ms2 interval(1m)
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt  where ts <= $ms1 and ts > $ms2 interval(1m)
#print ===> $rows $data11
C
cpwu 已提交
152
#if $rows != 20 then
P
plum-lihui 已提交
153 154
#  return -1
#endi
C
cpwu 已提交
155
#if $data11 != 10 then
P
plum-lihui 已提交
156 157 158 159 160 161 162 163 164 165 166 167 168
#  return -1
#endi
#
#print =============== step9
#$cc = 40 * 60000
#$ms1 = 1601481600000 + $cc
#
#$cc = 1 * 60000
#$ms2 = 1601481600000 - $cc
#
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt  where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0)
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt  where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0)
#print ===> $rows $data11
C
cpwu 已提交
169
#if $rows != 42 then
P
plum-lihui 已提交
170 171
#  return -1
#endi
C
cpwu 已提交
172
#if $data11 != 10 then
P
plum-lihui 已提交
173 174
#  return -1
#endi
P
plum-lihui 已提交
175 176

print =============== clear
P
plum-lihui 已提交
177 178
#sql drop database $db
#sql show databases
C
cpwu 已提交
179
#if $rows != 0 then
P
plum-lihui 已提交
180 181
#  return -1
#endi
P
plum-lihui 已提交
182

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