3.sim 15.4 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2
system sh/deploy.sh -n dnode1 -i 1
3
system sh/cfg.sh -n dnode1 -c walLevel -v 1
S
slguan 已提交
4 5
system sh/exec.sh -n dnode1 -s start

H
Haojun Liao 已提交
6
sleep 2000
S
slguan 已提交
7 8 9
sql connect
print ======================== dnode1 start

guanshengliang's avatar
scripts  
guanshengliang 已提交
10 11 12
$dbPrefix = db
$tbPrefix = tb
$mtPrefix = mt
S
slguan 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
$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, tbcol1 smallint, tbcol2 int, tbcol3 float) TAGS(tgcol1 smallint, tgcol2 int, tgcol3 float)

$i = 0
while $i < 5
  $tb = $tbPrefix . $i
  sql create table $tb using $mt tags( 0, 0, 0 )  
  $x = 0
  while $x < $rowNum
    $ms = $x . m 
33
    sql insert into $tb values (1626739200000 + $ms , 0, 0, 0 ) 
S
slguan 已提交
34 35 36 37 38 39 40 41 42 43
    $x = $x + 1
  endw  
  $i = $i + 1
endw 
while $i < 10
  $tb = $tbPrefix . $i
  sql create table $tb using $mt tags( 1, 1, 1 )  
  $x = 0
  while $x < $rowNum
    $ms = $x . m 
44
    sql insert into $tb values (1626739200000 + $ms , 1, 1, 1 ) 
S
slguan 已提交
45 46 47 48 49 50 51 52 53 54 55
    $x = $x + 1
  endw  
  $i = $i + 1
endw 

print =============== step2
sql select * from $mt
if $rows != $totalNum then 
  return -1
endi

56
sql select * from $mt where ts <= 1626739440001
S
slguan 已提交
57 58 59
if $rows != 50 then 
  return -1
endi
60
sql select * from $mt where ts > 1626739440001
S
slguan 已提交
61 62 63
if $rows != 150 then 
  return -1
endi
64
sql select * from $mt where ts = 1626739440001
S
slguan 已提交
65 66 67
if $rows != 0 then 
  return -1
endi
68
sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001
S
slguan 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 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 141 142 143
if $rows != 10 then 
  return -1
endi

print =============== step3
sql select * from $mt where tbcol1 = 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 <> 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 = 1
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 <> 1
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 = 1
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 <> 1
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 = 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol1 <> 0
if $rows != 100 then 
  return -1
endi

print =============== step4
sql select * from $mt where tbcol2 = 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol2 <> 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol2 = 1
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol2 <> 1
if $rows != 100 then 
  return -1
endi

print =============== step5
sql select * from $mt where tbcol3 = 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol3 <> 0
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol3 = 1
if $rows != 100 then 
  return -1
endi
sql select * from $mt where tbcol3 <> 1
if $rows != 100 then 
  return -1
endi

print =============== step6
144
sql select * from $mt where ts > 1626739440001 and tbcol1 = 1
S
slguan 已提交
145 146 147
if $rows != 75 then 
  return -1
endi
148
sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1
S
slguan 已提交
149 150 151
if $rows != 75 then 
  return -1
endi
152
sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
S
slguan 已提交
153 154 155
if $rows != 25 then 
  return -1
endi
156
sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
S
slguan 已提交
157 158 159
if $rows != 25 then 
  return -1
endi
160
sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
S
slguan 已提交
161 162 163
if $rows != 25 then 
  return -1
endi
164
sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
S
slguan 已提交
165 166 167
if $rows != 25 then 
  return -1
endi
168
sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol1 <> 0
S
slguan 已提交
169 170 171
if $rows != 5 then 
  return -1
endi
172
sql select * from $mt where ts >= 1626739440001 and tbcol1 <> 0 and ts < 1626739500001
S
slguan 已提交
173 174 175 176 177
if $rows != 5 then 
  return -1
endi

print =============== step7
178
sql select * from $mt where ts > 1626739440001 and tbcol2 = 1
S
slguan 已提交
179 180 181
if $rows != 75 then 
  return -1
endi
182
sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1
S
slguan 已提交
183 184 185
if $rows != 75 then 
  return -1
endi
186
sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
S
slguan 已提交
187 188 189
if $rows != 25 then 
  return -1
endi
190
sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
S
slguan 已提交
191 192 193
if $rows != 25 then 
  return -1
endi
194
sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
S
slguan 已提交
195 196 197
if $rows != 25 then 
  return -1
endi
198
sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
S
slguan 已提交
199 200 201
if $rows != 25 then 
  return -1
endi
202
sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0
S
slguan 已提交
203 204 205
if $rows != 5 then 
  return -1
endi
206
sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001
S
slguan 已提交
207 208 209 210 211
if $rows != 5 then 
  return -1
endi

print =============== step8
212
sql select * from $mt where ts > 1626739440001 and tbcol3 = 1
S
slguan 已提交
213 214 215
if $rows != 75 then 
  return -1
endi
216
sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1
S
slguan 已提交
217 218 219
if $rows != 75 then 
  return -1
endi
220
sql select * from $mt where ts < 1626739440001 and tbcol3 = 0
S
slguan 已提交
221 222 223
if $rows != 25 then 
  return -1
