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 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
56 57 58 59 60 61 62 63 64 65 66 67
  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
68
if $rows != 2 then
69 70 71 72 73 74 75
  return -1
endi

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

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

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

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

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

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

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

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

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

sql select count(tbcol) from $mt
print ===> $data00
137
if $data00 != $totalNum then
138 139 140 141
  return -1
endi

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

print =============== step9
162 163 164 165 166 167 168 169 170 171 172 173
# 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
174 175

print =============== step10
176 177 178 179 180 181 182 183 184 185 186 187
# 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
#
188
print =============== step11
189 190 191 192 193 194 195 196 197
# 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
198 199 200 201

print =============== clear
sql drop database $db
sql show databases
202
if $rows != 2 then
203 204 205 206
  return -1
endi

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