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

S
slguan 已提交
3
system sh/deploy.sh -n dnode1 -i 1
S
Shengliang Guan 已提交
4
system sh/cfg.sh -n dnode1 -c wallevel -v 2
S
slguan 已提交
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 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
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
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)
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
S
Shengliang Guan 已提交
74
if $data08 != null then
S
slguan 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  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
S
Shengliang Guan 已提交
98
if $data18 != null then
S
slguan 已提交
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
  return -1
endi

print ======== step3
sql alter table tb drop column c
sql insert into tb values(now-22d, 3, 4, 5, 6, 7, 8)
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
S
Shengliang Guan 已提交
127
if $data07 != null then
S
slguan 已提交
128 129
  return -1
endi
S
Shengliang Guan 已提交
130
if $data08 != null then
S
slguan 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
  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
S
Shengliang Guan 已提交
151
if $data17 != null then
S
slguan 已提交
152 153
  return -1
endi
S
Shengliang Guan 已提交
154
if $data18 != null then
S
slguan 已提交
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
  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
S
Shengliang Guan 已提交
175
if $data27 != null then
S
slguan 已提交
176 177
  return -1
endi
S
Shengliang Guan 已提交
178
if $data28 != null then
S
slguan 已提交
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
  return -1
endi

print ======== step4
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)
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
S
Shengliang Guan 已提交
202
if $data05 != null then
S
slguan 已提交
203 204
  return -1
endi
S
Shengliang Guan 已提交
205
if $data06 != null then
S
slguan 已提交
206 207
  return -1
endi
S
Shengliang Guan 已提交
208
if $data07 != null then
S
slguan 已提交
209 210
  return -1
endi
S
Shengliang Guan 已提交
211
if $data08 != null then
S
slguan 已提交
212 213 214 215 216 217 218 219 220 221 222 223 224 225
  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
S
Shengliang Guan 已提交
226
if $data15 != null then
S
slguan 已提交
227 228
  return -1
endi
S
Shengliang Guan 已提交
229
if $data16 != null then
S
slguan 已提交
230 231
  return -1
endi
S
Shengliang Guan 已提交
232
if $data17 != null then
S
slguan 已提交
233 234
  return -1
endi
S
Shengliang Guan 已提交
235
if $data18 != null then
S
slguan 已提交
236 237 238 239 240 241 242 243 244 245 246 247 248 249
  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
S
Shengliang Guan 已提交
250
if $data25 != null then
S
slguan 已提交
251 252
  return -1
endi
S
Shengliang Guan 已提交
253
if $data26 != null then
S
slguan 已提交
254 255
  return -1
endi
S
Shengliang Guan 已提交
256
if $data27 != null then
S
slguan 已提交
257 258
  return -1
endi
S
Shengliang Guan 已提交
259
if $data28 != null then
S
slguan 已提交
260 261 262 263 264 265 266 267 268 269 270 271 272 273
  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
S
Shengliang Guan 已提交
274
if $data35 != null then
S
slguan 已提交
275 276
  return -1
endi
S
Shengliang Guan 已提交
277
if $data36 != null then
S
slguan 已提交
278 279
  return -1
endi
S
Shengliang Guan 已提交
280
if $data37 != null then
S
slguan 已提交
281 282
  return -1
endi
S
Shengliang Guan 已提交
283
if $data38 != null then
S
slguan 已提交
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
  return -1
endi

print ======== step5
sql alter table tb drop column g
sql insert into tb values(now-16d, -16, 9, 5)
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
S
Shengliang Guan 已提交
307
if $data04 != null then
S
slguan 已提交
308 309
  return -1
endi
S
Shengliang Guan 已提交
310
if $data05 != null then
S
slguan 已提交
311 312
  return -1
endi
S
Shengliang Guan 已提交
313
if $data06 != null then
S
slguan 已提交
314 315
  return -1
endi
S
Shengliang Guan 已提交
316
if $data07 != null then
S
slguan 已提交
317 318
  return -1
endi
S
Shengliang Guan 已提交
319
if $data08 != null then
S
slguan 已提交
320 321 322 323 324 325 326 327 328 329 330
  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
S
Shengliang Guan 已提交
331
if $data14 != null then
S
slguan 已提交
332 333
  return -1
endi
S
Shengliang Guan 已提交
334
if $data15 != null then
S
slguan 已提交
335 336
  return -1
endi
S
Shengliang Guan 已提交
337
if $data16 != null then
S
slguan 已提交
338 339
  return -1
endi
S
Shengliang Guan 已提交
340
if $data17 != null then
S
slguan 已提交
341 342
  return -1
endi
S
Shengliang Guan 已提交
343
if $data18 != null then
S
slguan 已提交
344 345 346 347 348 349 350 351 352 353 354
  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