endi
224
sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0
S
slguan 已提交
225 226 227
if $rows != 25 then 
  return -1
endi
228
sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0
S
slguan 已提交
229 230 231
if $rows != 25 then 
  return -1
endi
232
sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0
S
slguan 已提交
233 234 235
if $rows != 25 then 
  return -1
endi
236
sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol3 <> 0
S
slguan 已提交
237 238 239
if $rows != 5 then 
  return -1
endi
240
sql select * from $mt where ts >= 1626739440001 and tbcol3 <> 0 and ts < 1626739500001
S
slguan 已提交
241 242 243 244 245
if $rows != 5 then 
  return -1
endi

print =============== step9
246
sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1
S
slguan 已提交
247 248 249
if $rows != 75 then 
  return -1
endi
250
sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1
S
slguan 已提交
251 252 253
if $rows != 75 then 
  return -1
endi
254
sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0
S
slguan 已提交
255 256 257
if $rows != 25 then 
  return -1
endi
258
sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
S
slguan 已提交
259 260 261
if $rows != 25 then 
  return -1
endi
262
sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0
S
slguan 已提交
263 264 265
if $rows != 25 then 
  return -1
endi
266
sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
S
slguan 已提交
267 268 269
if $rows != 25 then 
  return -1
endi
270
sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0
S
slguan 已提交
271 272 273
if $rows != 5 then 
  return -1
endi
274
sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
S
slguan 已提交
275 276 277 278 279
if $rows != 5 then 
  return -1
endi

print =============== step10
280
sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol1 = 1
S
slguan 已提交
281 282 283
if $rows != 75 then 
  return -1
endi
284
sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol1 <> 1
S
slguan 已提交
285 286 287
if $rows != 75 then 
  return -1
endi
288
sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol1 = 0
S
slguan 已提交
289 290 291
if $rows != 25 then 
  return -1
endi
292
sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0
S
slguan 已提交
293 294 295
if $rows != 25 then 
  return -1
endi
296
sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol1 = 0
S
slguan 已提交
297 298 299
if $rows != 25 then 
  return -1
endi
300
sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0
S
slguan 已提交
301 302 303
if $rows != 25 then 
  return -1
endi
304
sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol1 <> 0
S
slguan 已提交
305 306 307
if $rows != 5 then 
  return -1
endi
308
sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
S
slguan 已提交
309 310 311 312 313
if $rows != 5 then 
  return -1
endi

print =============== step11
314
sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1
S
slguan 已提交
315 316 317
if $rows != 75 then 
  return -1
endi
318
sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1
S
slguan 已提交
319 320 321
if $rows != 75 then 
  return -1
endi
322
sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0
S
slguan 已提交
323 324 325
if $rows != 25 then 
  return -1
endi
326
sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
S
slguan 已提交
327 328 329
if $rows != 25 then 
  return -1
endi
330
sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0
S
slguan 已提交
331 332 333
if $rows != 25 then 
  return -1
endi
334
sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
S
slguan 已提交
335 336 337
if $rows != 25 then 
  return -1
endi
338
sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0
S
slguan 已提交
339 340 341
if $rows != 5 then 
  return -1
endi
342
sql select * from $mt where ts >= 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0
S
slguan 已提交
343 344 345 346 347
if $rows != 5 then 
  return -1
endi

print =============== step12
348
sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
S
slguan 已提交
349 350 351
if $rows != 75 then 
  return -1
endi
352
sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1  and tbcol3 <> 1
S
slguan 已提交
353 354 355
if $rows != 75 then 
  return -1
endi
356
sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
S
slguan 已提交
357 358 359
if $rows != 25 then 
  return -1
endi
360
sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
S
slguan 已提交
361 362 363
if $rows != 25 then 
  return -1
endi
364
sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
S
slguan 已提交
365 366 367
if $rows != 25 then 
  return -1
endi
368
sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
S
slguan 已提交
369 370 371
if $rows != 25 then 
  return -1
endi
372
sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0  and tbcol3 <> 0
S
slguan 已提交
373 374 375
if $rows != 5 then 
  return -1
endi
376
sql select * from $mt where ts >= 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0  and tbcol3 <> 0
S
slguan 已提交
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
if $rows != 5 then 
  return -1
endi

print =============== step13
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 200 then 
  return -1
endi

print =============== step14
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

print =============== step15
408
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts <= 1626739440001
S
slguan 已提交
409 410 411 412 413
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 50 then 
  return -1
endi

414
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1
S
slguan 已提交
415 416 417 418 419
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

420
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 
S
slguan 已提交
421 422 423 424 425
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

426
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
S
slguan 已提交
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

print =============== step16
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

print =============== step17
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1  group by tgcol1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 100 then 
  return -1
endi

print =============== step18
471
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2
S
slguan 已提交
472 473 474 475 476
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

477
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2
S
slguan 已提交
478 479 480 481 482
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

483
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1  group by tgcol2
S
slguan 已提交
484 485 486 487 488
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

489
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2
S
slguan 已提交
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data00 != 25 then 
  return -1
endi

print =============== step19
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data01 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data01 != 100 then 
  return -1
endi

sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 
if $data01 != 100 then 
  return -1
endi

print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then 
  return -1
guanshengliang's avatar
scripts  
guanshengliang 已提交
519 520 521
endi

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