disk.sim 3.7 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
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

print ======================== dnode1 start
$dbPrefix = d_db
$tbPrefix = d_tb
$mtPrefix = d_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

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

sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)

$i = 0
while $i < $tbNum
  $tb = $tbPrefix . $i
  sql create table $tb using $mt tags( $i )
27

28 29 30
  $x = 0
  while $x < $rowNum
    $val = $x * 60000
31 32
    $ms = 1519833600000 + $val
    sql insert into $tb values ($ms , $x )
33
    $x = $x + 1
34 35
  endw

36
  $i = $i + 1
37
endw
38 39 40

sql show vgroups
print vgroups ==> $rows
41
if $rows != 2 then
42 43 44
  return -1
endi

45 46 47
sql select count(tbcol) from $mt
print select count(tbcol) from $mt ===> $data00
if $data00 != $totalNum then
H
Haojun Liao 已提交
48
  print expect $totalNum , actual: $data00
49 50 51 52 53
  return -1
endi

system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
S
Shengliang Guan 已提交
54
sql connect
55 56 57 58

sql use $db
sql show vgroups
print vgroups ==> $rows
59
if $rows != 2 then
60 61 62 63 64 65 66
  return -1
endi

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

67
sql select count(tbcol) from $tb
68
print ===> $data00
69
if $data00 != $rowNum then
70 71 72 73 74
  return -1
endi

sql select count(tbcol) from $tb
print ===> $data00
75
if $data00 != $rowNum then
76 77 78 79
  return -1
endi

print =============== step3
S
Shengliang Guan 已提交
80 81 82 83 84
sql select count(tbcol) from $tb where ts <= 1519833840000
print ===> $data00
if $data00 != 5 then
  return -1
endi
85 86 87 88

print =============== step4
sql select count(tbcol) as b from $tb
print ===> $data00
89
if $data00 != $rowNum then
90 91 92 93 94
  return -1
endi

print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
95 96
print ===> $data00
if $data00 != 1 then
97 98 99 100
  return -1
endi

sql select count(tbcol) as b from $tb interval(1d)
101 102
print ===> $data00
if $data00 != $rowNum then
103 104 105 106
  return -1
endi

print =============== step6
S
Shengliang Guan 已提交
107 108 109 110 111 112 113 114
sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m)
print ===> $data00
if $data00 != 1 then
  return -1
endi
if $rows != 5 then
  return -1
endi
115 116

print =============== step7
S
Shengliang Guan 已提交
117 118 119 120 121 122 123 124 125 126 127 128
sql select count(*) from $mt
print select count(*) from $mt ===> $data00
if $data00 != $totalNum then
  return -1
endi

print ==========> block opt will cause this crash, table scan need to fix this during plan gen ===============>
sql select count(tbcol) from $mt
print ===> $data00
if $data00 != $totalNum then
  return -1
endi
129 130

print =============== step8
S
Shengliang Guan 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
sql select count(tbcol) as c from $mt where ts <= 1519833840000
print ===> $data00
if $data00 != 50 then
  return -1
endi

sql select count(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 100 then
  return -1
endi

sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000
print ===> $data00
if $data00 != 25 then
  return -1
endi
148 149

print =============== step9
S
Shengliang Guan 已提交
150 151 152 153 154 155 156 157 158 159 160
sql select count(tbcol) as b from $mt interval(1m)
print select count(tbcol) as b from $mt interval(1m) ===> $data01
if $data00 != 10 then
  return -1
endi

sql select count(tbcol) as b from $mt interval(1d)
print ===> $data02
if $data00 != 200 then
  return -1
endi
161 162

print =============== step10
S
Shengliang Guan 已提交
163 164 165 166 167 168 169 170 171 172 173
print select count(tbcol) as b from $mt group by tgcol
sql select count(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != $rowNum then
  return -1
endi

if $rows != $tbNum then
  return -1
endi

174
print =============== step11
S
Shengliang Guan 已提交
175 176 177 178 179 180 181 182
sql select count(tbcol) as b from $mt  where ts <= 1519833840000 partition by tgcol interval(1m)
print ===> $data01
if $data00 != 1 then
  return -1
endi
if $rows != 50 then
  return -1
endi
183 184 185

print =============== clear
sql drop database $db
X
Xiaoyu Wang 已提交
186
sql select * from information_schema.ins_databases
187
if $rows != 2 then
188 189 190
  return -1
endi

G
Ganlin Zhao 已提交
191
system sh/exec.sh -n dnode1 -s stop -x SIGINT