disk.sim 3.9 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
80 81 82 83 84 85
# TODO : where condition
# sql select count(tbcol) from $tb where ts <= 1519833840000
# print ===> $data00
# if $data00 != 5 then
#   return -1
# endi
86 87 88 89

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

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

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

print =============== step6
108 109 110 111 112 113 114 115 116
# 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
117 118

print =============== step7
119 120 121 122 123 124
# TODO
# sql select count(*) from $mt
# print select count(*) from $mt ===> $data00
# if $data00 != $totalNum then
#   return -1
# endi
125

126 127 128 129 130 131 132
# 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
133 134

print =============== step8
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
# 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
153 154

print =============== step9
155 156 157 158 159 160 161 162 163 164 165 166
# 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
167 168

print =============== step10
169 170 171 172 173 174 175 176 177 178 179 180
# 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
#
181
print =============== step11
182 183 184 185 186 187 188 189 190
# 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
191 192 193 194

print =============== clear
sql drop database $db
sql show databases
195
if $rows != 2 then
196 197 198 199
  return -1
endi

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