S
Shengliang Guan 已提交
355
if $data24 != null then
S
slguan 已提交
356 357
  return -1
endi
S
Shengliang Guan 已提交
358
if $data25 != null then
S
slguan 已提交
359 360
  return -1
endi
S
Shengliang Guan 已提交
361
if $data26 != null then
S
slguan 已提交
362 363
  return -1
endi
S
Shengliang Guan 已提交
364
if $data27 != null then
S
slguan 已提交
365 366
  return -1
endi
S
Shengliang Guan 已提交
367
if $data28 != null then
S
slguan 已提交
368 369 370 371 372 373 374 375 376 377 378
  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
S
Shengliang Guan 已提交
379
if $data34 != null then
S
slguan 已提交
380 381
  return -1
endi
S
Shengliang Guan 已提交
382
if $data35 != null then
S
slguan 已提交
383 384
  return -1
endi
S
Shengliang Guan 已提交
385
if $data36 != null then
S
slguan 已提交
386 387
  return -1
endi
S
Shengliang Guan 已提交
388
if $data37 != null then
S
slguan 已提交
389 390
  return -1
endi
S
Shengliang Guan 已提交
391
if $data38 != null then
S
slguan 已提交
392 393 394 395 396 397 398 399 400 401 402
  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
S
Shengliang Guan 已提交
403
if $data44 != null then
S
slguan 已提交
404 405
  return -1
endi
S
Shengliang Guan 已提交
406
if $data45 != null then
S
slguan 已提交
407 408
  return -1
endi
S
Shengliang Guan 已提交
409
if $data46 != null then
S
slguan 已提交
410 411
  return -1
endi
S
Shengliang Guan 已提交
412
if $data47 != null then
S
slguan 已提交
413 414
  return -1
endi
S
Shengliang Guan 已提交
415
if $data48 != null then
S
slguan 已提交
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
  return -1
endi

print ======== step6
sql alter table tb drop column f
sql insert into tb values(now-13d, -13, 7)
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
S
Shengliang Guan 已提交
435
if $data03 != null then
S
slguan 已提交
436 437
  return -1
endi
S
Shengliang Guan 已提交
438
if $data04 != null then
S
slguan 已提交
439 440
  return -1
endi
S
Shengliang Guan 已提交
441
if $data05 != null then
S
slguan 已提交
442 443
  return -1
endi
S
Shengliang Guan 已提交
444
if $data06 != null then
S
slguan 已提交
445 446
  return -1
endi
S
Shengliang Guan 已提交
447
if $data07 != null then
S
slguan 已提交
448 449
  return -1
endi
S
Shengliang Guan 已提交
450
if $data08 != null then
S
slguan 已提交
451 452 453 454 455 456 457 458
  return -1
endi
if $data21 != -19 then
  return -1
endi
if $data22 != 0 then
  return -1
endi
S
Shengliang Guan 已提交
459
if $data23 != null then
S
slguan 已提交
460 461
  return -1
endi
S
Shengliang Guan 已提交
462
if $data24 != null then
S
slguan 已提交
463 464
  return -1
endi
S
Shengliang Guan 已提交
465
if $data25 != null then
S
slguan 已提交
466 467
  return -1
endi
S
Shengliang Guan 已提交
468
if $data26 != null then
S
slguan 已提交
469 470
  return -1
endi
S
Shengliang Guan 已提交
471
if $data27 != null then
S
slguan 已提交
472 473
  return -1
endi
S
Shengliang Guan 已提交
474
if $data28 != null then
S
slguan 已提交
475 476 477 478 479 480 481 482
  return -1
endi
if $data31 != 3 then
  return -1
endi
if $data32 != 8 then
  return -1
endi
S
Shengliang Guan 已提交
483
if $data33 != null then
S
slguan 已提交
484 485
  return -1
endi
S
Shengliang Guan 已提交
486
if $data34 != null then
S
slguan 已提交
487 488
  return -1
endi
S
Shengliang Guan 已提交
489
if $data35 != null then
S
slguan 已提交
490 491
  return -1
endi
S
Shengliang Guan 已提交
492
if $data36 != null then
S
slguan 已提交
493 494
  return -1
endi
S
Shengliang Guan 已提交
495
if $data37 != null then
S
slguan 已提交
496 497
  return -1
endi
S
Shengliang Guan 已提交
498
if $data38 != null then
S
slguan 已提交
499 500 501 502 503 504 505 506
  return -1
endi
if $data41 != 2 then
  return -1
endi
if $data42 != 8 then
  return -1
endi
S
Shengliang Guan 已提交
507
if $data43 != null then
S
slguan 已提交
508 509
  return -1
endi
S
Shengliang Guan 已提交
510
if $data44 != null then
S
slguan 已提交
511 512
  return -1
