2014-02-02 10:00:36 +01:00
|
|
|
# Not supported in embedded
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
|
|
|
|
-- source include/have_innodb.inc
|
MDEV-12026: Implement innodb_checksum_algorithm=full_crc32
MariaDB data-at-rest encryption (innodb_encrypt_tables)
had repurposed the same unused data field that was repurposed
in MySQL 5.7 (and MariaDB 10.2) for the Split Sequence Number (SSN)
field of SPATIAL INDEX. Because of this, MariaDB was unable to
support encryption on SPATIAL INDEX pages.
Furthermore, InnoDB page checksums skipped some bytes, and there
are multiple variations and checksum algorithms. By default,
InnoDB accepts all variations of all algorithms that ever existed.
This unnecessarily weakens the page checksums.
We hereby introduce two more innodb_checksum_algorithm variants
(full_crc32, strict_full_crc32) that are special in a way:
When either setting is active, newly created data files will
carry a flag (fil_space_t::full_crc32()) that indicates that
all pages of the file will use a full CRC-32C checksum over the
entire page contents (excluding the bytes where the checksum
is stored, at the very end of the page). Such files will always
use that checksum, no matter what the parameter
innodb_checksum_algorithm is assigned to.
For old files, the old checksum algorithms will continue to be
used. The value strict_full_crc32 will be equivalent to strict_crc32
and the value full_crc32 will be equivalent to crc32.
ROW_FORMAT=COMPRESSED tables will only use the old format.
These tables do not support new features, such as larger
innodb_page_size or instant ADD/DROP COLUMN. They may be
deprecated in the future. We do not want an unnecessary
file format change for them.
The new full_crc32() format also cleans up the MariaDB tablespace
flags. We will reserve flags to store the page_compressed
compression algorithm, and to store the compressed payload length,
so that checksum can be computed over the compressed (and
possibly encrypted) stream and can be validated without
decrypting or decompressing the page.
In the full_crc32 format, there no longer are separate before-encryption
and after-encryption checksums for pages. The single checksum is
computed on the page contents that is written to the file.
We do not make the new algorithm the default for two reasons.
First, MariaDB 10.4.2 was a beta release, and the default values
of parameters should not change after beta. Second, we did not
yet implement the full_crc32 format for page_compressed pages.
This will be fixed in MDEV-18644.
This is joint work with Marko Mäkelä.
2019-02-19 21:00:00 +02:00
|
|
|
-- source include/innodb_checksum_algorithm.inc
|
2014-02-02 10:00:36 +01:00
|
|
|
|
2016-08-12 11:17:45 +03:00
|
|
|
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
|
2017-02-24 12:51:55 +02:00
|
|
|
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
|
2017-01-27 09:13:48 +02:00
|
|
|
FLUSH TABLES;
|
2016-08-12 11:17:45 +03:00
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
|
|
|
|
let $MYSQLD_DATADIR = `SELECT @@datadir`;
|
MDEV-12026: Implement innodb_checksum_algorithm=full_crc32
MariaDB data-at-rest encryption (innodb_encrypt_tables)
had repurposed the same unused data field that was repurposed
in MySQL 5.7 (and MariaDB 10.2) for the Split Sequence Number (SSN)
field of SPATIAL INDEX. Because of this, MariaDB was unable to
support encryption on SPATIAL INDEX pages.
Furthermore, InnoDB page checksums skipped some bytes, and there
are multiple variations and checksum algorithms. By default,
InnoDB accepts all variations of all algorithms that ever existed.
This unnecessarily weakens the page checksums.
We hereby introduce two more innodb_checksum_algorithm variants
(full_crc32, strict_full_crc32) that are special in a way:
When either setting is active, newly created data files will
carry a flag (fil_space_t::full_crc32()) that indicates that
all pages of the file will use a full CRC-32C checksum over the
entire page contents (excluding the bytes where the checksum
is stored, at the very end of the page). Such files will always
use that checksum, no matter what the parameter
innodb_checksum_algorithm is assigned to.
For old files, the old checksum algorithms will continue to be
used. The value strict_full_crc32 will be equivalent to strict_crc32
and the value full_crc32 will be equivalent to crc32.
ROW_FORMAT=COMPRESSED tables will only use the old format.
These tables do not support new features, such as larger
innodb_page_size or instant ADD/DROP COLUMN. They may be
deprecated in the future. We do not want an unnecessary
file format change for them.
The new full_crc32() format also cleans up the MariaDB tablespace
flags. We will reserve flags to store the page_compressed
compression algorithm, and to store the compressed payload length,
so that checksum can be computed over the compressed (and
possibly encrypted) stream and can be validated without
decrypting or decompressing the page.
In the full_crc32 format, there no longer are separate before-encryption
and after-encryption checksums for pages. The single checksum is
computed on the page contents that is written to the file.
We do not make the new algorithm the default for two reasons.
First, MariaDB 10.4.2 was a beta release, and the default values
of parameters should not change after beta. Second, we did not
yet implement the full_crc32 format for page_compressed pages.
This will be fixed in MDEV-18644.
This is joint work with Marko Mäkelä.
2019-02-19 21:00:00 +02:00
|
|
|
let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`;
|
2014-02-02 10:00:36 +01:00
|
|
|
|
|
|
|
CREATE TABLE t1
|
|
|
|
(a INT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
b char(22),
|
|
|
|
c varchar(255),
|
|
|
|
KEY (b))
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
|
|
|
|
insert into t1 (b, c) values ('Apa', 'Filler........'),
|
|
|
|
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
|
|
|
|
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
|
|
|
|
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
|
|
|
|
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
|
2017-02-24 12:51:55 +02:00
|
|
|
|
|
|
|
CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
--list_files $MYSQLD_DATADIR/test
|
2017-02-24 12:51:55 +02:00
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
FLUSH TABLE t1, t2 FOR EXPORT;
|
2014-02-02 10:00:36 +01:00
|
|
|
--echo # List before copying files
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
|
|
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
|
2017-02-24 12:51:55 +02:00
|
|
|
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg
|
|
|
|
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd
|
2014-02-02 10:00:36 +01:00
|
|
|
UNLOCK TABLES;
|
|
|
|
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
|
|
|
|
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
|
|
|
|
--echo # Restarting server
|
|
|
|
-- source include/restart_mysqld.inc
|
|
|
|
--echo # Done restarting server
|
|
|
|
--echo # List before t1 DISCARD
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--echo # List after t1 DISCARD
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
|
|
|
|
--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
ALTER TABLE t1 ENGINE InnoDB;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
|
|
|
|
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
|
|
|
|
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
|
|
|
|
DROP TABLE t1;
|
|
|
|
--remove_file $MYSQLD_TMPDIR/t1.cfg
|
|
|
|
--remove_file $MYSQLD_TMPDIR/t1.ibd
|
|
|
|
|
2017-02-24 12:51:55 +02:00
|
|
|
ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
|
|
|
|
ALTER TABLE t2 DISCARD TABLESPACE;
|
|
|
|
--echo # List after t2 DISCARD
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
--move_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
|
|
|
|
--move_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t2 IMPORT TABLESPACE;
|
|
|
|
--remove_file $MYSQLD_DATADIR/test/t2.cfg
|
MDEV-12026: Implement innodb_checksum_algorithm=full_crc32
MariaDB data-at-rest encryption (innodb_encrypt_tables)
had repurposed the same unused data field that was repurposed
in MySQL 5.7 (and MariaDB 10.2) for the Split Sequence Number (SSN)
field of SPATIAL INDEX. Because of this, MariaDB was unable to
support encryption on SPATIAL INDEX pages.
Furthermore, InnoDB page checksums skipped some bytes, and there
are multiple variations and checksum algorithms. By default,
InnoDB accepts all variations of all algorithms that ever existed.
This unnecessarily weakens the page checksums.
We hereby introduce two more innodb_checksum_algorithm variants
(full_crc32, strict_full_crc32) that are special in a way:
When either setting is active, newly created data files will
carry a flag (fil_space_t::full_crc32()) that indicates that
all pages of the file will use a full CRC-32C checksum over the
entire page contents (excluding the bytes where the checksum
is stored, at the very end of the page). Such files will always
use that checksum, no matter what the parameter
innodb_checksum_algorithm is assigned to.
For old files, the old checksum algorithms will continue to be
used. The value strict_full_crc32 will be equivalent to strict_crc32
and the value full_crc32 will be equivalent to crc32.
ROW_FORMAT=COMPRESSED tables will only use the old format.
These tables do not support new features, such as larger
innodb_page_size or instant ADD/DROP COLUMN. They may be
deprecated in the future. We do not want an unnecessary
file format change for them.
The new full_crc32() format also cleans up the MariaDB tablespace
flags. We will reserve flags to store the page_compressed
compression algorithm, and to store the compressed payload length,
so that checksum can be computed over the compressed (and
possibly encrypted) stream and can be validated without
decrypting or decompressing the page.
In the full_crc32 format, there no longer are separate before-encryption
and after-encryption checksums for pages. The single checksum is
computed on the page contents that is written to the file.
We do not make the new algorithm the default for two reasons.
First, MariaDB 10.4.2 was a beta release, and the default values
of parameters should not change after beta. Second, we did not
yet implement the full_crc32 format for page_compressed pages.
This will be fixed in MDEV-18644.
This is joint work with Marko Mäkelä.
2019-02-19 21:00:00 +02:00
|
|
|
|
|
|
|
let $error_code = ER_TABLE_SCHEMA_MISMATCH;
|
|
|
|
|
|
|
|
if ($checksum_algorithm == "full_crc32") {
|
|
|
|
let $error_code = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($checksum_algorithm == "strict_full_crc32") {
|
|
|
|
let $error_code = 0;
|
|
|
|
}
|
|
|
|
|
2017-02-24 12:51:55 +02:00
|
|
|
--replace_regex /(FSP_SPACE_FLAGS=0x)[0-9a-f]+(,.*0x)[0-9a-f]+(.*)/\1*\2*\3/
|
MDEV-12026: Implement innodb_checksum_algorithm=full_crc32
MariaDB data-at-rest encryption (innodb_encrypt_tables)
had repurposed the same unused data field that was repurposed
in MySQL 5.7 (and MariaDB 10.2) for the Split Sequence Number (SSN)
field of SPATIAL INDEX. Because of this, MariaDB was unable to
support encryption on SPATIAL INDEX pages.
Furthermore, InnoDB page checksums skipped some bytes, and there
are multiple variations and checksum algorithms. By default,
InnoDB accepts all variations of all algorithms that ever existed.
This unnecessarily weakens the page checksums.
We hereby introduce two more innodb_checksum_algorithm variants
(full_crc32, strict_full_crc32) that are special in a way:
When either setting is active, newly created data files will
carry a flag (fil_space_t::full_crc32()) that indicates that
all pages of the file will use a full CRC-32C checksum over the
entire page contents (excluding the bytes where the checksum
is stored, at the very end of the page). Such files will always
use that checksum, no matter what the parameter
innodb_checksum_algorithm is assigned to.
For old files, the old checksum algorithms will continue to be
used. The value strict_full_crc32 will be equivalent to strict_crc32
and the value full_crc32 will be equivalent to crc32.
ROW_FORMAT=COMPRESSED tables will only use the old format.
These tables do not support new features, such as larger
innodb_page_size or instant ADD/DROP COLUMN. They may be
deprecated in the future. We do not want an unnecessary
file format change for them.
The new full_crc32() format also cleans up the MariaDB tablespace
flags. We will reserve flags to store the page_compressed
compression algorithm, and to store the compressed payload length,
so that checksum can be computed over the compressed (and
possibly encrypted) stream and can be validated without
decrypting or decompressing the page.
In the full_crc32 format, there no longer are separate before-encryption
and after-encryption checksums for pages. The single checksum is
computed on the page contents that is written to the file.
We do not make the new algorithm the default for two reasons.
First, MariaDB 10.4.2 was a beta release, and the default values
of parameters should not change after beta. Second, we did not
yet implement the full_crc32 format for page_compressed pages.
This will be fixed in MDEV-18644.
This is joint work with Marko Mäkelä.
2019-02-19 21:00:00 +02:00
|
|
|
--error $error_code
|
2017-02-24 12:51:55 +02:00
|
|
|
ALTER TABLE t2 IMPORT TABLESPACE;
|
|
|
|
DROP TABLE t2;
|
|
|
|
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
SELECT @@innodb_file_per_table;
|
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
let MYSQLD_DATADIR =`SELECT @@datadir`;
|
|
|
|
|
|
|
|
# Try importing when tablespace already exists
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
--error ER_TABLESPACE_EXISTS
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Export/import on the same instance, with --innodb-file-per-table=1
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Export/import on the same instance, with --innodb-file-per-table=1
|
|
|
|
# Insert some more records to move the LSN forward and then drop the
|
|
|
|
# table and restore
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
|
|
|
|
# Move the LSN forward
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Export/import on the same instance, with --innodb-file-per-table=1
|
|
|
|
# Insert some more records to move the LSN forward and then drop the
|
|
|
|
# table and restore, this time the table has a secondary index too.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
# Move the LSN forward
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Export/import on the same instance, with --innodb-file-per-table=1
|
|
|
|
# Insert some more records to move the LSN forward and then drop the
|
|
|
|
# table and restore, this time the table has a secondary index too.
|
|
|
|
# Rename the index on the create so that the IMPORT fails, drop index
|
|
|
|
# Create with proper name and then do an IMPORT.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
# Move the LSN forward
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX x(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# This is really a name mismatch error, need better error codes.
|
|
|
|
-- error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
2019-05-08 23:12:01 +03:00
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
select count(*) from t1;
|
2014-02-02 10:00:36 +01:00
|
|
|
ALTER TABLE t1 DROP INDEX x;
|
2019-05-08 23:12:01 +03:00
|
|
|
--error ER_CANT_DROP_FIELD_OR_KEY
|
|
|
|
ALTER TABLE t1 DROP INDEX x, ALGORITHM=copy;
|
2014-02-02 10:00:36 +01:00
|
|
|
ALTER TABLE t1 ADD INDEX idx(c2);
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Export/import on the same instance, with --innodb-file-per-table=0
|
|
|
|
# This should fail because it is not supported
|
|
|
|
SET GLOBAL innodb_file_per_table = 0;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
|
|
|
|
# This should fail, InnoDB should return a warning
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Tests that check for schema mismatch during IMPORT
|
|
|
|
#
|
|
|
|
|
|
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Table without the secondary index
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# This should fail because of a missing secondary index
|
|
|
|
-- error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Table with an additional column
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT,
|
|
|
|
c3 INT, INDEX idx(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# This should fail because the table has an additional column
|
|
|
|
-- error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# Change the column type of c2
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 BIGINT, INDEX idx(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# This should fail because c2 is now a BIGINT and not INT
|
|
|
|
-- error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# This should be OK.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
#
|
2018-07-30 13:13:43 +03:00
|
|
|
# EXPORT ROW_FORMAT=REDUNDANT
|
2014-02-02 10:00:36 +01:00
|
|
|
#
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2018-07-30 13:13:43 +03:00
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
# This should be OK.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
#
|
2018-07-30 13:13:43 +03:00
|
|
|
# EXPORT ROW_FORMAT=COMPACT
|
2014-02-02 10:00:36 +01:00
|
|
|
#
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2018-07-30 13:13:43 +03:00
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
# This should be OK.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
#
|
2018-07-30 13:13:43 +03:00
|
|
|
# EXPORT ROW_FORMAT=DYNAMIC
|
2014-02-02 10:00:36 +01:00
|
|
|
#
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2018-07-30 13:13:43 +03:00
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
# This should be OK.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2018-07-30 13:13:43 +03:00
|
|
|
#
|
|
|
|
# EXPORT ROW_FORMAT=COMPRESSED
|
|
|
|
#
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
|
|
|
|
|
|
INSERT INTO t1(c2) VALUES(1);
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
INSERT INTO t1(c2) SELECT c2 FROM t1;
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_backup_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
|
|
|
|
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_unlink_tablespace("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
# This should be OK.
|
|
|
|
CREATE TABLE t1(
|
|
|
|
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
|
|
|
|
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
|
|
--error ER_TABLESPACE_DISCARDED
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_discard_tablespaces("test", "t1");
|
|
|
|
ib_restore_tablespaces("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
ALTER TABLE t1 IMPORT TABLESPACE;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
|
|
|
|
perl;
|
|
|
|
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
|
|
|
ib_cleanup("test", "t1");
|
|
|
|
EOF
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2014-02-02 10:00:36 +01:00
|
|
|
call mtr.add_suppression("Got error -1 when reading table '.*'");
|
|
|
|
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
|
|
|
|
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
|
2017-01-27 09:13:48 +02:00
|
|
|
FLUSH TABLES;
|
2014-02-02 10:00:36 +01:00
|
|
|
|
|
|
|
# cleanup
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
|