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
|
#
# This test shows DISCARD/IMPORT of a remote tablespace.
#
SET default_storage_engine=InnoDB;
SET GLOBAL innodb_file_per_table=ON;
DROP TABLE IF EXISTS t5980;
#
# CREATE TABLE ... DATA DIRECTORY
# combined with WL#5522 - Transportable Tablespace
# Create the tablespace in MYSQL_TMP_DIR/alt_dir
# InnoDB will create the sub-directories if needed.
# Test that DISCARD and IMPORT work correctly.
#
CREATE TABLE t5980 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
INSERT INTO t5980 VALUES (1, "Create the tablespace");
SELECT * FROM t5980;
a b
1 Create the tablespace
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.ibd
#
# Check that DATA DIRECTORY shows up in the SHOW CREATE TABLE results.
#
SHOW CREATE TABLE t5980;
Table Create Table
t5980 CREATE TABLE `t5980` (
`a` int NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
#
# Backup the cfg and ibd files.
#
FLUSH TABLES t5980 FOR EXPORT;
SELECT * FROM t5980;
a b
1 Create the tablespace
UNLOCK TABLES;
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.ibd
t5980.ibd.bak
#
# Do some DDL and DML.
#
INSERT INTO t5980 VALUES (2,'Remote table has been FLUSHed and UNLOCKed');
START TRANSACTION;
INSERT INTO t5980 VALUES (12,'Transactional record inserted');
COMMIT;
START TRANSACTION;
INSERT INTO t5980 VALUES (13,'Rollback this transactional record');
ROLLBACK;
SELECT COUNT(*) FROM t5980;
COUNT(*)
3
SELECT * FROM t5980;
a b
1 Create the tablespace
2 Remote table has been FLUSHed and UNLOCKed
12 Transactional record inserted
ALTER TABLE t5980 DROP PRIMARY KEY;
ALTER TABLE t5980 ADD COLUMN c VARCHAR(50) DEFAULT NULL;
INSERT INTO t5980(a,b,c) VALUES (2,'Duplicate value since primary key has been dropped','third column added');
SELECT * FROM t5980;
a b c
1 Create the tablespace NULL
2 Remote table has been FLUSHed and UNLOCKed NULL
12 Transactional record inserted NULL
2 Duplicate value since primary key has been dropped third column added
#
# Make a second backup of the cfg and ibd files.
#
FLUSH TABLES t5980 FOR EXPORT;
SELECT * FROM t5980;
a b c
1 Create the tablespace NULL
2 Remote table has been FLUSHed and UNLOCKed NULL
12 Transactional record inserted NULL
2 Duplicate value since primary key has been dropped third column added
UNLOCK TABLES;
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
#
# DROP the table and make sure all files except the backups are gone.
#
DROP TABLE t5980;
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
#
# CREATE the table again.
#
CREATE TABLE t5980 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
INSERT INTO t5980 VALUES (1, "Create the tablespace a second time");
SELECT * FROM t5980;
a b
1 Create the tablespace a second time
#
# DISCARD existing tablespace so backed-up .ibd which can be imported/restored
#
ALTER TABLE t5980 DISCARD TABLESPACE;
SELECT * FROM t5980;
ERROR HY000: Tablespace has been discarded for table 't5980'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
#
# Restore the second backup of cfg and ibd files.
#
"### files in MYSQL_TMP_DIR/alt_dir/test"
t5980.cfg
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
#
# Try to Import the second backup. These backups have extra DDL and
# do not match the current frm file.
#
ALTER TABLE t5980 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Number of columns don't match, table has 5 columns but the tablespace meta-data file has 6 columns)
CHECK TABLE t5980;
Table Op Msg_type Msg_text
test.t5980 check Error Tablespace has been discarded for table 't5980'
test.t5980 check error Corrupt
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
#
# Restore the first backup of cfg and ibd files.
#
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
#
# Import the tablespace and do some DDL and DML.
#
ALTER TABLE t5980 IMPORT TABLESPACE;
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
CHECK TABLE t5980;
Table Op Msg_type Msg_text
test.t5980 check status OK
SELECT COUNT(*) FROM t5980;
COUNT(*)
1
SELECT * FROM t5980;
a b
1 Create the tablespace
INSERT INTO t5980 VALUES (2,'Inserted record after IMPORT');
SELECT * FROM t5980;
a b
1 Create the tablespace
2 Inserted record after IMPORT
START TRANSACTION;
INSERT INTO t5980 VALUES (12,'Transactional record inserted');
COMMIT;
START TRANSACTION;
INSERT INTO t5980 VALUES (13,'Rollback this transactional record');
ROLLBACK;
SELECT * FROM t5980;
a b
1 Create the tablespace
2 Inserted record after IMPORT
12 Transactional record inserted
ALTER TABLE t5980 DROP PRIMARY KEY;
ALTER TABLE t5980 ADD COLUMN c VARCHAR(50) DEFAULT NULL;
INSERT INTO t5980(a,b,c) VALUES (2,'Duplicate value since primary key has been dropped','third column added');
SELECT * FROM t5980;
a b c
1 Create the tablespace NULL
2 Inserted record after IMPORT NULL
12 Transactional record inserted NULL
2 Duplicate value since primary key has been dropped third column added
#
# Show that the system tables have this table in them correctly.
#
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980 test/t5980 97 6 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980 Single DEFAULT 0 1 1 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980 TABLESPACE InnoDB NORMAL test/t5980 MYSQL_TMP_DIR/alt_dir/test/t5980.ibd
#
# Drop the imported table and show that the system tables are updated.
#
DROP TABLE t5980;
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
#
# CREATE the table a third time.
#
CREATE TABLE t5980 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
INSERT INTO t5980 VALUES (1, "Create the tablespace a third time");
SELECT * FROM t5980;
a b
1 Create the tablespace a third time
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
#
# Restart the server
# This test makes sure that you can still execute the FLUSH TABLES command
# after restarting the server and the tablespace can still be found.
#
# restart
SET GLOBAL innodb_file_per_table=ON;
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
SELECT * FROM t5980;
a b
1 Create the tablespace a third time
FLUSH TABLES t5980 FOR EXPORT;
SELECT * FROM t5980;
a b
1 Create the tablespace a third time
UNLOCK TABLES;
#
# Restart the server again. This test makes sure that you can
# still DISCARD a remote table after restarting the server.
#
# restart
SET GLOBAL innodb_file_per_table=ON;
SELECT * FROM t5980;
a b
1 Create the tablespace a third time
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
ALTER TABLE t5980 DISCARD TABLESPACE;
SELECT * FROM t5980;
ERROR HY000: Tablespace has been discarded for table 't5980'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
#
# Restore the backup of *.ibd and *.cfg files
#
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
#
# Import the tablespace and check it out.
#
ALTER TABLE t5980 IMPORT TABLESPACE;
SELECT * FROM t5980;
a b
1 Create the tablespace
SHOW CREATE TABLE t5980;
Table Create Table
t5980 CREATE TABLE `t5980` (
`a` int NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
#
# DISCARD the tablespace again
#
ALTER TABLE t5980 DISCARD TABLESPACE;
SELECT * FROM t5980;
ERROR HY000: Tablespace has been discarded for table 't5980'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
#
# Restart the engine while the tablespace is in the discarded state
#
# restart
SET GLOBAL innodb_file_per_table=ON;
SELECT * FROM t5980;
ERROR HY000: Tablespace has been discarded for table 't5980'
CHECK TABLE t5980;
Table Op Msg_type Msg_text
test.t5980 check Error Tablespace has been discarded for table 't5980'
test.t5980 check error Corrupt
#
# Relocate this discarded file to the default directory
# instead of the remote directory it was discarded from.
# Put cfg and idb files into the default directory.
# Restart the engine again.
# The tablespace is still in the discarded state.
#
### files in MYSQLD_DATADIR/test
t5980.cfg
t5980.ibd
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd.bak
t5980.ibd.bak2
# Restarting ...
# restart
SET GLOBAL innodb_file_per_table=ON;
SELECT * FROM t5980;
ERROR HY000: Tablespace has been discarded for table 't5980'
CHECK TABLE t5980;
Table Op Msg_type Msg_text
test.t5980 check Error Tablespace has been discarded for table 't5980'
test.t5980 check error Corrupt
#
# Try to import the tablespace. It can only be imported from
# the location it was discarded from.
# The error message for 1810 (IO_READ_ERROR) refers to a local path
# so do not display it.
#
ALTER TABLE t5980 IMPORT TABLESPACE;
SELECT * FROM t5980;
ERROR HY000: Tablespace has been discarded for table 't5980'
CHECK TABLE t5980;
Table Op Msg_type Msg_text
test.t5980 check Error Tablespace has been discarded for table 't5980'
test.t5980 check error Corrupt
#
# Restore the ibd and cfg files to the remote directory.
# Delete the ibd and cfg files from the default directory.
# Import the tablespace and check it out.
#
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
t5980.cfg
t5980.cfg.bak
t5980.cfg.bak2
t5980.ibd
t5980.ibd.bak
t5980.ibd.bak2
ALTER TABLE t5980 IMPORT TABLESPACE;
INSERT INTO t5980 VALUES (2, "Insert this record after IMPORT");
SELECT * FROM t5980;
a b
1 Create the tablespace
2 Insert this record after IMPORT
SHOW CREATE TABLE t5980;
Table Create Table
t5980 CREATE TABLE `t5980` (
`a` int NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
#
# Show that the system tables have this table in them correctly.
#
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980 test/t5980 97 5 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980 Single DEFAULT 0 1 1 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980 TABLESPACE InnoDB NORMAL test/t5980 MYSQL_TMP_DIR/alt_dir/test/t5980.ibd
DROP TABLE t5980;
#
# Create a local and remote tablespaces, discard two and make
# the other two missing upon restart, and try some DDL and DML
# on these discarded and missing tablespaces.
#
SET GLOBAL innodb_file_per_table=ON;
CREATE TABLE t5980a (a int, b text) engine=InnoDB;
CREATE TABLE t5980b (a int, b text) engine=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
CREATE TABLE t5980c (a int, b text) engine=InnoDB;
CREATE TABLE t5980d (a int, b text) engine=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
INSERT INTO t5980a VALUES (1, "Default location, discarded.");
INSERT INTO t5980b VALUES (1, "Remote location, discarded");
INSERT INTO t5980c VALUES (1, "Default location, missing");
INSERT INTO t5980d VALUES (1, "Remote location, missing");
SELECT * FROM t5980a;
a b
1 Default location, discarded.
SELECT * FROM t5980b;
a b
1 Remote location, discarded
SELECT * FROM t5980c;
a b
1 Default location, missing
SELECT * FROM t5980d;
a b
1 Remote location, missing
SHOW CREATE TABLE t5980a;
Table Create Table
t5980a CREATE TABLE `t5980a` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SHOW CREATE TABLE t5980b;
Table Create Table
t5980b CREATE TABLE `t5980b` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SHOW CREATE TABLE t5980c;
Table Create Table
t5980c CREATE TABLE `t5980c` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SHOW CREATE TABLE t5980d;
Table Create Table
t5980d CREATE TABLE `t5980d` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980a test/t5980a 33 5 Dynamic 0 Single
test/t5980b test/t5980b 97 5 Dynamic 0 Single
test/t5980c test/t5980c 33 5 Dynamic 0 Single
test/t5980d test/t5980d 97 5 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980a Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/test/t5980a.ibd
test/t5980b Single DEFAULT 0 1 1 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980b.ibd
test/t5980c Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/test/t5980c.ibd
test/t5980d Single DEFAULT 0 1 1 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980d.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980a TABLESPACE InnoDB NORMAL test/t5980a MYSQLD_DATADIR/test/t5980a.ibd
test/t5980b TABLESPACE InnoDB NORMAL test/t5980b MYSQL_TMP_DIR/alt_dir/test/t5980b.ibd
test/t5980c TABLESPACE InnoDB NORMAL test/t5980c MYSQLD_DATADIR/test/t5980c.ibd
test/t5980d TABLESPACE InnoDB NORMAL test/t5980d MYSQL_TMP_DIR/alt_dir/test/t5980d.ibd
### files in MYSQLD_DATADIR/test
t5980a.ibd
t5980c.ibd
### files in MYSQL_TMP_DIR/alt_dir/test
t5980b.ibd
t5980d.ibd
#
# Shutdown the server, remove two tablespaces, restart server.
#
# restart
FLUSH TABLES t5980a, t5980b FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t5980a DISCARD TABLESPACE;
ALTER TABLE t5980b DISCARD TABLESPACE;
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
SELECT * FROM t5980a;
ERROR HY000: Tablespace has been discarded for table 't5980a'
SELECT * FROM t5980b;
ERROR HY000: Tablespace has been discarded for table 't5980b'
SELECT * FROM t5980c;
ERROR HY000: Tablespace is missing for table `test`.`t5980c`.
SELECT * FROM t5980d;
ERROR HY000: Tablespace is missing for table `test`.`t5980d`.
SHOW CREATE TABLE t5980a;
Table Create Table
t5980a CREATE TABLE `t5980a` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SHOW CREATE TABLE t5980b;
Table Create Table
t5980b CREATE TABLE `t5980b` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SHOW CREATE TABLE t5980c;
ERROR HY000: Tablespace is missing for table `test`.`t5980c`.
SHOW CREATE TABLE t5980d;
ERROR HY000: Tablespace is missing for table `test`.`t5980d`.
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980a test/t5980a 33 5 Dynamic 0 Single
test/t5980b test/t5980b 97 5 Dynamic 0 Single
test/t5980c test/t5980c 33 5 Dynamic 0 Single
test/t5980d test/t5980d 97 5 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980a Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980a.ibd
test/t5980b Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980b.ibd
test/t5980c Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980c.ibd
test/t5980d Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980d.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
#
# Discarded and missing tablespaces cannot be TRUNCATED
#
TRUNCATE TABLE t5980a;
ERROR HY000: Tablespace has been discarded for table 'test/t5980a'
call mtr.add_suppression("Table .* does not exist .* though MySQL .* rename");
TRUNCATE TABLE t5980b;
ERROR HY000: Tablespace has been discarded for table 'test/t5980b'
TRUNCATE TABLE t5980c;
ERROR HY000: Tablespace is missing for table `test`.`t5980c`.
TRUNCATE TABLE t5980d;
ERROR HY000: Tablespace is missing for table `test`.`t5980d`.
#
# Discarded tablespaces can be RENAMED but they remain discarded
#
RENAME TABLE t5980a TO t5980aa;
RENAME TABLE t5980b TO t5980bb;
#
# Missing tablespaces cannot be RENAMED
#
RENAME TABLE t5980c TO t5980cc;
ERROR HY000: Error on rename of './test/t5980c' to './test/t5980cc' (errno: 155 - The table does not exist in engine)
RENAME TABLE t5980d TO t5980dd;
ERROR HY000: Error on rename of './test/t5980d' to './test/t5980dd' (errno: 155 - The table does not exist in engine)
SELECT * FROM t5980a;
ERROR 42S02: Table 'test.t5980a' doesn't exist
SELECT * FROM t5980b;
ERROR 42S02: Table 'test.t5980b' doesn't exist
SELECT * FROM t5980aa;
ERROR HY000: Tablespace has been discarded for table 't5980aa'
SELECT * FROM t5980bb;
ERROR HY000: Tablespace has been discarded for table 't5980bb'
SELECT * FROM t5980c;
ERROR HY000: Tablespace is missing for table `test`.`t5980c`.
SELECT * FROM t5980d;
ERROR HY000: Tablespace is missing for table `test`.`t5980d`.
SHOW CREATE TABLE t5980aa;
Table Create Table
t5980aa CREATE TABLE `t5980aa` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SHOW CREATE TABLE t5980bb;
Table Create Table
t5980bb CREATE TABLE `t5980bb` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SHOW CREATE TABLE t5980c;
ERROR HY000: Tablespace is missing for table `test`.`t5980c`.
SHOW CREATE TABLE t5980d;
ERROR HY000: Tablespace is missing for table `test`.`t5980d`.
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980aa test/t5980aa 33 5 Dynamic 0 Single
test/t5980bb test/t5980bb 97 5 Dynamic 0 Single
test/t5980c test/t5980c 33 5 Dynamic 0 Single
test/t5980d test/t5980d 97 5 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980aa Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980aa.ibd
test/t5980bb Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980bb.ibd
test/t5980c Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980c.ibd
test/t5980d Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980d.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
#
# Discarded tablespaces cannot be ALTERED with ALGORITHM=COPY.
#
ALTER TABLE t5980aa ADD PRIMARY KEY(a), ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980aa'
ALTER TABLE t5980bb ADD PRIMARY KEY(a), ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980bb'
ALTER TABLE t5980aa CHANGE a c INT, ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980aa'
ALTER TABLE t5980bb CHANGE a c INT, ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980bb'
#
# Discarded tablespaces can be ALTERED with ALGORITHM=INPLACE
# only if a rebuild is not required.
#
ALTER TABLE t5980aa ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
ERROR HY000: Tablespace has been discarded for table 'test/t5980aa'
ALTER TABLE t5980bb ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
ERROR HY000: Tablespace has been discarded for table 'test/t5980bb'
ALTER TABLE t5980aa RENAME t5980aaa, ALGORITHM=INPLACE;
ALTER TABLE t5980aaa RENAME t5980aa, ALGORITHM=INPLACE;
Warnings:
Warning 1814 InnoDB: Tablespace has been discarded for table 't5980aaa'
ALTER TABLE t5980bb RENAME t5980bbb, ALGORITHM=INPLACE;
ALTER TABLE t5980bbb RENAME t5980bb, ALGORITHM=INPLACE;
Warnings:
Warning 1814 InnoDB: Tablespace has been discarded for table 't5980bbb'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
#
# Missing tablespaces cannot be ALTERED.
#
ALTER TABLE t5980c ADD PRIMARY KEY(a);
ERROR HY000: Tablespace is missing for table `test`.`t5980c`.
ALTER TABLE t5980d ADD PRIMARY KEY(a);
ERROR HY000: Tablespace is missing for table `test`.`t5980d`.
SELECT * FROM t5980aa;
ERROR HY000: Tablespace has been discarded for table 't5980aa'
SELECT * FROM t5980bb;
ERROR HY000: Tablespace has been discarded for table 't5980bb'
SHOW CREATE TABLE t5980aa;
Table Create Table
t5980aa CREATE TABLE `t5980aa` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SHOW CREATE TABLE t5980bb;
Table Create Table
t5980bb CREATE TABLE `t5980bb` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980aa test/t5980aa 33 5 Dynamic 0 Single
test/t5980bb test/t5980bb 97 5 Dynamic 0 Single
test/t5980c test/t5980c 33 5 Dynamic 0 Single
test/t5980d test/t5980d 97 5 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980aa Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980aa.ibd
test/t5980bb Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980bb.ibd
test/t5980c Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980c.ibd
test/t5980d Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980d.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
#
# Restart the server to check if the discarded flag is persistent
#
# restart
#
# Discarded tablespaces that were ALTERED IN_PLACE are still discarded.
#
INSERT INTO t5980aa VALUES (1, "Inserted into Discarded Local tablespace after ALTER ADD PRIMARY KEY, ALGORITHM=INPLACE");
ERROR HY000: Tablespace has been discarded for table 't5980aa'
INSERT INTO t5980bb VALUES (1, "Inserted into Discarded Local tablespace after ALTER ADD PRIMARY KEY, ALGORITHM=INPLACE");
ERROR HY000: Tablespace has been discarded for table 't5980bb'
SELECT * FROM t5980aa;
ERROR HY000: Tablespace has been discarded for table 't5980aa'
SELECT * FROM t5980bb;
ERROR HY000: Tablespace has been discarded for table 't5980bb'
RENAME TABLE t5980aa TO t5980a;
RENAME TABLE t5980bb TO t5980b;
SHOW CREATE TABLE t5980a;
Table Create Table
t5980a CREATE TABLE `t5980a` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Warnings:
Warning 1814 InnoDB: Tablespace has been discarded for table 't5980a'
SHOW CREATE TABLE t5980b;
Table Create Table
t5980b CREATE TABLE `t5980b` (
`a` int DEFAULT NULL,
`b` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
Warnings:
Warning 1814 InnoDB: Tablespace has been discarded for table 't5980b'
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
test/t5980a test/t5980a 33 5 Dynamic 0 Single
test/t5980b test/t5980b 97 5 Dynamic 0 Single
test/t5980c test/t5980c 33 5 Dynamic 0 Single
test/t5980d test/t5980d 97 5 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t5980a Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980a.ibd
test/t5980b Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980b.ibd
test/t5980c Single DEFAULT 0 0 0 Dynamic MYSQLD_DATADIR/test/t5980c.ibd
test/t5980d Single DEFAULT 0 0 0 Dynamic MYSQL_TMP_DIR/alt_dir/test/t5980d.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
#
# Discard tablespaces again and try another ALTER TABLE ROW_FORMAT.
#
ALTER TABLE t5980a DISCARD TABLESPACE;
Warnings:
Warning 1812 InnoDB: Tablespace is missing for table test/t5980a.
ALTER TABLE t5980b DISCARD TABLESPACE;
Warnings:
Warning 1812 InnoDB: Tablespace is missing for table test/t5980b.
SELECT * FROM t5980a;
ERROR HY000: Tablespace has been discarded for table 't5980a'
SELECT * FROM t5980b;
ERROR HY000: Tablespace has been discarded for table 't5980b'
#
# ALTER TABLE ALGORITHM=COPY cannot use a discarded tablespace.
#
ALTER TABLE t5980a ROW_FORMAT=REDUNDANT, ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980a'
ALTER TABLE t5980b ROW_FORMAT=REDUNDANT, ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980b'
#
# ALTER TABLE ALGORITHM=INPLACE can use a discarded tablespace.
# only if a rebuild is not required.
#
ALTER TABLE t5980a ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR HY000: Tablespace has been discarded for table 'test/t5980a'
ALTER TABLE t5980b ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR HY000: Tablespace has been discarded for table 'test/t5980b'
#
# Discarded tablespaces that were ALTERED IN_PLACE are still discarded.
#
INSERT INTO t5980a VALUES (1, "Inserted into discarded local tablespace after ALTER ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE");
ERROR HY000: Tablespace has been discarded for table 't5980a'
INSERT INTO t5980b VALUES (1, "Inserted into discarded local tablespace after ALTER ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE");
ERROR HY000: Tablespace has been discarded for table 't5980b'
SELECT * FROM t5980a;
ERROR HY000: Tablespace has been discarded for table 't5980a'
SELECT * FROM t5980b;
ERROR HY000: Tablespace has been discarded for table 't5980b'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
#
# Discard tablespaces again and try ALTER TABLE ADD COLUMN.
#
ALTER TABLE t5980a DISCARD TABLESPACE;
Warnings:
Warning 1812 InnoDB: Tablespace is missing for table test/t5980a.
ALTER TABLE t5980b DISCARD TABLESPACE;
Warnings:
Warning 1812 InnoDB: Tablespace is missing for table test/t5980b.
SELECT * FROM t5980a;
ERROR HY000: Tablespace has been discarded for table 't5980a'
SELECT * FROM t5980b;
ERROR HY000: Tablespace has been discarded for table 't5980b'
#
# ALTER TABLE ALGORITHM=COPY cannot use a discarded tablespace.
#
ALTER TABLE t5980a ADD COLUMN c CHAR(20), ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980a'
ALTER TABLE t5980b ADD COLUMN c CHAR(20), ALGORITHM=COPY;
ERROR HY000: Tablespace has been discarded for table 't5980b'
#
# ALTER TABLE ALGORITHM=INPLACE can use a discarded tablespace.
# only if a rebuild is not required.
#
ALTER TABLE t5980a ADD COLUMN c CHAR(20), ALGORITHM=INPLACE;
ERROR HY000: Tablespace has been discarded for table 'test/t5980a'
ALTER TABLE t5980b ADD COLUMN c CHAR(20), ALGORITHM=INPLACE;
ERROR HY000: Tablespace has been discarded for table 'test/t5980b'
#
# Discarded tablespaces that were ALTERED IN_PLACE are still discarded.
#
DELETE FROM t5980a;
ERROR HY000: Tablespace has been discarded for table 't5980a'
UPDATE t5980a SET b="Tablespace is DISCARDED";
ERROR HY000: Tablespace has been discarded for table 't5980a'
INSERT INTO t5980a VALUES (1, "Inserted into discarded local tablespace after ALTER ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE");
ERROR HY000: Tablespace has been discarded for table 't5980a'
INSERT INTO t5980b VALUES (1, "Inserted into discarded local tablespace after ALTER ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE");
ERROR HY000: Tablespace has been discarded for table 't5980b'
SELECT * FROM t5980a;
ERROR HY000: Tablespace has been discarded for table 't5980a'
SELECT * FROM t5980b;
ERROR HY000: Tablespace has been discarded for table 't5980b'
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
DROP TABLE t5980a;
DROP TABLE t5980b;
DROP TABLE t5980c;
DROP TABLE t5980d;
=== information_schema.innodb_tables and innodb_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
mtr/asserted_test_suppressions mtr/asserted_test_suppressions 33 4 Dynamic 0 Single
mtr/global_suppressions mtr/global_suppressions 33 4 Dynamic 0 Single
mtr/test_ignored_global_suppressions mtr/test_ignored_global_suppressions 33 4 Dynamic 0 Single
mtr/test_suppressions mtr/test_suppressions 33 4 Dynamic 0 Single
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name Space_Type Page_Size Zip_Size BlockSize!=0 FileSize!=0 Formats_Permitted Path
mtr/asserted_test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions Single DEFAULT 0 1 1 Dynamic MYSQLD_DATADIR/mtr/test_suppressions.ibd
=== information_schema.files ===
Space_Name File_Type Engine Status Tablespace_Name Path
mtr/asserted_test_suppressions TABLESPACE InnoDB NORMAL mtr/asserted_test_suppressions MYSQLD_DATADIR/mtr/asserted_test_suppressions.ibd
mtr/global_suppressions TABLESPACE InnoDB NORMAL mtr/global_suppressions MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_ignored_global_suppressions TABLESPACE InnoDB NORMAL mtr/test_ignored_global_suppressions MYSQLD_DATADIR/mtr/test_ignored_global_suppressions.ibd
mtr/test_suppressions TABLESPACE InnoDB NORMAL mtr/test_suppressions MYSQLD_DATADIR/mtr/test_suppressions.ibd
### files in MYSQLD_DATADIR/test
### files in MYSQL_TMP_DIR/alt_dir/test
#
# Cleanup
#
|