insert2.sim 9.8 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4

system sh/deploy.sh -n dnode1 -i 1
S
scripts  
slguan 已提交
5
system sh/cfg.sh -n dnode1 -c wallevel -v 0
S
slguan 已提交
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
system sh/exec.sh -n dnode1 -s start

sleep 3000
sql connect

print ======== step1 
sql create database d4
sql use d4
sql create table tb (ts timestamp, a int, b smallint, c tinyint, d int, e bigint, f float, g double, h binary(10))
sql insert into tb values(now-28d, 1, 2, 3, 4, 5, 6, 7, 8)
sql select * from tb order by ts desc
if $rows != 1 then
  return -1
endi
if $data01 != 1 then
  return -1
endi
if $data02 != 2 then
  return -1
endi
if $data03 != 3 then
  return -1
endi
if $data04 != 4 then
  return -1
endi
if $data05 != 5 then
  return -1
endi
if $data06 != 6.00000 then
  return -1
endi
if $data07 != 7.000000000 then
  return -1
endi
if $data08 != 8 then
  return -1
endi

print ======== step2
sleep 2500
sql_error alter table tb add column b smallint
sql_error alter table tb add column b int
sql alter table tb drop column b
sql insert into tb values(now-25d, 2, 3, 4, 5, 6, 7, 8)
sleep 3000
sql select * from tb order by ts desc
if $rows != 2 then
  return -1
endi
if $data01 != 2 then
  return -1
endi
if $data02 != 3 then
  return -1
endi
if $data03 != 4 then
  return -1
endi
if $data04 != 5 then
  return -1
endi
if $data05 != 6.00000 then
  return -1
endi
if $data06 != 7.000000000 then
  return -1
endi
if $data07 != 8 then
  return -1
endi
77
if $data08 != NULL then
S
slguan 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  return -1
endi
if $data11 != 1 then
  return -1
endi
if $data12 != 3 then
  return -1
endi
if $data13 != 4 then
  return -1
endi
if $data14 != 5 then
  return -1
endi
if $data15 != 6.00000 then
  return -1
endi
if $data16 != 7.000000000 then
  return -1
endi
if $data17 != 8 then
  return -1
endi
101
if $data18 != NULL then
S
slguan 已提交
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
  return -1
endi

print ======== step3
sleep 2500
sql alter table tb drop column c
sql insert into tb values(now-22d, 3, 4, 5, 6, 7, 8)
sleep 3000
sql select * from tb order by ts desc
if $rows != 3 then
  return -1
endi
if $data01 != 3 then
  return -1
endi
if $data02 != 4 then
  return -1
endi
if $data03 != 5 then
  return -1
endi
if $data04 != 6.00000 then
  return -1
endi
if $data05 != 7.000000000 then
  return -1
endi
if $data06 != 8 then
  return -1
endi
132
if $data07 != NULL then
S
slguan 已提交
133 134
  return -1
endi
135
if $data08 != NULL then
S
slguan 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
  return -1
endi
if $data11 != 2 then
  return -1
endi
if $data12 != 4 then
  return -1
endi
if $data13 != 5 then
  return -1
endi
if $data14 != 6.00000 then
  return -1
endi
if $data15 != 7.000000000 then
  return -1
endi
if $data16 != 8 then
  return -1
endi
156
if $data17 != NULL then
S
slguan 已提交
157 158
  return -1
endi
159
if $data18 != NULL then
S
slguan 已提交
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
  return -1
endi
if $data21 != 1 then
  return -1
endi
if $data22 != 4 then
  return -1
endi
if $data23 != 5 then
  return -1
endi
if $data24 != 6.00000 then
  return -1
endi
if $data25 != 7.000000000 then
  return -1
endi
if $data26 != 8 then
  return -1
endi
180
if $data27 != NULL then
S
slguan 已提交
181 182
  return -1
endi
183
if $data28 != NULL then
S
slguan 已提交
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
  return -1
endi

print ======== step4
sleep 2500
sql alter table tb drop column d
sql alter table tb drop column e
sql insert into tb values(now-19d, -19, 6, 3, 0)
sleep 3000
sql select * from tb order by ts desc
if $rows != 4 then
  return -1
