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

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

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

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

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

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

print =============== step3
81 82 83 84 85 86
# TODO : where condition
# sql select count(tbcol) from $tb where ts <= 1519833840000
# print ===> $data00
# if $data00 != 5 then
#   return -1
# endi
87 88 89 90

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

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

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

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

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

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

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

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

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

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

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