rsmaPersistenceRecovery.sim 7.1 KB
Newer Older
1 2 3 4 5 6
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect

L
liuyao 已提交
7 8 9
#todo xukaili sma should use rocksdb.
return 1

10 11 12 13 14 15 16 17
print =============== create database with retentions
sql create database d0 retentions 5s:7d,5m:21d,15m:365d;
sql use d0

print =============== create super table and register rsma
sql create table if not exists stb (ts timestamp, c1 int, c2 float) tags (city binary(20),district binary(20)) rollup(max) max_delay 5s,5s watermark 2s,3s;

sql show stables
G
Ganlin Zhao 已提交
18
if $rows != 1 then
19 20 21 22 23 24 25
  return -1
endi

print =============== create child table
sql create table ct1 using stb tags("BeiJing", "ChaoYang");

sql show tables
G
Ganlin Zhao 已提交
26
if $rows != 1 then
27 28 29 30 31 32 33 34
  return -1
endi

print =============== insert data and trigger rollup
sql insert into ct1 values(now, 10, 10.0);
sql insert into ct1 values(now+1s, 1, 1.0);
sql insert into ct1 values(now+2s, 100, 100.0);

C
Cary Xu 已提交
35 36
print =============== wait maxdelay 5+2 seconds for results
sleep 7000
37 38 39 40

print =============== select * from retention level 2 from memory
sql select * from ct1;
print $data00 $data01 $data02
C
Cary Xu 已提交
41
print $data10 $data11 $data12
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
if $rows > 2 then
  print retention level 2 file rows $rows > 2
  return -1
endi


if $data01 != 100 then
  if $data01 != 10 then
    print retention level 2 file result $data01 != 100 or 10
  return -1
  endi
endi

print =============== select * from retention level 1 from memory
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
C
Cary Xu 已提交
58
print $data10 $data11 $data12
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
if $rows > 2 then
  print retention level 1 file rows $rows > 2
  return -1
endi

if $data01 != 100 then
  if $data01 != 10 then
    print retention level 1 file result $data01 != 100 or 10
  return -1
  endi
endi

print =============== select * from retention level 0 from memory
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22

if $rows < 1 then
  print retention level 0 file rows $rows < 1
  return -1
endi

if $data01 != 10 then
  print retention level 0 file result $data01 != 10
  return -1
endi

#===================================================================
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print =============== wait maxdelay 5+2 seconds for results after reboot
sleep 7000

print =============== select * from retention level 2 from memory after reboot
sql select * from ct1;
print $data00 $data01 $data02
print $data10 $data11 $data12
if $rows > 2 then
  print retention level 2 file rows $rows > 2
  return -1
endi


if $data01 != 100 then
  if $data01 != 10 then
    print retention level 2 file result $data01 != 100 or 10
  return -1
  endi
endi

print =============== select * from retention level 1 from memory after reboot
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
print $data10 $data11 $data12
if $rows > 2 then
  print retention level 1 file rows $rows > 2
  return -1
endi

if $data01 != 100 then
  if $data01 != 10 then
    print retention level 1 file result $data01 != 100 or 10
  return -1
  endi
endi

print =============== select * from retention level 0 from memory after reboot
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22

if $rows < 1 then
  print retention level 0 file rows $rows < 1
  return -1
endi

if $data01 != 10 then
  print retention level 0 file result $data01 != 10
  return -1
endi
141 142


143
#==================== flush database to trigger commit data to file
144
sql flush database d0;
145 146 147 148 149 150
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

print =============== select * from retention level 2 from file
sql select * from ct1;
print $data00 $data01 $data02
C
Cary Xu 已提交
151
print $data10 $data11 $data12
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
if $rows > 2 then
  print retention level 2 file rows $rows > 2
  return -1
endi

if $data01 != 100 then
  if $data01 != 10 then
    print retention level 2 file result $data01 != 100 or 10
  return -1
  endi
endi

print =============== select * from retention level 1 from file
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
C
Cary Xu 已提交
167
print $data10 $data11 $data12
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
if $rows > 2 then
  print retention level 1 file rows $rows > 2
  return -1
endi

if $data01 != 100 then
  if $data01 != 10 then
    print retention level 1 file result $data01 != 100 or 10
  return -1
  endi
endi

print =============== select * from retention level 0 from file
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
if $rows < 1 then
  print retention level 0 file rows $rows < 1
  return -1
endi

if $data01 != 10 then
  print retention level 0 file result $data01 != 10
  return -1
endi

print =============== insert after rsma qtaskinfo recovery
sql insert into ct1 values(now, 50, 500.0);
sql insert into ct1 values(now+1s, 40, 40.0);

C
Cary Xu 已提交
199 200
print =============== wait maxdelay 5+2 seconds for results
sleep 7000
201 202 203 204

print =============== select * from retention level 2 from file and memory after rsma qtaskinfo recovery
sql select * from ct1;
print $data00 $data01 $data02
C
Cary Xu 已提交
205
print $data10 $data11 $data12
206 207 208 209 210 211 212 213 214 215 216 217 218
if $rows > 2 then
  print retention level 2 file/mem rows $rows > 2
  return -1
endi

if $data01 != 100 then
  if $data01 != 10 then
    print retention level 2 file/mem result $data01 != 100 or 10
  return -1
  endi
endi

if $data02 != 500.00000 then
219 220
  if $data02 != 100.00000 then
    print retention level 1 file/mem result $data02 != 500.00000 or 100.00000
221 222 223 224 225 226 227
  return -1
  endi
endi

print =============== select * from retention level 1 from file and memory after rsma qtaskinfo recovery
sql select * from ct1 where ts > now-8d;
print $data00 $data01 $data02
C
Cary Xu 已提交
228
print $data10 $data11 $data12
229 230 231 232 233 234 235 236 237 238 239 240 241
if $rows > 2 then
  print retention level 1 file/mem rows $rows > 2
  return -1
endi

if $data01 != 100 then
  if $data01 != 10 then
    print retention level 1 file/mem result $data01 != 100 or 10
  return -1
  endi
endi

if $data02 != 500.00000 then
242 243
  if $data02 != 100.00000 then
    print retention level 1 file/mem result $data02 != 500.00000 or 100.00000
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
  return -1
  endi
endi


print =============== select * from retention level 0 from file and memory after rsma qtaskinfo recovery
sql select * from ct1 where ts > now-3d;
print $data00 $data01 $data02
print $data10 $data11 $data12
print $data20 $data21 $data22
print $data30 $data31 $data32
print $data40 $data41 $data42

if $rows < 1 then
  print retention level 0 file/mem rows $rows < 1
  return -1
endi

if $data01 != 10 then
  print retention level 0 file/mem result $data01 != 10
  return -1
endi

if $data11 != 1 then
  print retention level 0 file/mem result $data11 != 1
  return -1
endi

if $data21 != 100 then
  print retention level 0 file/mem result $data21 != 100
  return -1
endi

if $data31 != 50 then
  print retention level 0 file/mem result $data31 != 50
  return -1
endi

if $data32 != 500.00000 then
  print retention level 0 file/mem result $data32 != 500.00000
  return -1
endi


if $data41 != 40 then
  print retention level 0 file/mem result $data41 != 40
  return -1
endi

293 294
if $data42 != 40.00000 then
  print retention level 0 file/mem result $data42 != 40.00000
295 296 297 298 299
  return -1
endi



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