endi
if $data01 != -19 then
  return -1
endi
if $data02 != 6.00000 then
  return -1
endi
if $data03 != 3.000000000 then
  return -1
endi
if $data04 != 0 then
  return -1
endi
209
if $data05 != NULL then
S
slguan 已提交
210 211
  return -1
endi
212
if $data06 != NULL then
S
slguan 已提交
213 214
  return -1
endi
215
if $data07 != NULL then
S
slguan 已提交
216 217
  return -1
endi
218
if $data08 != NULL then
S
slguan 已提交
219 220 221 222 223 224 225 226 227 228 229 230 231 232
  return -1
endi
if $data11 != 3 then
  return -1
endi
if $data12 != 6.00000 then
  return -1
endi
if $data13 != 7.000000000 then
  return -1
endi
if $data14 != 8 then
  return -1
endi
233
if $data15 != NULL then
S
slguan 已提交
234 235
  return -1
endi
236
if $data16 != NULL then
S
slguan 已提交
237 238
  return -1
endi
239
if $data17 != NULL then
S
slguan 已提交
240 241
  return -1
endi
242
if $data18 != NULL then
S
slguan 已提交
243 244 245 246 247 248 249 250 251 252 253 254 255 256
  return -1
endi
if $data21 != 2 then
  return -1
endi
if $data22 != 6.00000 then
  return -1
endi
if $data23 != 7.000000000 then
  return -1
endi
if $data24 != 8 then
  return -1
endi
257
if $data25 != NULL then
S
slguan 已提交
258 259
  return -1
endi
260
if $data26 != NULL then
S
slguan 已提交
261 262
  return -1
endi
263
if $data27 != NULL then
S
slguan 已提交
264 265
  return -1
endi
266
if $data28 != NULL then
S
slguan 已提交
267 268 269 270 271 272 273 274 275 276 277 278 279 280
  return -1
endi
if $data31 != 1 then
  return -1
endi
if $data32 != 6.00000 then
  return -1
endi
if $data33 != 7.000000000 then
  return -1
endi
if $data34 != 8 then
  return -1
endi
281
if $data35 != NULL then
S
slguan 已提交
282 283
  return -1
endi
284
if $data36 != NULL then
S
slguan 已提交
285 286
  return -1
endi
287
if $data37 != NULL then
S
slguan 已提交
288 289
  return -1
endi
290
if $data38 != NULL then
S
slguan 已提交
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
  return -1
endi

print ======== step5
sleep 2500
sql alter table tb drop column g
sql insert into tb values(now-16d, -16, 9, 5)
sleep 3000
sql select count(f) from tb
if $data00 != 5 then
  return -1
endi
sql select * from tb order by ts desc
if $rows != 5 then
  return -1
endi
if $data01 != -16 then
  return -1
endi
if $data02 != 9.00000 then
  return -1
endi
if $data03 != 5 then
  return -1
endi
316
if $data04 != NULL then
S
slguan 已提交
317 318
  return -1
endi
319
if $data05 != NULL then
S
slguan 已提交
320 321
  return -1
endi
322
if $data06 != NULL then
S
slguan 已提交
323 324
  return -1
endi
325
if $data07 != NULL then
S
slguan 已提交
326 327
  return -1
endi
328
if $data08 != NULL then
S
slguan 已提交
329 330 331 332 333 334 335 336 337 338 339
  return -1
endi
if $data11 != -19 then
  return -1
endi
if $data12 != 6.00000 then
  return -1
endi
if $data13 != 0 then
  return -1
endi
340
if $data14 != NULL then
S
slguan 已提交
341 342
  return -1
endi
343
if $data15 != NULL then
S
slguan 已提交
344 345
  return -1
endi
346
if $data16 != NULL then
S
slguan 已提交
347 348
  return -1
endi
349
if $data17 != NULL then
S
slguan 已提交
350 351
  return -1
endi
352
if $data18 != NULL then
S
slguan 已提交
353 354 355 356 357 358 359 360 361 362 363
  return -1
endi
if $data21 != 3 then
  return -1
endi
if $data22 != 6.00000 then
  return -1
