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 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 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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 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 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 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 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 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 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 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 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
|
#
# Tests for CREATE/ALTER TABLE with AUTOEXTEND_SIZE clause
#
# Test error situations for CREATE TABLE
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE 48k;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE 1M;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE 5G;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE 5M;
ERROR HY000: AUTOEXTEND_SIZE should be a multiple of 4M
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE=1.5M;
ERROR 42000: Only integers allowed as number here near '1.5M' at line 1
# Create table with autoextend_size > 0
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 4194304
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE mytable AUTOEXTEND_SIZE 0;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 0
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE mytable AUTOEXTEND_SIZE 48k;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE mytable AUTOEXTEND_SIZE 1M;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE mytable AUTOEXTEND_SIZE 5G;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE mytable AUTOEXTEND_SIZE 5M;
ERROR HY000: AUTOEXTEND_SIZE should be a multiple of 4M
DROP TABLE mytable;
# Create table with autoextend_size = 0
CREATE TABLE mytable(c1 INT) AUTOEXTEND_SIZE=0;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 114688 0
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE mytable;
# Test CREATE/ALTER TABLE with AUTOEXTEND_SIZE value specified as
# absolute number of bytes without K, M or G qualifiers
CREATE TABLE mytable (c1 INT) AUTOEXTEND_SIZE 4194304;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 4194304
ALTER TABLE mytable AUTOEXTEND_SIZE 8388608;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 8388608
DROP TABLE mytable;
# Test CREATE TABLE LIKE statement for non-partitioned tables
CREATE TABLE mytable (c1 INT) AUTOEXTEND_SIZE 4M;
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 4194304
CREATE TABLE mytable_copy LIKE mytable;
SHOW CREATE TABLE mytable_copy;
Table Create Table
mytable_copy CREATE TABLE `mytable_copy` (
`c1` int DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable_copy%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable_copy 4194304 4194304
DROP TABLE mytable_copy;
ALTER TABLE mytable AUTOEXTEND_SIZE 0;
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 0
CREATE TABLE mytable_copy LIKE mytable;
SHOW CREATE TABLE mytable_copy;
Table Create Table
mytable_copy CREATE TABLE `mytable_copy` (
`c1` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable_copy%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable_copy 114688 0
DROP TABLE mytable_copy;
ALTER TABLE mytable AUTOEXTEND_SIZE 64M;
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=67108864 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 67108864
CREATE TABLE mytable_copy LIKE mytable;
SHOW CREATE TABLE mytable_copy;
Table Create Table
mytable_copy CREATE TABLE `mytable_copy` (
`c1` int DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=67108864 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable_copy%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable_copy 67108864 67108864
DROP TABLE mytable_copy;
DROP TABLE mytable;
# Validate the initial size of the table when created without the AUTOEXTEND_SIZE clause
CREATE TABLE mytable (c1 INT);
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 114688 0
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
# Verify the autoextend_size attribute is updated in the data dictionary
ALTER TABLE mytable AUTOEXTEND_SIZE=4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 114688 4194304
# Validate SHOW CREATE TABLE displays autoextend_size clause
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
# Validate that the AUTOEXTEND_SIZE attribute is persisted properly and seen beyond server restart
# restart
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 114688 4194304
DROP TABLE mytable;
# Test that the initial size of the table is same as AUTOEXTEND_SIZE, if the clause if mentioned
CREATE TABLE mytable(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 8M;
INSERT INTO mytable VALUES (1, 'aaaaaa');
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 8388608 8388608
# Test ALTER TABLE statement
ALTER TABLE mytable ADD COLUMN c3 INT, AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 4194304 4194304
SELECT * FROM mytable;
c1 c2 c3
1 aaaaaa NULL
ALTER TABLE mytable DROP COLUMN c3, AUTOEXTEND_SIZE=0;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%mytable%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/mytable 114688 0
SHOW CREATE TABLE mytable;
Table Create Table
mytable CREATE TABLE `mytable` (
`c1` int DEFAULT NULL,
`c2` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT * FROM mytable;
c1 c2
1 aaaaaa
DROP TABLE mytable;
# Test that AUTOEXTEND_SIZE does not change after ALTER TABLE ... ALGORITHM COPY
CREATE TABLE t1 (c1 INT , c2 varchar(100)) AUTOEXTEND_SIZE =4m;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%t1%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/t1 4194304 4194304
ALTER TABLE t1 ADD INDEX idx (c2), ALGORITHM=copy;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%t1%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/t1 4194304 4194304
DROP TABLE t1;
# Tests for partitioned tables. The autoextend_size should be updated
# for each partitioned tablespace
# Create a non-partitioned table and add partitions to it and verify that the
# autoextend_size attribute is applied to all the partitions
CREATE TABLE tpart(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart 4194304 4194304
ALTER TABLE tpart PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100));
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 4194304 4194304
test/tpart#p#p1 4194304 4194304
SHOW CREATE TABLE tpart;
Table Create Table
tpart CREATE TABLE `tpart` (
`c1` int DEFAULT NULL,
`c2` text
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`c1`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB) */
ALTER TABLE tpart ADD PARTITION (PARTITION p2 VALUES LESS THAN (200));
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 4194304 4194304
test/tpart#p#p1 4194304 4194304
test/tpart#p#p2 4194304 4194304
ALTER TABLE tpart DROP PARTITION p1;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 4194304 4194304
test/tpart#p#p2 4194304 4194304
DROP TABLE tpart;
# Create a non-partitioned table and alter it to add partitions while also modifying
# the autoextend_size
CREATE TABLE tpart(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart 4194304 4194304
ALTER TABLE tpart AUTOEXTEND_SIZE 1M PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100));
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE tpart AUTOEXTEND_SIZE 8M PARTITION BY RANGE (c1) (PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100));
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 8388608 8388608
test/tpart#p#p1 8388608 8388608
SHOW CREATE TABLE tpart;
Table Create Table
tpart CREATE TABLE `tpart` (
`c1` int DEFAULT NULL,
`c2` text
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`c1`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB) */
ALTER TABLE tpart ADD PARTITION (PARTITION p2 VALUES LESS THAN (200));
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 8388608 8388608
test/tpart#p#p1 8388608 8388608
test/tpart#p#p2 8388608 8388608
DROP TABLE tpart;
# Create a partitioned table and verify autoextend_size value for the partitions
CREATE TABLE tpart(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 1M PARTITION BY RANGE (c1) (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100));
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
CREATE TABLE tpart(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 4M PARTITION BY RANGE (c1) (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100));
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 4194304 4194304
test/tpart#p#p1 4194304 4194304
SHOW CREATE TABLE tpart;
Table Create Table
tpart CREATE TABLE `tpart` (
`c1` int DEFAULT NULL,
`c2` text
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`c1`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB) */
DROP TABLE tpart;
CREATE TABLE tpart(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 4M PARTITION BY RANGE (c1) (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100));
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 4194304 4194304
test/tpart#p#p1 4194304 4194304
SHOW CREATE TABLE tpart;
Table Create Table
tpart CREATE TABLE `tpart` (
`c1` int DEFAULT NULL,
`c2` text
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`c1`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB) */
CREATE TABLE tpart_copy LIKE tpart;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart_copy%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart_copy#p#p0 4194304 4194304
test/tpart_copy#p#p1 4194304 4194304
SHOW CREATE TABLE tpart_copy;
Table Create Table
tpart_copy CREATE TABLE `tpart_copy` (
`c1` int DEFAULT NULL,
`c2` text
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`c1`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB) */
DROP TABLE tpart_copy;
# Test ALTER TABLE ... AUTOEXTEND_SIZE changes on partitioned tableѕ
ALTER TABLE tpart AUTOEXTEND_SIZE 48k;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE tpart AUTOEXTEND_SIZE 1M;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE tpart AUTOEXTEND_SIZE 5G;
ERROR HY000: AUTOEXTEND_SIZE value should be between 4M and 4096M
ALTER TABLE tpart AUTOEXTEND_SIZE 5M;
ERROR HY000: AUTOEXTEND_SIZE should be a multiple of 4M
ALTER TABLE tpart AUTOEXTEND_SIZE 8M;
SHOW CREATE TABLE tpart;
Table Create Table
tpart CREATE TABLE `tpart` (
`c1` int DEFAULT NULL,
`c2` text
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`c1`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB) */
DROP TABLE tpart;
# Test ALTER TABLE ... REMOVE PARTITIONING and ALTER TABLE ... EXCHANGE PARTITION
# for partitioned table
CREATE TABLE tpart (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30)
) AUTOEXTEND_SIZE = 8M
PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN (150),
PARTITION p3 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE tpart;
Table Create Table
tpart CREATE TABLE `tpart` (
`id` int NOT NULL,
`fname` varchar(30) DEFAULT NULL,
`lname` varchar(30) DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`id`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (150) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
INSERT INTO tpart VALUES (1669, "Jim", "Smith"), (337, "Mary", "Jones"), (16, "Frank", "White"), (2005, "Linda", "Black");
SELECT COUNT(*) FROM tpart;
COUNT(*)
4
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 8388608 8388608
test/tpart#p#p1 8388608 8388608
test/tpart#p#p2 8388608 8388608
test/tpart#p#p3 8388608 8388608
CREATE TABLE tcopy_part LIKE tpart;
SHOW CREATE TABLE tcopy_part;
Table Create Table
tcopy_part CREATE TABLE `tcopy_part` (
`id` int NOT NULL,
`fname` varchar(30) DEFAULT NULL,
`lname` varchar(30) DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`id`)
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (150) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
# Remove partitioning and validate the value of AUTOEXTEND_SIZE
ALTER TABLE tcopy_part REMOVE PARTITIONING;
SHOW CREATE TABLE tcopy_part;
Table Create Table
tcopy_part CREATE TABLE `tcopy_part` (
`id` int NOT NULL,
`fname` varchar(30) DEFAULT NULL,
`lname` varchar(30) DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tcopy_part%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tcopy_part 8388608 8388608
# Exchange a partition
SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 'tpart';
PARTITION_NAME TABLE_ROWS
p0 1
p1 0
p2 0
p3 3
ALTER TABLE tpart EXCHANGE PARTITION p3 WITH TABLE tcopy_part;
SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 'tpart';
PARTITION_NAME TABLE_ROWS
p0 0
p1 0
p2 0
p3 0
SELECT COUNT(*) FROM tpart;
COUNT(*)
1
SELECT COUNT(*) FROM tcopy_part;
COUNT(*)
3
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tpart#p#p0 8388608 8388608
test/tpart#p#p1 8388608 8388608
test/tpart#p#p2 8388608 8388608
test/tpart#p#p3 8388608 8388608
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tcopy_part%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tcopy_part 8388608 8388608
DROP TABLE tpart;
DROP TABLE tcopy_part;
# Tests for sub-partitioned tables. The autoextend_size should be updated
# for each sub-partition
# Create a non-partitioned table and add sub-partitions to it
CREATE TABLE tsubpart(a INT NOT NULL PRIMARY KEY, b INT) AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart 4194304 4194304
ALTER TABLE tsubpart PARTITION BY RANGE (a) SUBPARTITION BY HASH (a)
SUBPARTITIONS 3 (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20),
PARTITION p3 VALUES LESS THAN maxvalue);
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 4194304 4194304
test/tsubpart#p#p1#sp#p1sp1 4194304 4194304
test/tsubpart#p#p1#sp#p1sp2 4194304 4194304
test/tsubpart#p#p2#sp#p2sp0 4194304 4194304
test/tsubpart#p#p2#sp#p2sp1 4194304 4194304
test/tsubpart#p#p2#sp#p2sp2 4194304 4194304
test/tsubpart#p#p3#sp#p3sp0 4194304 4194304
test/tsubpart#p#p3#sp#p3sp1 4194304 4194304
test/tsubpart#p#p3#sp#p3sp2 4194304 4194304
SHOW CREATE TABLE tsubpart;
Table Create Table
tsubpart CREATE TABLE `tsubpart` (
`a` int NOT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`a`)
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
ALTER TABLE tsubpart DROP PARTITION p3;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 4194304 4194304
test/tsubpart#p#p1#sp#p1sp1 4194304 4194304
test/tsubpart#p#p1#sp#p1sp2 4194304 4194304
test/tsubpart#p#p2#sp#p2sp0 4194304 4194304
test/tsubpart#p#p2#sp#p2sp1 4194304 4194304
test/tsubpart#p#p2#sp#p2sp2 4194304 4194304
DROP TABLE tsubpart;
# Create a non-partitioned table and add sub-partitions to it whle also modifying
# autoextend_size
CREATE TABLE tsubpart(a INT NOT NULL PRIMARY KEY, b INT) AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart 4194304 4194304
ALTER TABLE tsubpart AUTOEXTEND_SIZE 8M PARTITION BY RANGE (a) SUBPARTITION BY HASH (a)
SUBPARTITIONS 3 (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20),
PARTITION p3 VALUES LESS THAN maxvalue);
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 8388608 8388608
test/tsubpart#p#p1#sp#p1sp1 8388608 8388608
test/tsubpart#p#p1#sp#p1sp2 8388608 8388608
test/tsubpart#p#p2#sp#p2sp0 8388608 8388608
test/tsubpart#p#p2#sp#p2sp1 8388608 8388608
test/tsubpart#p#p2#sp#p2sp2 8388608 8388608
test/tsubpart#p#p3#sp#p3sp0 8388608 8388608
test/tsubpart#p#p3#sp#p3sp1 8388608 8388608
test/tsubpart#p#p3#sp#p3sp2 8388608 8388608
SHOW CREATE TABLE tsubpart;
Table Create Table
tsubpart CREATE TABLE `tsubpart` (
`a` int NOT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`a`)
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
ALTER TABLE tsubpart DROP PARTITION p3;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 8388608 8388608
test/tsubpart#p#p1#sp#p1sp1 8388608 8388608
test/tsubpart#p#p1#sp#p1sp2 8388608 8388608
test/tsubpart#p#p2#sp#p2sp0 8388608 8388608
test/tsubpart#p#p2#sp#p2sp1 8388608 8388608
test/tsubpart#p#p2#sp#p2sp2 8388608 8388608
DROP TABLE tsubpart;
# Create a sub-partitioned table and verify that changes to AUTOEXTEND_SIZE
# are applied to all the subpartitions
CREATE TABLE tsubpart (a INT NOT NULL PRIMARY KEY, b INT)
AUTOEXTEND_SIZE 4M
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
SUBPARTITIONS 3 (
PARTITION p1 values less than (10),
PARTITION p2 values less than (20),
PARTITION p3 values less than maxvalue);
SHOW CREATE TABLE tsubpart;
Table Create Table
tsubpart CREATE TABLE `tsubpart` (
`a` int NOT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`a`)
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 4194304 4194304
test/tsubpart#p#p1#sp#p1sp1 4194304 4194304
test/tsubpart#p#p1#sp#p1sp2 4194304 4194304
test/tsubpart#p#p2#sp#p2sp0 4194304 4194304
test/tsubpart#p#p2#sp#p2sp1 4194304 4194304
test/tsubpart#p#p2#sp#p2sp2 4194304 4194304
test/tsubpart#p#p3#sp#p3sp0 4194304 4194304
test/tsubpart#p#p3#sp#p3sp1 4194304 4194304
test/tsubpart#p#p3#sp#p3sp2 4194304 4194304
CREATE TABLE tsubpart_copy LIKE tsubpart;
SHOW CREATE TABLE tsubpart_copy;
Table Create Table
tsubpart_copy CREATE TABLE `tsubpart_copy` (
`a` int NOT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`a`)
) /*!80023 AUTOEXTEND_SIZE=4194304 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart_copy%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart_copy#p#p1#sp#p1sp0 4194304 4194304
test/tsubpart_copy#p#p1#sp#p1sp1 4194304 4194304
test/tsubpart_copy#p#p1#sp#p1sp2 4194304 4194304
test/tsubpart_copy#p#p2#sp#p2sp0 4194304 4194304
test/tsubpart_copy#p#p2#sp#p2sp1 4194304 4194304
test/tsubpart_copy#p#p2#sp#p2sp2 4194304 4194304
test/tsubpart_copy#p#p3#sp#p3sp0 4194304 4194304
test/tsubpart_copy#p#p3#sp#p3sp1 4194304 4194304
test/tsubpart_copy#p#p3#sp#p3sp2 4194304 4194304
DROP TABLE tsubpart_copy;
ALTER TABLE tsubpart AUTOEXTEND_SIZE 8M;
SHOW CREATE TABLE tsubpart;
Table Create Table
tsubpart CREATE TABLE `tsubpart` (
`a` int NOT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`a`)
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 4194304 8388608
test/tsubpart#p#p1#sp#p1sp1 4194304 8388608
test/tsubpart#p#p1#sp#p1sp2 4194304 8388608
test/tsubpart#p#p2#sp#p2sp0 4194304 8388608
test/tsubpart#p#p2#sp#p2sp1 4194304 8388608
test/tsubpart#p#p2#sp#p2sp2 4194304 8388608
test/tsubpart#p#p3#sp#p3sp0 4194304 8388608
test/tsubpart#p#p3#sp#p3sp1 4194304 8388608
test/tsubpart#p#p3#sp#p3sp2 4194304 8388608
ALTER TABLE tsubpart AUTOEXTEND_SIZE 0;
SHOW CREATE TABLE tsubpart;
Table Create Table
tsubpart CREATE TABLE `tsubpart` (
`a` int NOT NULL,
`b` int DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p1#sp#p1sp0 4194304 0
test/tsubpart#p#p1#sp#p1sp1 4194304 0
test/tsubpart#p#p1#sp#p1sp2 4194304 0
test/tsubpart#p#p2#sp#p2sp0 4194304 0
test/tsubpart#p#p2#sp#p2sp1 4194304 0
test/tsubpart#p#p2#sp#p2sp2 4194304 0
test/tsubpart#p#p3#sp#p3sp0 4194304 0
test/tsubpart#p#p3#sp#p3sp1 4194304 0
test/tsubpart#p#p3#sp#p3sp2 4194304 0
DROP TABLE tsubpart;
# Test ALTER TABLE ... REMOVE PARTITIONING and ALTER TABLE ... EXCHANGE PARTITION
# for sub-partitioned table
CREATE TABLE tsubpart (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30)
) AUTOEXTEND_SIZE = 8M
PARTITION BY RANGE (id)
SUBPARTITION BY KEY (lname)
SUBPARTITIONS 2 (
PARTITION p0 VALUES LESS THAN (50),
PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN (150),
PARTITION p3 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE tsubpart;
Table Create Table
tsubpart CREATE TABLE `tsubpart` (
`id` int NOT NULL,
`fname` varchar(30) DEFAULT NULL,
`lname` varchar(30) DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`id`)
SUBPARTITION BY KEY (lname)
SUBPARTITIONS 2
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (150) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
INSERT INTO tsubpart VALUES (1669, "Jim", "Smith"), (337, "Mary", "Jones"), (16, "Frank", "White"), (2005, "Linda", "Black");
SELECT COUNT(*) FROM tsubpart;
COUNT(*)
4
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p0#sp#p0sp0 8388608 8388608
test/tsubpart#p#p0#sp#p0sp1 8388608 8388608
test/tsubpart#p#p1#sp#p1sp0 8388608 8388608
test/tsubpart#p#p1#sp#p1sp1 8388608 8388608
test/tsubpart#p#p2#sp#p2sp0 8388608 8388608
test/tsubpart#p#p2#sp#p2sp1 8388608 8388608
test/tsubpart#p#p3#sp#p3sp0 8388608 8388608
test/tsubpart#p#p3#sp#p3sp1 8388608 8388608
CREATE TABLE tcopy_subpart LIKE tsubpart;
SHOW CREATE TABLE tcopy_subpart;
Table Create Table
tcopy_subpart CREATE TABLE `tcopy_subpart` (
`id` int NOT NULL,
`fname` varchar(30) DEFAULT NULL,
`lname` varchar(30) DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY RANGE (`id`)
SUBPARTITION BY KEY (lname)
SUBPARTITIONS 2
(PARTITION p0 VALUES LESS THAN (50) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (150) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
# Remove partitioning and validate the value of AUTOEXTEND_SIZE
ALTER TABLE tcopy_subpart REMOVE PARTITIONING;
SHOW CREATE TABLE tcopy_subpart;
Table Create Table
tcopy_subpart CREATE TABLE `tcopy_subpart` (
`id` int NOT NULL,
`fname` varchar(30) DEFAULT NULL,
`lname` varchar(30) DEFAULT NULL
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tcopy_subpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tcopy_subpart 8388608 8388608
# Exchange a partition
SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 'tsubpart';
PARTITION_NAME TABLE_ROWS
p0 1
p0 0
p1 0
p1 0
p2 0
p2 0
p3 1
p3 2
ALTER TABLE tsubpart EXCHANGE PARTITION p3sp0 WITH TABLE tcopy_subpart;
SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 'tsubpart';
PARTITION_NAME TABLE_ROWS
p0 0
p0 0
p1 0
p1 0
p2 0
p2 0
p3 0
p3 2
SELECT COUNT(*) FROM tsubpart;
COUNT(*)
3
SELECT COUNT(*) FROM tcopy_subpart;
COUNT(*)
1
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tsubpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tsubpart#p#p0#sp#p0sp0 8388608 8388608
test/tsubpart#p#p0#sp#p0sp1 8388608 8388608
test/tsubpart#p#p1#sp#p1sp0 8388608 8388608
test/tsubpart#p#p1#sp#p1sp1 8388608 8388608
test/tsubpart#p#p2#sp#p2sp0 8388608 8388608
test/tsubpart#p#p2#sp#p2sp1 8388608 8388608
test/tsubpart#p#p3#sp#p3sp1 8388608 8388608
test/tsubpart#p#p3#sp#p3sp0 8388608 8388608
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%tcopy_subpart%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/tcopy_subpart 8388608 8388608
DROP TABLE tsubpart;
DROP TABLE tcopy_subpart;
# Validate that AUTOEXTEND_SIZE clause is not supported with temporary tables
CREATE TEMPORARY TABLE temp1 (c1 int) AUTOEXTEND_SIZE 4M;
ERROR HY000: AUTOEXTEND_SIZE clause is not valid for temporary tablespace.
CREATE TEMPORARY TABLE temp1(c1 INT);
ALTER TABLE temp1 AUTOEXTEND_SIZE 4M;
ERROR HY000: AUTOEXTEND_SIZE clause is not valid for temporary tablespace.
DROP TEMPORARY TABLE temp1;
# Validate that AUTOEXTEND_SIZE value is effective when the server is started
# with --skip-innodb-validate-tablespace-paths command like option
CREATE TABLE t1(c1 INT, c2 TEXT) AUTOEXTEND_SIZE 4M;
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%t1%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/t1 4194304 4194304
CREATE PROCEDURE bulk_insert()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i < 10000 DO
INSERT INTO t1 VALUES (i, repeat('aaaaaa', 10000));
COMMIT;
SET i = i + 1;
END WHILE;
END
|
# restart: --skip-innodb-validate-tablespace-paths
call bulk_insert();
SELECT COUNT(*) FROM t1;
COUNT(*)
9999
SELECT NAME, FILE_SIZE, AUTOEXTEND_SIZE FROM information_schema.innodb_tablespaces
WHERE NAME LIKE '%t1%';
NAME FILE_SIZE AUTOEXTEND_SIZE
test/t1 662700032 4194304
DROP PROCEDURE bulk_insert;
DROP TABLE t1;
# restart
# Bug#32235621 - Concurrent execution of ALTER TABLE and SHOW CREATE TABLE crashes
# the server
CREATE TABLE t1(
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`, `c0001`),
KEY `i0002` (`c0000`(112))
) AUTOEXTEND_SIZE=8M ENGINE=InnoDB;
CREATE PROCEDURE alter_table()
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < 20 DO
ALTER TABLE t1 FORCE;
SET i = i + 1;
END WHILE;
END |
CREATE PROCEDURE show_create_table()
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < 20 DO
SHOW CREATE TABLE t1;
SET i = i + 1;
END WHILE;
END |
CALL show_create_table();
CALL alter_table();
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Table Create Table
t1 CREATE TABLE `t1` (
`c0001` int NOT NULL /*!80023 INVISIBLE */,
`c0000` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`c0002` decimal(65,14) DEFAULT NULL,
`c0004` tinyblob NOT NULL,
KEY `i0001` (`c0002`,`c0001`),
KEY `i0002` (`c0000`(112))
) /*!80023 AUTOEXTEND_SIZE=8388608 */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
DROP PROCEDURE show_create_table;
DROP PROCEDURE alter_table;
|