endi
S
Shengliang Guan 已提交
513
if $data45 != null then
S
slguan 已提交
514 515
  return -1
endi
S
Shengliang Guan 已提交
516
if $data46 != null then
S
slguan 已提交
517 518
  return -1
endi
S
Shengliang Guan 已提交
519
if $data47 != null then
S
slguan 已提交
520 521
  return -1
endi
S
Shengliang Guan 已提交
522
if $data48 != null then
S
slguan 已提交
523 524 525 526 527 528 529 530
  return -1
endi
if $data51 != 1 then
  return -1
endi
if $data52 != 8 then
  return -1
endi
S
Shengliang Guan 已提交
531
if $data53 != null then
S
slguan 已提交
532 533
  return -1
endi
S
Shengliang Guan 已提交
534
if $data54 != null then
S
slguan 已提交
535 536
  return -1
endi
S
Shengliang Guan 已提交
537
if $data55 != null then
S
slguan 已提交
538 539
  return -1
endi
S
Shengliang Guan 已提交
540
if $data57 != null then
S
slguan 已提交
541 542
  return -1
endi
S
Shengliang Guan 已提交
543
if $data58 != null then
S
slguan 已提交
544 545 546 547 548 549 550 551 552 553 554 555 556 557
  return -1
endi

print ======== step7
sql alter table tb drop column h
sql insert into tb values(now-10d, -10)
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
S
Shengliang Guan 已提交
558
if $data02 != null then
S
slguan 已提交
559 560
  return -1
endi
S
Shengliang Guan 已提交
561
if $data03 != null then
S
slguan 已提交
562 563 564 565 566
  return -1
endi
if $data11 != -13 then
  return -1
endi
S
Shengliang Guan 已提交
567
if $data12 != null then
S
slguan 已提交
568 569 570 571 572
  return -1
endi
if $data21 != -16 then
  return -1
endi
S
Shengliang Guan 已提交
573
if $data22 != null then
S
slguan 已提交
574 575 576 577 578
  return -1
endi
if $data31 != -19 then
  return -1
endi
S
Shengliang Guan 已提交
579
if $data32 != null then
S
slguan 已提交
580 581
  return -1
endi
S
Shengliang Guan 已提交
582
if $data33 != null then
S
slguan 已提交
583 584 585 586 587
  return -1
endi
if $data41 != 3 then
  return -1
endi
S
Shengliang Guan 已提交
588
if $data42 != null then
S
slguan 已提交
589 590 591 592 593
  return -1
endi
if $data51 != 2 then
  return -1
endi
S
Shengliang Guan 已提交
594
if $data52 != null then
S
slguan 已提交
595 596
  return -1
endi
S
Shengliang Guan 已提交
597
if $data53 != null then
S
slguan 已提交
598 599 600 601 602
  return -1
endi
if $data61 != 1 then
  return -1
endi
S
Shengliang Guan 已提交
603
if $data62 != null then
S
slguan 已提交
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
  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
S
Shengliang Guan 已提交
622
if $data02 != null then
S
slguan 已提交
623 624
  return -1
endi
S
Shengliang Guan 已提交
625
if $data03 != null then
S
slguan 已提交
626 627 628 629 630
  return -1
endi
if $data11 != -13 then
  return -1
endi
S
Shengliang Guan 已提交
631
if $data12 != null then
S
slguan 已提交
632 633 634 635 636
  return -1
endi
if $data21 != -16 then
  return -1
endi
S
Shengliang Guan 已提交
637
if $data22 != null then
S
slguan 已提交
638 639 640 641 642
  return -1
endi
if $data31 != -19 then
  return -1
endi
S
Shengliang Guan 已提交
643
if $data32 != null then
S
slguan 已提交
644 645
  return -1
endi
S
Shengliang Guan 已提交
646
if $data33 != null then
S
slguan 已提交
647 648 649 650 651
  return -1
endi
if $data41 != 3 then
  return -1
endi
S
Shengliang Guan 已提交
652
if $data42 != null then
S
slguan 已提交
653 654 655 656 657
  return -1
endi
if $data51 != 2 then
  return -1
endi
S
Shengliang Guan 已提交
658
if $data52 != null then
S
slguan 已提交
659 660
  return -1
endi
S
Shengliang Guan 已提交
661
if $data53 != null then
S
slguan 已提交
662 663 664 665 666
  return -1
endi
if $data61 != 1 then
  return -1
endi
S
Shengliang Guan 已提交
667
if $data62 != null then
S
slguan 已提交
668 669 670
  return -1
endi

guanshengliang's avatar
scripts  
guanshengliang 已提交
671
system sh/exec.sh -n dnode1 -s stop -x SIGINT