endi
if $data23 != 8 then
  return -1
endi
364
if $data24 != NULL then
S
slguan 已提交
365 366
  return -1
endi
367
if $data25 != NULL then
S
slguan 已提交
368 369
  return -1
endi
370
if $data26 != NULL then
S
slguan 已提交
371 372
  return -1
endi
373
if $data27 != NULL then
S
slguan 已提交
374 375
  return -1
endi
376
if $data28 != NULL then
S
slguan 已提交
377 378 379 380 381 382 383 384 385 386 387
  return -1
endi
if $data31 != 2 then
  return -1
endi
if $data32 != 6.00000 then
  return -1
endi
if $data33 != 8 then
  return -1
endi
388
if $data34 != NULL then
S
slguan 已提交
389 390
  return -1
endi
391
if $data35 != NULL then
S
slguan 已提交
392 393
  return -1
endi
394
if $data36 != NULL then
S
slguan 已提交
395 396
  return -1
endi
397
if $data37 != NULL then
S
slguan 已提交
398 399
  return -1
endi
400
if $data38 != NULL then
S
slguan 已提交
401 402 403 404 405 406 407 408 409 410 411
  return -1
endi
if $data41 != 1 then
  return -1
endi
if $data42 != 6.00000 then
  return -1
endi
if $data43 != 8 then
  return -1
endi
412
if $data44 != NULL then
S
slguan 已提交
413 414
  return -1
endi
415
if $data45 != NULL then
S
slguan 已提交
416 417
  return -1
endi
418
if $data46 != NULL then
S
slguan 已提交
419 420
  return -1
endi
421
if $data47 != NULL then
S
slguan 已提交
422 423
  return -1
endi
424
if $data48 != NULL then
S
slguan 已提交
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
  return -1
endi

print ======== step6
sleep 2500
sql alter table tb drop column f
sql insert into tb values(now-13d, -13, 7)
sleep 3000
sql select * from tb order by ts desc
if $rows != 6 then
  return -1
endi
if $data01 != -13 then
  return -1
endi
if $data11 != -16 then
  return -1
endi
if $data12 != 5 then
  return -1
endi
446
if $data03 != NULL then
S
slguan 已提交
447 448
  return -1
endi
449
if $data04 != NULL then
S
slguan 已提交
450 451
  return -1
endi
452
if $data05 != NULL then
S
slguan 已提交
453 454
  return -1
endi
455
if $data06 != NULL then
S
slguan 已提交
456 457
  return -1
endi
458
if $data07 != NULL then
S
slguan 已提交
459 460
  return -1
endi
461
if $data08 != NULL then
S
slguan 已提交
462 463 464 465 466 467 468 469
  return -1
endi
if $data21 != -19 then
  return -1
endi
if $data22 != 0 then
  return -1
endi
470
if $data23 != NULL then
S
slguan 已提交
471 472
  return -1
endi
473
if $data24 != NULL then
S
slguan 已提交
474 475
  return -1
endi
476
if $data25 != NULL then
S
slguan 已提交
477 478
  return -1
endi
479
if $data26 != NULL then
S
slguan 已提交
480 481
  return -1
endi
482
if $data27 != NULL then
S
slguan 已提交
483 484
  return -1
endi
485
if $data28 != NULL then
S
slguan 已提交
486 487 488 489 490 491 492 493
  return -1
endi
if $data31 != 3 then
  return -1
endi
if $data32 != 8 then
  return -1
endi
494
if $data33 != NULL then
S
slguan 已提交
495 496
  return -1
endi
497
if $data34 != NULL then
S
slguan 已提交
498 499
  return -1
endi
500
if $data35 != NULL then
S
slguan 已提交
501 502
  return -1
endi
503
if $data36 != NULL then
S
slguan 已提交
504 505
  return -1
endi
506
if $data37 != NULL then
S
slguan 已提交
507 508
  return -1
endi
509
if $data38 != NULL then
S
slguan 已提交
510 511 512 513 514 515 516 517
  return -1
endi
if $data41 != 2 then
  return -1
endi
if $data42 != 8 then
  return -1
