disk.sim 4.1 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
system sh/stop_dnodes.sh


system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start

sleep 2000
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 )
35

36 37 38
  $x = 0
  while $x < $rowNum
    $val = $x * 60000
39 40
    $ms = 1519833600000 + $val
    sql insert into $tb values ($ms , $x )
41
    $x = $x + 1
42 43
  endw

44
  $i = $i + 1
45
endw
46 47 48

sql show vgroups
print vgroups ==> $rows
49
if $rows != 2 then
50 51 52
  return -1
endi

53 54 55
sql select count(tbcol) from $mt
print select count(tbcol) from $mt ===> $data00
if $data00 != $totalNum then
H
Haojun Liao 已提交
56
  print expect $totalNum , actual: $data00
57 58 59 60 61 62 63 64 65 66 67 68
  return -1
endi

sleep 1000
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 3000
system sh/exec.sh -n dnode1 -s start
sleep 6000

sql use $db
sql show vgroups
print vgroups ==> $rows
69
if $rows != 2 then
70 71 72 73 74 75 76
  return -1
endi

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

77
sql select count(tbcol) from $tb
78
print ===> $data00
79
if $data00 != $rowNum then
80 81 82 83 84
  return -1
endi

sql select count(tbcol) from $tb
print ===> $data00
85
if $data00 != $rowNum then
86 87 88 89
  return -1
endi

print =============== step3
90 91 92 93 94 95
# TODO : where condition
# sql select count(tbcol) from $tb where ts <= 1519833840000
# print ===> $data00
# if $data00 != 5 then
#   return -1
# endi
96 97 98 99

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

print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
106 107
print ===> $data00
if $data00 != 1 then
108 109 110 111
  return -1
endi

sql select count(tbcol) as b from $tb interval(1d)
112 113
print ===> $data00
if $data00 != $rowNum then
114 115 116 117
  return -1
endi

print =============== step6
118 119 120 121 122 123 124 125 126
# TODO
# 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
127 128

print =============== step7
129 130 131 132 133 134
# TODO
# sql select count(*) from $mt
# print select count(*) from $mt ===> $data00
# if $data00 != $totalNum then
#   return -1
# endi
135

136 137 138 139 140 141 142
# TODO
# 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
143 144

print =============== step8
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
# TODO
# 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
163 164

print =============== step9
165 166 167 168 169 170 171 172 173 174 175 176
# TODO : count from stable
# sql select count(tbcol) as b from $mt interval(1m)
# print select count(tbcol) as b from $mt interval(1m) ===> $data01
# if $data01 != 10 then
#   return -1
# endi

# sql select count(tbcol) as b from $mt interval(1d)
# print ===> $data02
# if $data01 != 200 then
#   return -1
# endi
177 178

print =============== step10
179 180 181 182 183 184 185 186 187 188 189 190
# TODO
# 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
#
191
print =============== step11
192 193 194 195 196 197 198 199 200
# TODO : where condition
# sql select count(tbcol) as b from $mt  where ts <= 1519833840000 interval(1m) group by tgcol
# print ===> $data01
# if $data01 != 1 then
#   return -1
# endi
# if $rows != 50 then
#   return -1
# endi
201 202 203 204

print =============== clear
sql drop database $db
sql show databases
205
if $rows != 2 then
206 207 208 209
  return -1
endi

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