endi
518
if $data43 != NULL then
S
slguan 已提交
519 520
  return -1
endi
521
if $data44 != NULL then
S
slguan 已提交
522 523
  return -1
endi
524
if $data45 != NULL then
S
slguan 已提交
525 526
  return -1
endi
527
if $data46 != NULL then
S
slguan 已提交
528 529
  return -1
endi
530
if $data47 != NULL then
S
slguan 已提交
531 532
  return -1
endi
533
if $data48 != NULL then
S
slguan 已提交
534 535 536 537 538 539 540 541
  return -1
endi
if $data51 != 1 then
  return -1
endi
if $data52 != 8 then
  return -1
endi
542
if $data53 != NULL then
S
slguan 已提交
543 544
  return -1
endi
545
if $data54 != NULL then
S
slguan 已提交
546 547
  return -1
endi
548
if $data55 != NULL then
S
slguan 已提交
549 550
  return -1
endi
551
if $data57 != NULL then
S
slguan 已提交
552 553
  return -1
endi
554
if $data58 != NULL then
S
slguan 已提交
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570
  return -1
endi

print ======== step7
sleep 2500
sql alter table tb drop column h
sql insert into tb values(now-10d, -10)
sleep 3000
sql select * from tb order by ts desc
if $rows != 7 then
  return -1
endi
print data01 = $data01
if $data01 != -10 then
  return -1
endi
571
if $data02 != NULL then
S
slguan 已提交
572 573
  return -1
endi
574
if $data03 != NULL then
S
slguan 已提交
575 576 577 578 579
  return -1
endi
if $data11 != -13 then
  return -1
endi
580
if $data12 != NULL then
S
slguan 已提交
581 582 583 584 585
  return -1
endi
if $data21 != -16 then
  return -1
endi
586
if $data22 != NULL then
S
slguan 已提交
587 588 589 590 591
  return -1
endi
if $data31 != -19 then
  return -1
endi
592
if $data32 != NULL then
S
slguan 已提交
593 594
  return -1
endi
595
if $data33 != NULL then
S
slguan 已提交
596 597 598 599 600
  return -1
endi
if $data41 != 3 then
  return -1
endi
601
if $data42 != NULL then
S
slguan 已提交
602 603 604 605 606
  return -1
endi
if $data51 != 2 then
  return -1
endi
607
if $data52 != NULL then
S
slguan 已提交
608 609
  return -1
endi
610
if $data53 != NULL then
S
slguan 已提交
611 612 613 614 615
  return -1
endi
if $data61 != 1 then
  return -1
endi
616
if $data62 != NULL then
S
slguan 已提交
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
  return -1
endi

sql_error alter table tb drop column a

print ======== step9
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 5000
system sh/exec.sh -n dnode1 -s start
sleep 5000

sql select * from tb order by ts desc
if $rows != 7 then
  return -1
endi
if $data01 != -10 then
  return -1
endi
635
if $data02 != NULL then
S
slguan 已提交
636 637
  return -1
endi
638
if $data03 != NULL then
S
slguan 已提交
639 640 641 642 643
  return -1
endi
if $data11 != -13 then
  return -1
endi
644
if $data12 != NULL then
S
slguan 已提交
645 646 647 648 649
  return -1
endi
if $data21 != -16 then
  return -1
endi
650
if $data22 != NULL then
S
slguan 已提交
651 652 653 654 655
  return -1
endi
if $data31 != -19 then
  return -1
endi
656
if $data32 != NULL then
S
slguan 已提交
657 658
  return -1
endi
659
if $data33 != NULL then
S
slguan 已提交
660 661 662 663 664
  return -1
endi
if $data41 != 3 then
  return -1
endi
665
if $data42 != NULL then
S
slguan 已提交
666 667 668 669 670
  return -1
endi
if $data51 != 2 then
  return -1
endi
671
if $data52 != NULL then
S
slguan 已提交
672 673
  return -1
endi
674
if $data53 != NULL then
S
slguan 已提交
675 676 677 678 679
  return -1
endi
if $data61 != 1 then
  return -1
endi
680
if $data62 != NULL then
S
slguan 已提交
681 682 683
  return -1
endi