Merge the server part of MySQL WL#5522 - InnoDB transportable tablespaces.

Syntax. Server support. Test cases.
InnoDB bugfixes:
* don't mess around with system sprintf's, always use my_error() for errors.
* don't use InnoDB internal error codes where OS error codes are expected.
* don't say "file not found", when it was.
This commit is contained in:
Sergei Golubchik 2014-02-02 10:00:36 +01:00
parent 65121806da
commit d929342b0f
37 changed files with 9960 additions and 145 deletions

View file

@ -633,7 +633,7 @@ drop table t1;
drop table bug29807;
--disable_query_log
call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal");
call mtr.add_suppression("InnoDB: Cannot open table test\/bug29807 from");
call mtr.add_suppression("InnoDB: Cannot open table test/bug29807 from");
--enable_query_log

View file

@ -0,0 +1,34 @@
# Test 7: Check privileges required.
#
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT) engine= InnoDB;
GRANT RELOAD, SELECT, LOCK TABLES ON *.* TO user1@localhost;
GRANT CREATE, DROP ON *.* TO user2@localhost;
GRANT RELOAD, SELECT ON *.* TO user3@localhost;
GRANT SELECT, LOCK TABLES ON *.* TO user4@localhost;
GRANT RELOAD, LOCK TABLES ON *.* TO user5@localhost;
# Connection con1 as user1
FLUSH TABLE db1.t1 FOR EXPORT;
UNLOCK TABLES;
# Connection default
# Connection con1 as user2
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
# Connection default
# Connection con1 as user3
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied for user 'user3'@'localhost' to database 'db1'
# Connection default
# Connection con1 as user4
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
# Connection default
# Connection con1 as user5
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table 't1'
# Connection default
DROP USER user1@localhost, user2@localhost, user3@localhost,
user4@localhost, user5@localhost;
DROP TABLE db1.t1;
DROP DATABASE db1;
# End of 5.6 tests

View file

@ -3,3 +3,297 @@ UNLOCK TABLES;
CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES ( REPEAT('i',1048576) );
DROP TABLE t1;
#
# WL#6168: FLUSH TABLES ... FOR EXPORT -- parser
#
# Requires innodb_file_per_table
SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
# new "EXPORT" keyword is a valid user variable name:
SET @export = 10;
# new "EXPORT" keyword is a valid SP parameter name:
CREATE PROCEDURE p1(export INT) BEGIN END;
DROP PROCEDURE p1;
# new "EXPORT" keyword is a valid local variable name:
CREATE PROCEDURE p1()
BEGIN
DECLARE export INT;
END|
DROP PROCEDURE p1;
# new "EXPORT" keyword is a valid SP name:
CREATE PROCEDURE export() BEGIN END;
DROP PROCEDURE export;
# new FLUSH TABLES ... FOR EXPORT syntax:
FLUSH TABLES FOR EXPORT;
ERROR 42000: No tables used near 'FOR EXPORT' at line 1
FLUSH TABLES WITH EXPORT;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXPORT' at line 1
CREATE TABLE t1 (i INT) engine=InnoDB;
CREATE TABLE t2 LIKE t1;
FLUSH TABLES t1,t2 WITH EXPORT;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXPORT' at line 1
FLUSH TABLES t1, t2 FOR EXPORT;
UNLOCK TABLES;
# case check
FLUSH TABLES t1, t2 for ExPoRt;
UNLOCK TABLES;
# With LOCAL keyword
FLUSH LOCAL TABLES t1, t2 FOR EXPORT;
UNLOCK TABLES;
# Tables with fully qualified names
FLUSH LOCAL TABLES test.t1, test.t2 for ExPoRt;
UNLOCK TABLES;
DROP TABLES t1, t2;
# new "EXPORT" keyword is a valid table name:
CREATE TABLE export (i INT) engine=InnoDB;
# it's ok to lock the "export" table for export:
FLUSH TABLE export FOR EXPORT;
UNLOCK TABLES;
DROP TABLE export;
#
# WL#6169 FLUSH TABLES ... FOR EXPORT -- runtime
#
# Test 1: Views, temporary tables, non-existent tables
#
CREATE VIEW v1 AS SELECT 1;
CREATE TEMPORARY TABLE t1 (a INT);
FLUSH TABLES v1 FOR EXPORT;
ERROR HY000: 'test.v1' is not BASE TABLE
FLUSH TABLES t1 FOR EXPORT;
ERROR 42S02: Table 'test.t1' doesn't exist
FLUSH TABLES non_existent FOR EXPORT;
ERROR 42S02: Table 'test.non_existent' doesn't exist
DROP TEMPORARY TABLE t1;
DROP VIEW v1;
# Test 2: Blocked by update transactions, blocks updates.
#
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
# Connection con1
START TRANSACTION;
INSERT INTO t1 VALUES (1, 1);
# Connection default
# Should be blocked
# Sending:
FLUSH TABLES t1 FOR EXPORT;
# Connection con1
COMMIT;
# Connection default
# Reaping: FLUSH TABLES t1 FOR EXPORT
# Connection con1
# Should not be blocked
INSERT INTO t2 VALUES (1);
# Should be blocked
# Sending:
INSERT INTO t1 VALUES (2, 2);
# Connection default
UNLOCK TABLES;
# Connection con1
# Reaping: INSERT INTO t1 VALUES (2, 2);
# Test 3: Read operations should not be affected.
#
START TRANSACTION;
SELECT * FROM t1;
a b
1 1
2 2
# Connection default
# Should not be blocked
FLUSH TABLES t1 FOR EXPORT;
# Connection con1
COMMIT;
# Should not be blocked
SELECT * FROM t1;
a b
1 1
2 2
# Connection default
UNLOCK TABLES;
# Test 4: Blocked by DDL, blocks DDL.
#
START TRANSACTION;
SELECT * FROM t1;
a b
1 1
2 2
# Connection con2
# Sending:
ALTER TABLE t1 ADD INDEX i1(b);
# Connection con1
# Should be blocked
FLUSH TABLE t1 FOR EXPORT;
# Connection default
COMMIT;
# Connection con2
# Reaping ALTER TABLE ...
# Connection con1
# Reaping FLUSH TABLE t1 FOR EXPORT
UNLOCK TABLES;
# Connection default
FLUSH TABLE t1 FOR EXPORT;
# Connection con2
# Should be blocked
DROP TABLE t1;
# Connection default
UNLOCK TABLES;
# Connection con2
# Reaping DROP TABLE t1
# Connection default
DROP TABLE t2;
# Test 5: Compatibilty with FLUSH TABLES WITH READ LOCK
#
CREATE TABLE t1(a INT) engine= InnoDB;
FLUSH TABLES WITH READ LOCK;
# Connection con1
# This should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Connection default
UNLOCK TABLES;
DROP TABLE t1;
# Test 6: Unsupported storage engines.
#
CREATE TABLE t1(a INT) engine= MyISAM;
FLUSH TABLE t1 FOR EXPORT;
ERROR HY000: Storage engine MyISAM of the table `test`.`t1` doesn't have this option
DROP TABLE t1;
# Connection con1
# Connection defalt
# Test 7: Check privileges required.
# in flush-innodb-notembedded.test
# Test 8: FLUSH TABLE <table_list> FOR EXPORT is incompatible
# with itself (to avoid race conditions in metadata
# file handling).
#
CREATE TABLE t1 (a INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
# Connection con1
FLUSH TABLE t1 FOR EXPORT;
# Connection default
# This should not block
FLUSH TABLE t2 FOR EXPORT;
UNLOCK TABLES;
# This should block
# Sending:
FLUSH TABLE t1 FOR EXPORT;
# Connection con1
UNLOCK TABLES;
# Connection default
# Reaping: FLUSH TABLE t1 FOR EXPORT
UNLOCK TABLES;
# Test 9: LOCK TABLES ... READ is not affected
#
LOCK TABLE t1 READ;
# Connection con1
# Should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Connection default
UNLOCK TABLES;
FLUSH TABLE t1 FOR EXPORT;
# Connection con1
# Should not block
LOCK TABLE t1 READ;
UNLOCK TABLES;
# Connection default
UNLOCK TABLES;
# Connection con1
# Connection default
DROP TABLE t1, t2;
# Test 10: Lock is released if transaction is started after doing
# 'flush table..' in same session
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
FLUSH TABLE t1 FOR EXPORT;
# error as active locks already exist
FLUSH TABLE t1 FOR EXPORT;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
# active locks will be released due to start transaction
START TRANSACTION;
# passes as start transaction released ealier locks
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE t1;
# Test 11: Test 'flush table with fully qualified table names
# and with syntax local/NO_WRITE_TO_BINLOG
# Connection con1
# Connection default
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
FLUSH LOCAL TABLES test.t1 FOR EXPORT;
# Connection con1
# Should be blocked
# Sending:
FLUSH LOCAL TABLES t1 FOR EXPORT;
# Connection default
UNLOCK TABLE;
# Connection con1
# Reaping: FLUSH LOCAL TABLES t1 FOR EXPORT
SELECT * FROM t1 ORDER BY i;
i
100
200
# Connection default
# Should be blocked
# Sending:
FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT;
# Connection con1
UNLOCK TABLES;
# Connection default
# Reaping: FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
SELECT * FROM t1 ORDER BY i;
i
100
200
UNLOCK TABLE;
DROP TABLE t1;
# Test 12: Active transaction get committed if user execute
# "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.."
# Connection default
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
START TRANSACTION;
INSERT INTO t1 VALUES (300);
# 'flush table..' commit active transaction from same session
FLUSH LOCAL TABLES test.t1 FOR EXPORT;
ROLLBACK;
SELECT * FROM t1 ORDER BY i;
i
100
200
300
START TRANSACTION;
INSERT INTO t1 VALUES (400);
# 'lock table ..' commit active transaction from same session
LOCK TABLES test.t1 READ;
ROLLBACK;
SELECT * FROM t1 ORDER BY i;
i
100
200
300
400
UNLOCK TABLES;
DROP TABLE t1;
# Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.."
# in same session
# Connection default
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
# Lock table
LOCK TABLES test.t1 WRITE;
# 'lock table ..' completes even if table lock is acquired
# in same session using 'lock table'. Previous locks are released.
LOCK TABLES test.t1 READ;
# 'flush table ..' gives error if table lock is acquired
# in same session using 'lock table ..'
FLUSH TABLES test.t1 FOR EXPORT;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
# 'lock table ..' completes even if table lock is acquired
# in same session using 'flush table'. Previous locks are released.
LOCK TABLES test.t1 WRITE;
UNLOCK TABLES;
DROP TABLE t1;
# Reset innodb_file_per_table
SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table;
# End of 5.6 tests

View file

@ -0,0 +1,126 @@
#
# Utility functions to copy files for WL#5522
#
# All the tables must be in the same database, you can call it like so:
# ib_backup_tablespaces("test", "t1", "blah", ...).
use File::Copy;
use File::Spec;
sub ib_normalize_path {
my ($path) = @_;
}
sub ib_backup_tablespace {
my ($db, $table) = @_;
my $datadir = $ENV{'MYSQLD_DATADIR'};
my $cfg_file = sprintf("%s.cfg", $table);
my $ibd_file = sprintf("%s.ibd", $table);
my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp";
my @args = (File::Spec->catfile($datadir, $db, $ibd_file),
File::Spec->catfile($tmpd, $ibd_file));
copy(@args) or die "copy @args failed: $!";
my @args = (File::Spec->catfile($datadir, $db, $cfg_file),
File::Spec->catfile($tmpd, $cfg_file));
copy(@args) or die "copy @args failed: $!";
}
sub ib_cleanup {
my ($db, $table) = @_;
my $datadir = $ENV{'MYSQLD_DATADIR'};
my $cfg_file = sprintf("%s.cfg", $table);
print "unlink: $cfg_file\n";
# These may or may not exist
unlink(File::Spec->catfile($datadir, $db, $cfg_file));
}
sub ib_unlink_tablespace {
my ($db, $table) = @_;
my $datadir = $ENV{'MYSQLD_DATADIR'};
my $ibd_file = sprintf("%s.ibd", $table);
print "unlink: $ibd_file\n";
# This may or may not exist
unlink(File::Spec->catfile($datadir, $db, $ibd_file));
ib_cleanup($db, $table);
}
sub ib_backup_tablespaces {
my ($db, @tables) = @_;
foreach my $table (@tables) {
print "backup: $table\n";
ib_backup_tablespace($db, $table);
}
}
sub ib_discard_tablespace { }
sub ib_discard_tablespaces { }
sub ib_restore_cfg_file {
my ($tmpd, $datadir, $db, $table) = @_;
my $cfg_file = sprintf("%s.cfg", $table);
my @args = (File::Spec->catfile($tmpd, $cfg_file),
File::Spec->catfile($datadir, "$db", $cfg_file));
copy(@args) or die "copy @args failed: $!";
}
sub ib_restore_ibd_file {
my ($tmpd, $datadir, $db, $table) = @_;
my $ibd_file = sprintf("%s.ibd", $table);
my @args = (File::Spec->catfile($tmpd, $ibd_file),
File::Spec->catfile($datadir, $db, $ibd_file));
copy(@args) or die "copy @args failed: $!";
}
sub ib_restore_tablespace {
my ($db, $table) = @_;
my $datadir = $ENV{'MYSQLD_DATADIR'};
my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp";
ib_restore_cfg_file($tmpd, $datadir, $db, $table);
ib_restore_ibd_file($tmpd, $datadir, $db, $table);
}
sub ib_restore_tablespaces {
my ($db, @tables) = @_;
foreach my $table (@tables) {
print "restore: $table .ibd and .cfg files\n";
ib_restore_tablespace($db, $table);
}
}
sub ib_restore_cfg_files {
my ($db, @tables) = @_;
my $datadir = $ENV{'MYSQLD_DATADIR'};
my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp";
foreach my $table (@tables) {
print "restore: $table .cfg file\n";
ib_restore_cfg_file($tmpd, $datadir, $db, $table);
}
}
sub ib_restore_ibd_files {
my ($db, @tables) = @_;
my $datadir = $ENV{'MYSQLD_DATADIR'};
my $tmpd = $ENV{'MYSQLTEST_VARDIR'} . "/tmp";
foreach my $table (@tables) {
print "restore: $table .ibd file\n";
ib_restore_ibd_file($tmpd, $datadir, $db, $table);
}
}

View file

@ -0,0 +1,21 @@
SET GLOBAL innodb_file_per_table=1;
CREATE TABLE t(a INT)ENGINE=InnoDB;
call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
call mtr.add_suppression("InnoDB: Table 'test/t'$");
call mtr.add_suppression("Could not find a valid tablespace file for");
call mtr.add_suppression("InnoDB: Tablespace open failed for '\"test\"\.\"t\"', ignored");
call mtr.add_suppression("InnoDB: Failed to find tablespace for table '\"test\"\.\"t\"' in the cache");
call mtr.add_suppression("InnoDB: Cannot delete tablespace [0-9]+.*not found");
call mtr.add_suppression("Table .*t in the InnoDB data dictionary has tablespace id .*, but tablespace with that id or name does not exist");
SELECT * FROM t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
ERROR 42S02: Table 'test.t' doesn't exist in engine
ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
ERROR 42S02: Table 'test.t1' doesn't exist
ALTER TABLE t DISCARD TABLESPACE;
Warnings:
Warning 1812 Tablespace is missing for table 'test/t'
Warning 1812 Tablespace is missing for table 't'
DROP TABLE t;

View file

@ -0,0 +1,42 @@
DROP TABLE IF EXISTS t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
INSERT INTO testdb_wl5522.t1 VALUES (1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,-92233720368.222,'aaa', 'aaaaaaaaaa','b','bbbbb','ccccc',REPEAT('d',40),REPEAT('d',40),REPEAT('d',40), 1,'1000-01-01','3000-12-31 23:59:59.99','1990-01-01 00:00:01.00','01:59:59.00','1901');
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
ERROR 23000: Column 'col18' cannot be null
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
FLUSH TABLES testdb_wl5522.t1 WITH READ LOCK;
SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
Table Op Msg_type Msg_text
testdb_wl5522.t1 check status OK
SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
SET GLOBAL INNODB_FILE_FORMAT=Antelope;
SET GLOBAL INNODB_FILE_PER_TABLE=1;

View file

@ -0,0 +1,31 @@
DROP TABLE IF EXISTS t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET AUTOCOMMIT = 0;
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1 (c1 int ) engine = Innodb;
BEGIN;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
ROLLBACK;
SELECT c1 FROM testdb_wl5522.t1;
c1
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (c1 int ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
Table Op Msg_type Msg_text
testdb_wl5522.t1 check status OK
SELECT c1 FROM testdb_wl5522.t1;
c1
SET AUTOCOMMIT = 1;
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
SET GLOBAL INNODB_FILE_FORMAT=Antelope;
SET GLOBAL INNODB_FILE_PER_TABLE=1;

View file

@ -0,0 +1,811 @@
DROP TABLE IF EXISTS t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
@@innodb_file_format
Barracuda
DROP DATABASE IF EXISTS testdb_wl5522;
Warnings:
Note 1008 Can't drop database 'testdb_wl5522'; database doesn't exist
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
SELECT c1 FROM testdb_wl5522.t1;
c1
1
123
331
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
c1
1
123
331
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
c1
1
123
331
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col1 BIT(1),
col2 BOOLEAN,
col3 TINYINT,
col4 SMALLINT,
col5 MEDIUMINT,
col6 INT,
col7 BIGINT,
col8 FLOAT (14,3) ,
col9 DOUBLE (14,3),
col10 VARCHAR(20),
col11 TEXT ,
col12 ENUM('a','b','c'),
col13 TEXT,
col14 CHAR(20) ,
col15 VARBINARY (400) ,
col16 BINARY(40),
col17 BLOB (400) ,
col18 INT NOT NULL PRIMARY KEY,
col19 DATE ,
col20 DATETIME ,
col21 TIMESTAMP ,
col22 TIME ,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
INSERT INTO testdb_wl5522.t1 VALUES
(1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,
-92233720368.222,'aaa', + 'aaaaaaaaaa','b','bbbbb','ccccc',
REPEAT('d',40),REPEAT('d',40),REPEAT('d',40),1,'1000-01-01',
'3000-12-31 23:59:59.99','1990-01-01 00:00:01.00',
'01:59:59.00','1901');
INSERT INTO testdb_wl5522.t1 VALUES
(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
ERROR 23000: Column 'col18' cannot be null
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
FLUSH TABLES testdb_wl5522.t1 WITH READ LOCK;
SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col1 BIT(1),
col2 BOOLEAN,
col3 TINYINT,
col4 SMALLINT,
col5 MEDIUMINT,
col6 INT,
col7 BIGINT,
col8 FLOAT (14,3) ,
col9 DOUBLE (14,3),
col10 VARCHAR(20),
col11 TEXT,
col12 ENUM('a','b','c'),
col13 TEXT,
col14 CHAR(20) ,
col15 VARBINARY (400) ,
col16 BINARY(40),
col17 BLOB (400) ,
col18 INT NOT NULL PRIMARY KEY,
col19 DATE ,
col20 DATETIME ,
col21 TIMESTAMP ,
col22 TIME ,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
Table Op Msg_type Msg_text
testdb_wl5522.t1 check status OK
SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
DROP TABLE testdb_wl5522.t1;
SET GLOBAL innodb_file_format='Barracuda';
CREATE TABLE testdb_wl5522.t1 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000),
col_3_text TEXT (4000),
col_4_blob BLOB (4000),
col_5_text TEXT (4000),
col_6_varchar VARCHAR (4000),
col_7_binary BINARY (255)
) ROW_FORMAT=DYNAMIC ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES(
REPEAT('a', 4000),REPEAT('o', 4000),REPEAT('a', 4000), REPEAT('o', 4000),
REPEAT('a', 4000),REPEAT('a', 4000),REPEAT('a', 255));
SELECT col_1_varbinary = REPEAT("a", 4000) ,
col_2_varchar = REPEAT("o", 4000) ,
col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
col_1_varbinary = REPEAT("a", 4000) col_2_varchar = REPEAT("o", 4000) col_3_text = REPEAT("a", 4000) col_4_blob = REPEAT("o", 4000) col_5_text = REPEAT("a", 4000) col_6_varchar = REPEAT("a", 4000) col_7_binary = REPEAT("a", 255)
1 1 1 1 1 1 1
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000),
col_3_text TEXT (4000),
col_4_blob BLOB (4000),
col_5_text TEXT (4000),
col_6_varchar VARCHAR (4000),
col_7_binary BINARY (255)
) ROW_FORMAT=DYNAMIC ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT col_1_varbinary = REPEAT("a", 4000) ,
col_2_varchar = REPEAT("o", 4000) ,
col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
col_1_varbinary = REPEAT("a", 4000) col_2_varchar = REPEAT("o", 4000) col_3_text = REPEAT("a", 4000) col_4_blob = REPEAT("o", 4000) col_5_text = REPEAT("a", 4000) col_6_varchar = REPEAT("a", 4000) col_7_binary = REPEAT("a", 255)
1 1 1 1 1 1 1
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT AUTO_INCREMENT,
col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int)) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3');
INSERT INTO testdb_wl5522.t1 (col_2_varchar) VALUES ('a4'),('a5'),('a6');
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
4 a4
5 a5
6 a6
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT AUTO_INCREMENT,
col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int)) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
4 a4
5 a5
6 a6
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1');
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO testdb_wl5522.t1(col_2_varchar) VALUES ('a101'),('a102'),('a103');
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
4 a4
5 a5
6 a6
7 a101
8 a102
9 a103
ALTER TABLE testdb_wl5522.t1 MODIFY col_1_int BIGINT;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
4 a4
5 a5
6 a6
7 a101
8 a102
9 a103
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.t1_fk (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int),
FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar)
) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3'),(4,'a4'),(5,'a5');
INSERT INTO testdb_wl5522.t1_fk VALUES (1,'a1'),(2,'a2'),(3,'a3');
SELECT * FROM testdb_wl5522.t1;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
4 a4
5 a5
SELECT * FROM testdb_wl5522.t1_fk;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
FLUSH TABLES testdb_wl5522.t1,testdb_wl5522.t1_fk FOR EXPORT;
backup: t1
backup: t1_fk
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1_fk,testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.t1_fk (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int),
FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar)
) ENGINE = Innodb;
SET foreign_key_checks = 0;
ALTER TABLE testdb_wl5522.t1_fk DISCARD TABLESPACE;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
SET foreign_key_checks = 1;
restore: t1 .ibd and .cfg files
restore: t1_fk .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
ALTER TABLE testdb_wl5522.t1_fk IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
4 a4
5 a5
SELECT * FROM testdb_wl5522.t1_fk;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
INSERT INTO testdb_wl5522.t1_fk VALUES (100,'a100');
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`testdb_wl5522`.`t1_fk`, CONSTRAINT `t1_fk_ibfk_1` FOREIGN KEY (`col_2_varchar`) REFERENCES `t1` (`col_2_varchar`))
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1_fk VALUES (4,'a4'),(5,'a5');
ROLLBACK;
SELECT * FROM testdb_wl5522.t1_fk;
col_1_int col_2_varchar
1 a1
2 a2
3 a3
DROP TABLE testdb_wl5522.t1_fk,testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int int,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2');
SELECT * FROM testdb_wl5522.t1;
col_1_int col_2_varchar
1 a1
2 a2
COMMIT;
INSERT INTO testdb_wl5522.t1 VALUES (3,'a3'),(4,'a4');
ROLLBACK;
INSERT INTO testdb_wl5522.t1 VALUES (5,'a5'),(6,'a6');
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
col_1_int col_2_varchar
1 a1
2 a2
5 a5
6 a6
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int int,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
SET AUTOCOMMIT = 0;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
INSERT INTO testdb_wl5522.t1 VALUES (7,'a7'),(8,'a8');
COMMIT;
INSERT INTO testdb_wl5522.t1 VALUES (9,'a9'),(10,'a10');
ROLLBACK;
INSERT INTO testdb_wl5522.t1 VALUES (11,'a11'),(12,'a12');
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
col_1_int col_2_varchar
1 a1
2 a2
5 a5
6 a6
7 a7
8 a8
11 a11
12 a12
SET AUTOCOMMIT = 1;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (100),(200),(300);
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
i
100
200
300
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
i
100
200
300
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (101),(102),(103);
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
i
100
101
102
103
200
300
SET AUTOCOMMIT = 1;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (100),(200),(300);
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
i
100
200
300
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Column i precise type mismatch.)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Tablespace for table 't1' exists. Please DISCARD the tablespace before IMPORT.
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
i
100
200
300
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (101),(102),(103);
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
i
100
101
102
103
200
300
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (i int) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
SELECT c1 FROM testdb_wl5522.t1;
c1
1
123
331
ROLLBACK;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
c1
DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX prefix_idx ON testdb_wl5522.t1(
col_1 (50),col_2 (50),col_3 (50),
col_4 (50),col_5 (50),col_6 (50),
col_7 (50),col_8 (50),col_9 (50),
col_10 (50),col_11 (50),col_12 (50),
col_13(50));
INSERT INTO testdb_wl5522.t1 VALUES (
REPEAT("col1_00001",10),REPEAT("col2_00001",10),REPEAT("col3_00001",10),
REPEAT("col4_00001",10),REPEAT("col5_00001",10),REPEAT("col6_00001",10),
REPEAT("col7_00001",10),REPEAT("col8_00001",10),REPEAT("col9_00001",10),
REPEAT("col10_00001",10),REPEAT("col11_00001",10),REPEAT("col12_00001",10),
REPEAT("col13_00001",10),REPEAT("col14_00001",10),1);
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX prefix_idx ON testdb_wl5522.t1(
col_1 (50),col_2 (50),col_3 (50),
col_4 (50),col_5 (50),col_6 (50),
col_7 (50),col_8 (50),col_9 (50),
col_10 (50),col_11 (50),col_12 (50),
col_13(50));
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col_1);
CREATE INDEX idx2 ON testdb_wl5522.t1(col_2);
CREATE INDEX idx3 ON testdb_wl5522.t1(col_3);
CREATE INDEX idx4 ON testdb_wl5522.t1(col_4);
CREATE INDEX idx5 ON testdb_wl5522.t1(col_5);
CREATE INDEX idx6 ON testdb_wl5522.t1(col_6(255));
CREATE INDEX idx7 ON testdb_wl5522.t1(col_7(255));
CREATE INDEX idx8 ON testdb_wl5522.t1(col_8(255));
CREATE INDEX idx9 ON testdb_wl5522.t1(col_9(255));
CREATE INDEX idx10 ON testdb_wl5522.t1(col_10(255));
CREATE INDEX idx11 ON testdb_wl5522.t1(col_11(255));
CREATE INDEX idx12 ON testdb_wl5522.t1(col_12(255));
CREATE INDEX idx13 ON testdb_wl5522.t1(col_13(255));
CREATE INDEX idx14 ON testdb_wl5522.t1(col_14(255));
INSERT INTO testdb_wl5522.t1 VALUES (
REPEAT("col1_00001",10),REPEAT("col2_00001",10),REPEAT("col3_00001",10),
REPEAT("col4_00001",10),REPEAT("col5_00001",10),REPEAT("col6_00001",10),
REPEAT("col7_00001",10),REPEAT("col8_00001",10),REPEAT("col9_00001",10),
REPEAT("col10_00001",10),REPEAT("col11_00001",10),REPEAT("col12_00001",10),
REPEAT("col13_00001",10),REPEAT("col14_00001",10),1);
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col_1);
CREATE INDEX idx2 ON testdb_wl5522.t1(col_2);
CREATE INDEX idx3 ON testdb_wl5522.t1(col_3);
CREATE INDEX idx4 ON testdb_wl5522.t1(col_4);
CREATE INDEX idx5 ON testdb_wl5522.t1(col_5);
CREATE INDEX idx6 ON testdb_wl5522.t1(col_6(255));
CREATE INDEX idx7 ON testdb_wl5522.t1(col_7(255));
CREATE INDEX idx8 ON testdb_wl5522.t1(col_8(255));
CREATE INDEX idx9 ON testdb_wl5522.t1(col_9(255));
CREATE INDEX idx10 ON testdb_wl5522.t1(col_10(255));
CREATE INDEX idx11 ON testdb_wl5522.t1(col_11(255));
CREATE INDEX idx12 ON testdb_wl5522.t1(col_12(255));
CREATE INDEX idx13 ON testdb_wl5522.t1(col_13(255));
CREATE INDEX idx14 ON testdb_wl5522.t1(col_14(255));
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1(col_15) VALUES (15000),(16000);
SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000;
col_15
15000
16000
ROLLBACK;
SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000;
col_15
INSERT INTO testdb_wl5522.t1(col_15) VALUES (15000),(16000);
COMMIT;
SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000;
col_15
15000
16000
ALTER TABLE testdb_wl5522.t1 DROP INDEX idx1;
ALTER TABLE testdb_wl5522.t1 DROP INDEX idx6;
ALTER TABLE testdb_wl5522.t1 DROP INDEX idx10;
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 15000
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 16000
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx1 (col_1);
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx6 (col_1(255));
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx10 (col_10(255));
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
col_1 = REPEAT("col1_00001",10) col_2 = REPEAT("col2_00001",10) col_3 = REPEAT("col3_00001",10) col_4 = REPEAT("col4_00001",10) col_5 = REPEAT("col5_00001",10) col_6 = REPEAT("col6_00001",10) col_7 = REPEAT("col7_00001",10) col_8 = REPEAT("col8_00001",10) col_9 = REPEAT("col9_00001",10) col_10 = REPEAT("col10_00001",10) col_11 = REPEAT("col11_00001",10) col_12 = REPEAT("col12_00001",10) col_13 = REPEAT("col13_00001",10) col_14 = REPEAT("col14_00001",10) col_15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 15000
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 16000
DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) ,
col2 boolean,col3 tinyint , col4 smallint ,
col5 mediumint ,col6 int , col7 bigint ,
col8 float (14,3) ,col9 double (14,3),
col10 VARCHAR(20) CHARACTER SET utf8 ,
col11 TEXT CHARACTER SET binary ,
col12 ENUM('a','b','c') CHARACTER SET binary,
col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,
col14 CHAR(20) , col15 VARBINARY (400),
col16 BINARY(40), col17 BLOB (400),
col18 int not null primary key,
col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,
col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.trigger_table ( i int ) ENGINE = Innodb;
CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1
FOR EACH ROW INSERT INTO testdb_wl5522.trigger_table VALUES(NEW.col18);
CREATE OR REPLACE VIEW testdb_wl5522.VW1 AS SELECT * FROM testdb_wl5522.t1;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
INSERT INTO testdb_wl5522.t1 VALUES (
1,1,-128,32767,-8388608,2147483647,-9223372036854775808,92233720368.222,
-92233720368.222,'aaa','aaaaaaaaaa','b','bbbbb','ccccc',REPEAT('d',40),
REPEAT('d',40),REPEAT('d',40),1,'1000-01-01','3000-12-31 23:59:59.99',
'1990-01-01 00:00:01.00','01:59:59.00','1901');
INSERT INTO testdb_wl5522.t1 VALUES (
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
INSERT INTO testdb_wl5522.t1 VALUES (
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
ERROR 23000: Column 'col18' cannot be null
INSERT INTO testdb_wl5522.t1 VALUES (
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,1,NULL,NULL,NULL,NULL,NULL);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
SELECT * FROM testdb_wl5522.trigger_table;
i
1
3
SELECT COUNT(*) FROM testdb_wl5522.VW1;
COUNT(*)
2
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) ,
col2 boolean,col3 tinyint , col4 smallint ,
col5 mediumint ,col6 int , col7 bigint ,
col8 float (14,3) ,col9 double (14,3),
col10 VARCHAR(20) CHARACTER SET utf8 ,
col11 TEXT CHARACTER SET binary ,
col12 ENUM('a','b','c') CHARACTER SET binary,
col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,
col14 CHAR(20) , col15 VARBINARY (400),
col16 BINARY(40), col17 BLOB (400),
col18 int not null primary key,
col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,
col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT COUNT(*) FROM testdb_wl5522.t1;
COUNT(*)
2
SELECT * FROM testdb_wl5522.trigger_table;
i
1
3
SELECT COUNT(*) FROM testdb_wl5522.VW1;
COUNT(*)
2
INSERT INTO testdb_wl5522.t1(col18) VALUES (5);
SELECT * FROM testdb_wl5522.trigger_table;
i
1
3
UPDATE testdb_wl5522.t1 SET col18=10 WHERE col18=1;
SELECT COUNT(*) FROM testdb_wl5522.VW1;
COUNT(*)
3
SELECT COUNT(*) FROM testdb_wl5522.t1 WHERE col18=10;
COUNT(*)
1
ALTER TABLE testdb_wl5522.t1 ADD COLUMN col24 varbinary(40) default null;
INSERT INTO testdb_wl5522.t1(col18,col24) VALUES (6,REPEAT('a',10));
SELECT col24,col18 FROM testdb_wl5522.t1 WHERE col18 in (6,1,10) ORDER BY col18;
col24 col18
aaaaaaaaaa 6
NULL 10
ALTER TABLE testdb_wl5522.t1 DROP INDEX prefix_idx;
SELECT col18,col14 FROM testdb_wl5522.t1 WHERE col14 like '_ccc%';
col18 col14
10 ccccc
ALTER TABLE testdb_wl5522.t1 ADD INDEX prefix_idx (col24(10));
SELECT col18,col24 FROM testdb_wl5522.t1 WHERE col24 like '_a_a%';
col18 col24
6 aaaaaaaaaa
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
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");
SET GLOBAL INNODB_FILE_FORMAT=Antelope;
SET GLOBAL INNODB_FILE_PER_TABLE=1;

View file

@ -0,0 +1,580 @@
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
@@innodb_file_format
Barracuda
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
@@SESSION.innodb_strict_mode
1
DROP DATABASE IF EXISTS test_wl5522;
Warnings:
Note 1008 Can't drop database 'test_wl5522'; database doesn't exist
CREATE DATABASE test_wl5522;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
SELECT * FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_import_before_commit_crash";
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
unlink: t1.ibd
unlink: t1.cfg
# Restart and reconnect to the server
SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
@@innodb_file_format
Barracuda
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
@@SESSION.innodb_strict_mode
1
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
Table Op Msg_type Msg_text
test_wl5522.t1 check status OK
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
4
INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
SELECT * FROM test_wl5522.t1;
c1
1
2
3
4
400
500
600
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_internal_error";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: While updating the <space, root page number> of index "GEN_CLUST_INDEX" - Generic error
SET SESSION debug_dbug="-d,ib_import_internal_error";
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Too many concurrent transactions
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_cluster_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure";
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
(1, REPEAT('a', 2048), REPEAT('a', 2048)),
(2, REPEAT('b', 2048), REPEAT('b', 2048)),
(3, REPEAT('c', 2048), REPEAT('c', 2048)),
(4, REPEAT('d', 2048), REPEAT('d', 2048));
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
DELETE FROM test_wl5522.t1 WHERE c2 = 1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
SHOW CREATE TABLE test_wl5522.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
`c2` bigint(20) DEFAULT NULL,
`c3` varchar(2048) DEFAULT NULL,
`c4` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
SELECT c1, c2 FROM test_wl5522.t1;
c1 c2
2 32
3 48
4 64
6 92
7 108
8 124
13 197
14 213
15 229
17 257
18 273
19 289
28 422
29 438
30 454
32 482
33 498
34 514
36 542
37 558
38 574
40 602
41 618
42 634
59 887
60 903
61 919
63 947
64 963
65 979
67 1007
68 1023
69 1039
71 1067
72 1083
73 1099
75 1127
76 1143
77 1159
79 1187
80 1203
81 1219
83 1247
84 1263
85 1279
87 1307
88 1323
89 1339
122 1832
123 1848
124 1864
126 1892
127 1908
128 1924
130 1952
131 1968
132 1984
134 2012
135 2028
136 2044
138 2072
139 2088
140 2104
142 2132
143 2148
144 2164
146 2192
147 2208
148 2224
150 2252
151 2268
152 2284
154 2312
155 2328
156 2344
158 2372
159 2388
160 2404
162 2432
163 2448
164 2464
166 2492
167 2508
168 2524
170 2552
171 2568
172 2584
174 2612
175 2628
176 2644
178 2672
179 2688
180 2704
182 2732
183 2748
184 2764
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
96
SELECT SUM(c2) FROM test_wl5522.t1;
SUM(c2)
145278
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
name
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges' AND count > 0;
name
ibuf_merges
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
name
SET GLOBAL innodb_disable_background_merge=OFF;
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SELECT c1, c2 FROM test_wl5522.t1;
c1 c2
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
Table Op Msg_type Msg_text
test_wl5522.t1 check status OK
SELECT c1,c2 FROM test_wl5522.t1;
c1 c2
2 32
3 48
4 64
6 92
7 108
8 124
13 197
14 213
15 229
17 257
18 273
19 289
28 422
29 438
30 454
32 482
33 498
34 514
36 542
37 558
38 574
40 602
41 618
42 634
59 887
60 903
61 919
63 947
64 963
65 979
67 1007
68 1023
69 1039
71 1067
72 1083
73 1099
75 1127
76 1143
77 1159
79 1187
80 1203
81 1219
83 1247
84 1263
85 1279
87 1307
88 1323
89 1339
122 1832
123 1848
124 1864
126 1892
127 1908
128 1924
130 1952
131 1968
132 1984
134 2012
135 2028
136 2044
138 2072
139 2088
140 2104
142 2132
143 2148
144 2164
146 2192
147 2208
148 2224
150 2252
151 2268
152 2284
154 2312
155 2328
156 2344
158 2372
159 2388
160 2404
162 2432
163 2448
164 2464
166 2492
167 2508
168 2524
170 2552
171 2568
172 2584
174 2612
175 2628
176 2644
178 2672
179 2688
180 2704
182 2732
183 2748
184 2764
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
96
SELECT SUM(c2) FROM test_wl5522.t1;
SUM(c2)
145278
SHOW CREATE TABLE test_wl5522.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
`c2` bigint(20) DEFAULT NULL,
`c3` varchar(2048) DEFAULT NULL,
`c4` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
INSERT INTO test_wl5522.t1 VALUES
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
Warnings:
Warning 1265 Data truncated for column 'c2' at row 1
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
256
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index "GEN_CLUST_INDEX"
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
Warnings:
Warning 1814 Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="-d,ib_import_create_index_failure_1";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fil_space_create_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,fil_space_create_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Unsupported
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
DROP DATABASE test_wl5522;
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
SET GLOBAL INNODB_FILE_PER_TABLE=1;
SET GLOBAL INNODB_FILE_FORMAT=Antelope;
SET SESSION innodb_strict_mode=0;

View file

@ -0,0 +1,925 @@
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
DROP DATABASE IF EXISTS test_wl5522;
Warnings:
Note 1008 Can't drop database 'test_wl5522'; database doesn't exist
CREATE DATABASE test_wl5522;
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_discard_before_commit_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_discard_after_commit_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
SELECT * FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="-d,ib_import_before_commit_crash";
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
unlink: t1.ibd
unlink: t1.cfg
# Restart and reconnect to the server
SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
Table Op Msg_type Msg_text
test_wl5522.t1 check status OK
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
4
INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
SELECT * FROM test_wl5522.t1;
c1
1
2
3
4
400
500
600
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_1";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_1";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_2";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_2";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_3";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_3";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_4";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_4";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_5";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_5";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_6";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_6";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_7";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_7";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_8";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_8";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_9";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_9";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_10";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_10";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_11";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_11";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_12";
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug="-d,ib_export_io_write_failure_12";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (100), (200), (300);
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
3
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_1";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading index fields.
SET SESSION debug_dbug="-d,ib_import_io_read_error_1";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_2";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes
SET SESSION debug_dbug="-d,ib_import_io_read_error_2";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_3";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading number of indexes.
SET SESSION debug_dbug="-d,ib_import_io_read_error_3";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_4";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading table column meta-data.
SET SESSION debug_dbug="-d,ib_import_io_read_error_4";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_5";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data export hostname length.
SET SESSION debug_dbug="-d,ib_import_io_read_error_5";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_6";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data table name length.
SET SESSION debug_dbug="-d,ib_import_io_read_error_6";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_7";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading autoinc value.
SET SESSION debug_dbug="-d,ib_import_io_read_error_7";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_8";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data header.
SET SESSION debug_dbug="-d,ib_import_io_read_error_8";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_io_read_error_9";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data version.
SET SESSION debug_dbug="-d,ib_import_io_read_error_9";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_string_read_error";
restore: t1 .cfg file
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while parsing export hostname.
SET SESSION debug_dbug="-d,ib_import_string_read_error";
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_1";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_1";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_2";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_2";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_4";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_4";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_5";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_5";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_6";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_6";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_7";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_7";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_8";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_8";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_9";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_9";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_10";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug="-d,ib_import_OOM_10";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_internal_error";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: While updating the <space, root page number> of index "GEN_CLUST_INDEX" - Generic error
SET SESSION debug_dbug="-d,ib_import_internal_error";
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Too many concurrent transactions
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_cluster_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure";
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure";
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB;
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
(1, REPEAT('a', 2048), REPEAT('a', 2048)),
(2, REPEAT('b', 2048), REPEAT('b', 2048)),
(3, REPEAT('c', 2048), REPEAT('c', 2048)),
(4, REPEAT('d', 2048), REPEAT('d', 2048));
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
DELETE FROM test_wl5522.t1 WHERE c2 = 1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
SHOW CREATE TABLE test_wl5522.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
`c2` bigint(20) DEFAULT NULL,
`c3` varchar(2048) DEFAULT NULL,
`c4` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1
SELECT c1, c2 FROM test_wl5522.t1;
c1 c2
2 32
3 48
4 64
6 92
7 108
8 124
13 197
14 213
15 229
17 257
18 273
19 289
28 422
29 438
30 454
32 482
33 498
34 514
36 542
37 558
38 574
40 602
41 618
42 634
59 887
60 903
61 919
63 947
64 963
65 979
67 1007
68 1023
69 1039
71 1067
72 1083
73 1099
75 1127
76 1143
77 1159
79 1187
80 1203
81 1219
83 1247
84 1263
85 1279
87 1307
88 1323
89 1339
122 1832
123 1848
124 1864
126 1892
127 1908
128 1924
130 1952
131 1968
132 1984
134 2012
135 2028
136 2044
138 2072
139 2088
140 2104
142 2132
143 2148
144 2164
146 2192
147 2208
148 2224
150 2252
151 2268
152 2284
154 2312
155 2328
156 2344
158 2372
159 2388
160 2404
162 2432
163 2448
164 2464
166 2492
167 2508
168 2524
170 2552
171 2568
172 2584
174 2612
175 2628
176 2644
178 2672
179 2688
180 2704
182 2732
183 2748
184 2764
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
96
SELECT SUM(c2) FROM test_wl5522.t1;
SUM(c2)
145278
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
name
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges' AND count > 0;
name
ibuf_merges
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
name
SET GLOBAL innodb_disable_background_merge=OFF;
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB;
SELECT c1, c2 FROM test_wl5522.t1;
c1 c2
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
Table Op Msg_type Msg_text
test_wl5522.t1 check status OK
SELECT c1,c2 FROM test_wl5522.t1;
c1 c2
2 32
3 48
4 64
6 92
7 108
8 124
13 197
14 213
15 229
17 257
18 273
19 289
28 422
29 438
30 454
32 482
33 498
34 514
36 542
37 558
38 574
40 602
41 618
42 634
59 887
60 903
61 919
63 947
64 963
65 979
67 1007
68 1023
69 1039
71 1067
72 1083
73 1099
75 1127
76 1143
77 1159
79 1187
80 1203
81 1219
83 1247
84 1263
85 1279
87 1307
88 1323
89 1339
122 1832
123 1848
124 1864
126 1892
127 1908
128 1924
130 1952
131 1968
132 1984
134 2012
135 2028
136 2044
138 2072
139 2088
140 2104
142 2132
143 2148
144 2164
146 2192
147 2208
148 2224
150 2252
151 2268
152 2284
154 2312
155 2328
156 2344
158 2372
159 2388
160 2404
162 2432
163 2448
164 2464
166 2492
167 2508
168 2524
170 2552
171 2568
172 2584
174 2612
175 2628
176 2644
178 2672
179 2688
180 2704
182 2732
183 2748
184 2764
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
96
SELECT SUM(c2) FROM test_wl5522.t1;
SUM(c2)
145278
SHOW CREATE TABLE test_wl5522.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
`c2` bigint(20) DEFAULT NULL,
`c3` varchar(2048) DEFAULT NULL,
`c4` varchar(2048) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=latin1
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
INSERT INTO test_wl5522.t1 VALUES
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
Warnings:
Warning 1265 Data truncated for column 'c2' at row 1
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
COUNT(*)
256
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption
SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index "GEN_CLUST_INDEX"
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
Warnings:
Warning 1814 Tablespace has been discarded for table 't1'
SET SESSION debug_dbug="-d,ib_import_create_index_failure_1";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fil_space_create_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,fil_space_create_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
SELECT COUNT(*) FROM test_wl5522.t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Unsupported
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
DROP TABLE test_wl5522.t1;
unlink: t1.ibd
unlink: t1.cfg
DROP DATABASE test_wl5522;
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
SET GLOBAL INNODB_FILE_PER_TABLE=1;

View file

@ -0,0 +1,503 @@
DROP TABLE IF EXISTS t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
@@innodb_file_format
Barracuda
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
@@SESSION.innodb_strict_mode
1
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
b char(22),
c varchar(255),
KEY (b))
ENGINE = InnoDB ROW_FORMAT=COMPRESSED ;
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;
COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
819 Apa Filler........
814 Apa Filler........
809 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
t1.frm
t1.ibd
# Restarting server
# Done restarting server
FLUSH TABLE t1 FOR EXPORT;
# List before copying files
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1;
COUNT(*)
1280
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
1459 Apa Filler........
1454 Apa Filler........
1449 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
1463 Evolution lsjndofiabsoibeg
1462 Devotion asdfuihknaskdf
1461 Cavalry ..asdasdfaeraf
# Restarting server
# Done restarting server
# List before t1 DISCARD
t1.frm
t1.ibd
ALTER TABLE t1 DISCARD TABLESPACE;
# List after t1 DISCARD
t1.frm
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB;
Warnings:
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
SELECT COUNT(*) FROM t1;
COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
819 Apa Filler........
814 Apa Filler........
809 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
t1.cfg
t1.frm
t1.ibd
SELECT COUNT(*) FROM t1;
COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
819 Apa Filler........
814 Apa Filler........
809 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
823 Evolution lsjndofiabsoibeg
822 Devotion asdfuihknaskdf
821 Cavalry ..asdasdfaeraf
DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
@@innodb_file_format
Barracuda
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
@@SESSION.innodb_strict_mode
1
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO t1(c2) VALUES(1);
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Tablespace for table 't1' exists. Please DISCARD the tablespace before IMPORT.
SELECT * FROM t1;
c1 c2
1 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
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;
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
COUNT(*)
16
backup: t1
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
t1.cfg
t1.frm
t1.ibd
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
16
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
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;
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
SELECT COUNT(*) FROM t1;
COUNT(*)
16
backup: t1
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
t1.frm
t1.ibd
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 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
t1.cfg
t1.frm
t1.ibd
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
16
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
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;
COUNT(*)
16
backup: t1
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
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
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT COUNT(*) FROM t1 WHERE c2 = 1;
COUNT(*)
16
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=16;
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;
COUNT(*)
16
backup: t1
UNLOCK TABLES;
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
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Index x not found in tablespace meta-data file.)
ALTER TABLE t1 DROP INDEX x;
Warnings:
Warning 1814 Tablespace has been discarded for table 't1'
ALTER TABLE t1 ADD INDEX idx(c2);
Warnings:
Warning 1814 Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
6 1
7 1
8 1
9 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
unlink: t1.cfg
DROP TABLE t1;
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;
COUNT(*)
16
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1809 Table '"test"."t1"' in system tablespace
UNLOCK TABLES;
DROP TABLE t1;
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
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;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
6 1
7 1
8 1
9 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Number of indexes don't match, table has 1 indexes but the tablespace meta-data file has 2 indexes)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT,
c3 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Number of columns don't match, table has 6 columns but the tablespace meta-data file has 5 columns)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Column c2 precise type mismatch.)
unlink: t1.ibd
unlink: t1.cfg
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=4;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch
unlink: t1.ibd
unlink: t1.cfg
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;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
unlink: t1.cfg
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
6 1
7 1
8 1
9 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
DROP TABLE t1;
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");
SET GLOBAL INNODB_FILE_FORMAT=Antelope;
SET GLOBAL INNODB_FILE_PER_TABLE=1;
SET SESSION innodb_strict_mode=0;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,46 @@
#Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING OR DISCARDED TABLESPACES
--source include/not_embedded.inc
--source include/have_innodb.inc
let $MYSQLD_DATADIR=`select @@datadir`;
SET GLOBAL innodb_file_per_table=1;
CREATE TABLE t(a INT)ENGINE=InnoDB;
# Shut down the server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server
-- source include/wait_until_disconnected.inc
# Remove the tablespace file.
let IBD=$MYSQLD_DATADIR/test/t.ibd;
perl;
unlink "$ENV{IBD}" || die "Unable to unlink $ENV{IBD}\n";
EOF
# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
call mtr.add_suppression("InnoDB: Table 'test/t'$");
call mtr.add_suppression("Could not find a valid tablespace file for");
call mtr.add_suppression("InnoDB: Tablespace open failed for '\"test\"\.\"t\"', ignored");
call mtr.add_suppression("InnoDB: Failed to find tablespace for table '\"test\"\.\"t\"' in the cache");
call mtr.add_suppression("InnoDB: Cannot delete tablespace [0-9]+.*not found");
call mtr.add_suppression("Table .*t in the InnoDB data dictionary has tablespace id .*, but tablespace with that id or name does not exist");
# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open().
# The table does exist, only the tablespace does not exist.
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
--error ER_NO_SUCH_TABLE
ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
ALTER TABLE t DISCARD TABLESPACE;
DROP TABLE t;

View file

@ -0,0 +1,73 @@
-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
#SET GLOBAL innodb_file_format = `Barracuda`;
#SELECT @@innodb_file_format;
# Export/import on the same instance, with --innodb-file-per-table=1
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
INSERT INTO testdb_wl5522.t1 VALUES (1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,-92233720368.222,'aaa', 'aaaaaaaaaa','b','bbbbb','ccccc',REPEAT('d',40),REPEAT('d',40),REPEAT('d',40), 1,'1000-01-01','3000-12-31 23:59:59.99','1990-01-01 00:00:01.00','01:59:59.00','1901');
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
--error ER_BAD_NULL_ERROR
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
--error ER_DUP_ENTRY
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL);
FLUSH TABLES testdb_wl5522.t1 WITH READ LOCK;
SELECT COUNT(*) FROM testdb_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
SELECT COUNT(*) FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;

View file

@ -0,0 +1,52 @@
-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET AUTOCOMMIT = 0;
# Export/import on the same instance, with --innodb-file-per-table=1
CREATE DATABASE testdb_wl5522;
CREATE TABLE testdb_wl5522.t1 (c1 int ) engine = Innodb;
BEGIN;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
ROLLBACK;
SELECT c1 FROM testdb_wl5522.t1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (c1 int ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
SELECT c1 FROM testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;

View file

@ -0,0 +1,952 @@
# Not supported in embedded
--source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
# Following testcases are created from JET cases (where import
# export instance are differnt server )
# Here test will be run on same import and export instance.
DROP DATABASE IF EXISTS testdb_wl5522;
CREATE DATABASE testdb_wl5522;
# case 1
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
SELECT c1 FROM testdb_wl5522.t1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
DROP TABLE testdb_wl5522.t1;
# case 2
CREATE TABLE testdb_wl5522.t1 (
col1 BIT(1),
col2 BOOLEAN,
col3 TINYINT,
col4 SMALLINT,
col5 MEDIUMINT,
col6 INT,
col7 BIGINT,
col8 FLOAT (14,3) ,
col9 DOUBLE (14,3),
col10 VARCHAR(20),
col11 TEXT ,
col12 ENUM('a','b','c'),
col13 TEXT,
col14 CHAR(20) ,
col15 VARBINARY (400) ,
col16 BINARY(40),
col17 BLOB (400) ,
col18 INT NOT NULL PRIMARY KEY,
col19 DATE ,
col20 DATETIME ,
col21 TIMESTAMP ,
col22 TIME ,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
INSERT INTO testdb_wl5522.t1 VALUES
(1,1,-128,32767,-8388608,2147483647,-9223372036854775808, 92233720368.222,
-92233720368.222,'aaa', + 'aaaaaaaaaa','b','bbbbb','ccccc',
REPEAT('d',40),REPEAT('d',40),REPEAT('d',40),1,'1000-01-01',
'3000-12-31 23:59:59.99','1990-01-01 00:00:01.00',
'01:59:59.00','1901');
INSERT INTO testdb_wl5522.t1 VALUES
(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
--error 1048
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
--error 1062
INSERT INTO testdb_wl5522.t1 VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL);
FLUSH TABLES testdb_wl5522.t1 WITH READ LOCK;
SELECT COUNT(*) FROM testdb_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col1 BIT(1),
col2 BOOLEAN,
col3 TINYINT,
col4 SMALLINT,
col5 MEDIUMINT,
col6 INT,
col7 BIGINT,
col8 FLOAT (14,3) ,
col9 DOUBLE (14,3),
col10 VARCHAR(20),
col11 TEXT,
col12 ENUM('a','b','c'),
col13 TEXT,
col14 CHAR(20) ,
col15 VARBINARY (400) ,
col16 BINARY(40),
col17 BLOB (400) ,
col18 INT NOT NULL PRIMARY KEY,
col19 DATE ,
col20 DATETIME ,
col21 TIMESTAMP ,
col22 TIME ,
col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE testdb_wl5522.t1;
SELECT COUNT(*) FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
# case 3 - with blob objects
SET GLOBAL innodb_file_format='Barracuda';
CREATE TABLE testdb_wl5522.t1 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000),
col_3_text TEXT (4000),
col_4_blob BLOB (4000),
col_5_text TEXT (4000),
col_6_varchar VARCHAR (4000),
col_7_binary BINARY (255)
) ROW_FORMAT=DYNAMIC ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES(
REPEAT('a', 4000),REPEAT('o', 4000),REPEAT('a', 4000), REPEAT('o', 4000),
REPEAT('a', 4000),REPEAT('a', 4000),REPEAT('a', 255));
SELECT col_1_varbinary = REPEAT("a", 4000) ,
col_2_varchar = REPEAT("o", 4000) ,
col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000),
col_3_text TEXT (4000),
col_4_blob BLOB (4000),
col_5_text TEXT (4000),
col_6_varchar VARCHAR (4000),
col_7_binary BINARY (255)
) ROW_FORMAT=DYNAMIC ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT col_1_varbinary = REPEAT("a", 4000) ,
col_2_varchar = REPEAT("o", 4000) ,
col_3_text = REPEAT("a", 4000) ,
col_4_blob = REPEAT("o", 4000) ,
col_5_text = REPEAT("a", 4000) ,
col_6_varchar = REPEAT("a", 4000) ,
col_7_binary = REPEAT("a", 255)
FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
# case 4 - trasportable tablesace with autoincrement
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT AUTO_INCREMENT,
col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int)) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3');
INSERT INTO testdb_wl5522.t1 (col_2_varchar) VALUES ('a4'),('a5'),('a6');
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT AUTO_INCREMENT,
col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int)) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
# error on inserting duplicate value
--error 1062
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1');
# insert new values
INSERT INTO testdb_wl5522.t1(col_2_varchar) VALUES ('a101'),('a102'),('a103');
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
# check table can be altered
ALTER TABLE testdb_wl5522.t1 MODIFY col_1_int BIGINT;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
DROP TABLE testdb_wl5522.t1;
# case 5 - check with primary and foreign key
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.t1_fk (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int),
FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar)
) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2'),(3,'a3'),(4,'a4'),(5,'a5');
INSERT INTO testdb_wl5522.t1_fk VALUES (1,'a1'),(2,'a2'),(3,'a3');
SELECT * FROM testdb_wl5522.t1;
SELECT * FROM testdb_wl5522.t1_fk;
FLUSH TABLES testdb_wl5522.t1,testdb_wl5522.t1_fk FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
ib_backup_tablespaces("testdb_wl5522", "t1_fk");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1_fk,testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
CREATE TABLE testdb_wl5522.t1_fk (
col_1_int INT,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_1_int),
FOREIGN KEY (col_2_varchar) REFERENCES testdb_wl5522.t1(col_2_varchar)
) ENGINE = Innodb;
# Alter table discrad table is not allowed with foreign_key_checks = 1
SET foreign_key_checks = 0;
ALTER TABLE testdb_wl5522.t1_fk DISCARD TABLESPACE;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
SET foreign_key_checks = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_discard_tablespaces("testdb_wl5522", "t1_fk");
ib_restore_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1_fk");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
ALTER TABLE testdb_wl5522.t1_fk IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1;
SELECT * FROM testdb_wl5522.t1_fk;
# Enter Invalid value: PK-FK relationship violation
--error 1452
INSERT INTO testdb_wl5522.t1_fk VALUES (100,'a100');
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1_fk VALUES (4,'a4'),(5,'a5');
ROLLBACK;
SELECT * FROM testdb_wl5522.t1_fk;
DROP TABLE testdb_wl5522.t1_fk,testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
# case 6 - transporatbale tablespace with transactions
CREATE TABLE testdb_wl5522.t1 (
col_1_int int,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (1,'a1'),(2,'a2');
SELECT * FROM testdb_wl5522.t1;
COMMIT;
INSERT INTO testdb_wl5522.t1 VALUES (3,'a3'),(4,'a4');
ROLLBACK;
INSERT INTO testdb_wl5522.t1 VALUES (5,'a5'),(6,'a6');
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (
col_1_int int,col_2_varchar VARCHAR (20),
PRIMARY KEY (col_2_varchar)) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
SET AUTOCOMMIT = 0;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
INSERT INTO testdb_wl5522.t1 VALUES (7,'a7'),(8,'a8');
COMMIT;
INSERT INTO testdb_wl5522.t1 VALUES (9,'a9'),(10,'a10');
ROLLBACK;
INSERT INTO testdb_wl5522.t1 VALUES (11,'a11'),(12,'a12');
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY col_1_int;
SET AUTOCOMMIT = 1;
DROP TABLE testdb_wl5522.t1;
#case 7 - transpotable tablespace with transaction(earlier failed with jet)
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (100),(200),(300);
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (101),(102),(103);
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
SET AUTOCOMMIT = 1;
DROP TABLE testdb_wl5522.t1;
# case 8 - negative cases
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
INSERT INTO testdb_wl5522.t1 VALUES (100),(200),(300);
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
# try if we can flush again
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
# create table with incorrect schema
CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
# error as mismatch in column data type
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
# explicilty delet idb file before creating table with correct schema
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("testdb_wl5522", "t1");
EOF
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 ( i int ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
# Import should succeed
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
# Try to import twice
--error 1813
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (101),(102),(103);
COMMIT;
SELECT * FROM testdb_wl5522.t1 ORDER BY i;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (i int) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
# do not delete ibt file and try to import
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
#--error 1000
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
# case 9 - empty table import
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1 VALUES (1),(123),(331);
SELECT c1 FROM testdb_wl5522.t1;
ROLLBACK;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (c1 INT ) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT * FROM testdb_wl5522.t1 ORDER BY c1;
DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
# case 10 - tt with prefix index
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX prefix_idx ON testdb_wl5522.t1(
col_1 (50),col_2 (50),col_3 (50),
col_4 (50),col_5 (50),col_6 (50),
col_7 (50),col_8 (50),col_9 (50),
col_10 (50),col_11 (50),col_12 (50),
col_13(50));
INSERT INTO testdb_wl5522.t1 VALUES (
REPEAT("col1_00001",10),REPEAT("col2_00001",10),REPEAT("col3_00001",10),
REPEAT("col4_00001",10),REPEAT("col5_00001",10),REPEAT("col6_00001",10),
REPEAT("col7_00001",10),REPEAT("col8_00001",10),REPEAT("col9_00001",10),
REPEAT("col10_00001",10),REPEAT("col11_00001",10),REPEAT("col12_00001",10),
REPEAT("col13_00001",10),REPEAT("col14_00001",10),1);
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX prefix_idx ON testdb_wl5522.t1(
col_1 (50),col_2 (50),col_3 (50),
col_4 (50),col_5 (50),col_6 (50),
col_7 (50),col_8 (50),col_9 (50),
col_10 (50),col_11 (50),col_12 (50),
col_13(50));
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
# case 11 - tt with secondary index
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col_1);
CREATE INDEX idx2 ON testdb_wl5522.t1(col_2);
CREATE INDEX idx3 ON testdb_wl5522.t1(col_3);
CREATE INDEX idx4 ON testdb_wl5522.t1(col_4);
CREATE INDEX idx5 ON testdb_wl5522.t1(col_5);
CREATE INDEX idx6 ON testdb_wl5522.t1(col_6(255));
CREATE INDEX idx7 ON testdb_wl5522.t1(col_7(255));
CREATE INDEX idx8 ON testdb_wl5522.t1(col_8(255));
CREATE INDEX idx9 ON testdb_wl5522.t1(col_9(255));
CREATE INDEX idx10 ON testdb_wl5522.t1(col_10(255));
CREATE INDEX idx11 ON testdb_wl5522.t1(col_11(255));
CREATE INDEX idx12 ON testdb_wl5522.t1(col_12(255));
CREATE INDEX idx13 ON testdb_wl5522.t1(col_13(255));
CREATE INDEX idx14 ON testdb_wl5522.t1(col_14(255));
INSERT INTO testdb_wl5522.t1 VALUES (
REPEAT("col1_00001",10),REPEAT("col2_00001",10),REPEAT("col3_00001",10),
REPEAT("col4_00001",10),REPEAT("col5_00001",10),REPEAT("col6_00001",10),
REPEAT("col7_00001",10),REPEAT("col8_00001",10),REPEAT("col9_00001",10),
REPEAT("col10_00001",10),REPEAT("col11_00001",10),REPEAT("col12_00001",10),
REPEAT("col13_00001",10),REPEAT("col14_00001",10),1);
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 VARCHAR (255),
col_4 VARCHAR (255),col_5 VARCHAR (255),
col_6 text (255), col_7 text (255),
col_8 text (255),col_9 text (255),
col_10 BLOB (255),col_11 BLOB (255),
col_12 BLOB (255), col_13 BLOB (255),
col_14 BLOB (255) , col_15 int ) ENGINE = innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col_1);
CREATE INDEX idx2 ON testdb_wl5522.t1(col_2);
CREATE INDEX idx3 ON testdb_wl5522.t1(col_3);
CREATE INDEX idx4 ON testdb_wl5522.t1(col_4);
CREATE INDEX idx5 ON testdb_wl5522.t1(col_5);
CREATE INDEX idx6 ON testdb_wl5522.t1(col_6(255));
CREATE INDEX idx7 ON testdb_wl5522.t1(col_7(255));
CREATE INDEX idx8 ON testdb_wl5522.t1(col_8(255));
CREATE INDEX idx9 ON testdb_wl5522.t1(col_9(255));
CREATE INDEX idx10 ON testdb_wl5522.t1(col_10(255));
CREATE INDEX idx11 ON testdb_wl5522.t1(col_11(255));
CREATE INDEX idx12 ON testdb_wl5522.t1(col_12(255));
CREATE INDEX idx13 ON testdb_wl5522.t1(col_13(255));
CREATE INDEX idx14 ON testdb_wl5522.t1(col_14(255));
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
# perform transaction on impoted table
SET AUTOCOMMIT = 0;
INSERT INTO testdb_wl5522.t1(col_15) VALUES (15000),(16000);
SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000;
ROLLBACK;
SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000;
INSERT INTO testdb_wl5522.t1(col_15) VALUES (15000),(16000);
COMMIT;
SELECT col_15 FROM testdb_wl5522.t1 WHERE col_15 > 11000;
# dml
ALTER TABLE testdb_wl5522.t1 DROP INDEX idx1;
ALTER TABLE testdb_wl5522.t1 DROP INDEX idx6;
ALTER TABLE testdb_wl5522.t1 DROP INDEX idx10;
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx1 (col_1);
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx6 (col_1(255));
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx10 (col_10(255));
SELECT
col_1 = REPEAT("col1_00001",10),
col_2 = REPEAT("col2_00001",10),
col_3 = REPEAT("col3_00001",10),
col_4 = REPEAT("col4_00001",10),
col_5 = REPEAT("col5_00001",10),
col_6 = REPEAT("col6_00001",10),
col_7 = REPEAT("col7_00001",10),
col_8 = REPEAT("col8_00001",10),
col_9 = REPEAT("col9_00001",10),
col_10 = REPEAT("col10_00001",10),
col_11 = REPEAT("col11_00001",10),
col_12 = REPEAT("col12_00001",10),
col_13 = REPEAT("col13_00001",10),
col_14 = REPEAT("col14_00001",10),
col_15
FROM testdb_wl5522.t1;
DROP TABLE testdb_wl5522.t1;
SET AUTOCOMMIT = 1;
# case 12 - tt with trigger / view
CREATE TABLE testdb_wl5522.t1(col1 bit(1) ,
col2 boolean,col3 tinyint , col4 smallint ,
col5 mediumint ,col6 int , col7 bigint ,
col8 float (14,3) ,col9 double (14,3),
col10 VARCHAR(20) CHARACTER SET utf8 ,
col11 TEXT CHARACTER SET binary ,
col12 ENUM('a','b','c') CHARACTER SET binary,
col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,
col14 CHAR(20) , col15 VARBINARY (400),
col16 BINARY(40), col17 BLOB (400),
col18 int not null primary key,
col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,
col22 TIME , col23 YEAR ) ENGINE = Innodb;
# table for trigger action
CREATE TABLE testdb_wl5522.trigger_table ( i int ) ENGINE = Innodb;
# define trigger
CREATE TRIGGER testdb_wl5522.tri AFTER INSERT ON testdb_wl5522.t1
FOR EACH ROW INSERT INTO testdb_wl5522.trigger_table VALUES(NEW.col18);
# define view
CREATE OR REPLACE VIEW testdb_wl5522.VW1 AS SELECT * FROM testdb_wl5522.t1;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
INSERT INTO testdb_wl5522.t1 VALUES (
1,1,-128,32767,-8388608,2147483647,-9223372036854775808,92233720368.222,
-92233720368.222,'aaa','aaaaaaaaaa','b','bbbbb','ccccc',REPEAT('d',40),
REPEAT('d',40),REPEAT('d',40),1,'1000-01-01','3000-12-31 23:59:59.99',
'1990-01-01 00:00:01.00','01:59:59.00','1901');
INSERT INTO testdb_wl5522.t1 VALUES (
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,3,NULL,NULL,NULL,NULL,NULL);
--error 1048
INSERT INTO testdb_wl5522.t1 VALUES (
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
--error 1062
INSERT INTO testdb_wl5522.t1 VALUES (
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,1,NULL,NULL,NULL,NULL,NULL);
SELECT COUNT(*) FROM testdb_wl5522.t1;
SELECT * FROM testdb_wl5522.trigger_table;
SELECT COUNT(*) FROM testdb_wl5522.VW1;
FLUSH TABLES testdb_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("testdb_wl5522", "t1");
EOF
UNLOCK TABLES;
# trigger is also dropped when table is dropped
DROP TABLE testdb_wl5522.t1;
CREATE TABLE testdb_wl5522.t1(col1 bit(1) ,
col2 boolean,col3 tinyint , col4 smallint ,
col5 mediumint ,col6 int , col7 bigint ,
col8 float (14,3) ,col9 double (14,3),
col10 VARCHAR(20) CHARACTER SET utf8 ,
col11 TEXT CHARACTER SET binary ,
col12 ENUM('a','b','c') CHARACTER SET binary,
col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,
col14 CHAR(20) , col15 VARBINARY (400),
col16 BINARY(40), col17 BLOB (400),
col18 int not null primary key,
col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,
col22 TIME , col23 YEAR ) ENGINE = Innodb;
CREATE INDEX idx1 ON testdb_wl5522.t1(col18);
CREATE INDEX prefix_idx ON testdb_wl5522.t1(col14 (10));
CREATE UNIQUE INDEX idx2 ON testdb_wl5522.t1(col12);
CREATE UNIQUE INDEX idx3 ON testdb_wl5522.t1(col8);
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("testdb_wl5522", "t1");
ib_restore_tablespaces("testdb_wl5522", "t1");
EOF
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
SELECT COUNT(*) FROM testdb_wl5522.t1;
SELECT * FROM testdb_wl5522.trigger_table;
SELECT COUNT(*) FROM testdb_wl5522.VW1;
# trigger table is not updated as trigger got dropped
INSERT INTO testdb_wl5522.t1(col18) VALUES (5);
# validate data in table not updated
SELECT * FROM testdb_wl5522.trigger_table;
UPDATE testdb_wl5522.t1 SET col18=10 WHERE col18=1;
# view shows updated data
SELECT COUNT(*) FROM testdb_wl5522.VW1;
SELECT COUNT(*) FROM testdb_wl5522.t1 WHERE col18=10;
ALTER TABLE testdb_wl5522.t1 ADD COLUMN col24 varbinary(40) default null;
INSERT INTO testdb_wl5522.t1(col18,col24) VALUES (6,REPEAT('a',10));
SELECT col24,col18 FROM testdb_wl5522.t1 WHERE col18 in (6,1,10) ORDER BY col18;
ALTER TABLE testdb_wl5522.t1 DROP INDEX prefix_idx;
SELECT col18,col14 FROM testdb_wl5522.t1 WHERE col14 like '_ccc%';
ALTER TABLE testdb_wl5522.t1 ADD INDEX prefix_idx (col24(10));
SELECT col18,col24 FROM testdb_wl5522.t1 WHERE col24 like '_a_a%';
DROP TABLE testdb_wl5522.t1;
DROP DATABASE testdb_wl5522;
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");
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
--remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.ibd
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;

View file

@ -0,0 +1,758 @@
# Not supported in embedded
--source include/not_embedded.inc
# This test case needs to crash the server. Needs a debug server.
--source include/have_debug.inc
# Don't test this under valgrind, memory leaks will occur.
--source include/not_valgrind.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
-- source include/have_innodb.inc
# compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16
# Table creatation fails if KEY_BLOCK_SIZE > innodb-page-size,so
# allow test to run only when innodb-page-size=16
--source include/have_innodb_16k.inc
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
DROP DATABASE IF EXISTS test_wl5522;
CREATE DATABASE test_wl5522;
# Create the table that we will use for crash recovery (during IMPORT)
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
INSERT INTO test_wl5522.t1 VALUES (1);
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test_wl5522", "t1");
EOF
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
##### Before commit crash
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
--error ER_TABLESPACE_DISCARDED
SELECT * FROM test_wl5522.t1;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--error 2013
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SET SESSION debug_dbug="-d,ib_import_before_commit_crash";
#### Before commit crash
# Check that the DD is consistent after recovery
##### Before checkpoint crash
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Don't start up the server right away.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--error 2013
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# After the above test the results are non-deterministic,
# delete the old tablespace files and drop the table,
# recreate the table and do a proper import.
-- source include/wait_until_disconnected.inc
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
--echo # Restart and reconnect to the server
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash";
#### Before checkpoint crash
# After the above test the results are non-deterministic, recreate the table
# and do a proper import.
DROP TABLE test_wl5522.t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
SELECT * FROM test_wl5522.t1;
DROP TABLE test_wl5522.t1;
# Test handling of internal failure error
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
SET SESSION debug_dbug="+d,ib_import_internal_error";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_internal_error";
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
DROP TABLE test_wl5522.t1;
# Test failure after reset of space id and LSN in the tablespace
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
# Test failure after attempting a tablespace open
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
--replace_regex /file: '.*t1.ibd'/'t1.ibd'/
--error ER_GET_ERRMSG
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after ibuf check
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
# Need proper mapping of error codes :-(
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure";
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after adjusting the cluster index root page
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure";
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after importing the cluster index
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_cluster_failure";
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after importing the secondary index(es)
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure";
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
# Test failure after importing the cluster index
SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure";
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure";
# Left over from the failed IMPORT
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
DROP TABLE test_wl5522.t1;
--disable_query_log
# Enable metrics for the counters we are going to use
set global innodb_monitor_enable = purge_stop_count;
set global innodb_monitor_enable = purge_resume_count;
set global innodb_monitor_enable = ibuf_merges;
set global innodb_monitor_enable = ibuf_merges_insert;
--enable_query_log
#
# Create a large table with delete marked records, disable purge during
# the update so that we can test the IMPORT purge code.
#
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
# Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
# Disable change buffer merge from the master thread, additionally
# enable aggressive flushing so that more changes are buffered.
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
(1, REPEAT('a', 2048), REPEAT('a', 2048)),
(2, REPEAT('b', 2048), REPEAT('b', 2048)),
(3, REPEAT('c', 2048), REPEAT('c', 2048)),
(4, REPEAT('d', 2048), REPEAT('d', 2048));
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
DELETE FROM test_wl5522.t1 WHERE c2 = 1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c2 = c2 + c1;
UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
SHOW CREATE TABLE test_wl5522.t1;
SELECT c1, c2 FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
SELECT SUM(c2) FROM test_wl5522.t1;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges' AND count > 0;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_inserts' AND count > 0;
SET GLOBAL innodb_disable_background_merge=OFF;
# Enable normal operation
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SELECT c1, c2 FROM test_wl5522.t1;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
CHECK TABLE test_wl5522.t1;
SELECT c1,c2 FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
SELECT SUM(c2) FROM test_wl5522.t1;
SHOW CREATE TABLE test_wl5522.t1;
DROP TABLE test_wl5522.t1;
####
# Create a table and save the tablespace and .cfg file, we need to create
# a Btree that has several levels
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
INSERT INTO test_wl5522.t1 VALUES
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
SELECT COUNT(*) FROM test_wl5522.t1;
FLUSH TABLES test_wl5522.t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test_wl5522", "t1");
EOF
UNLOCK TABLES;
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
# Following alter is not failing
#--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
--replace_regex $pathfix
--error ER_INNODB_INDEX_CORRUPT
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_NOT_KEYFILE
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
SET SESSION debug_dbug="-d,ib_import_create_index_failure_1";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,fil_space_create_failure";
--replace_regex $pathfix
--error ER_GET_ERRMSG
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,fil_space_create_failure";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
--replace_regex $pathfix
--error ER_GET_ERRMSG
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
#
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT COUNT(*) FROM test_wl5522.t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test_wl5522", "t1");
EOF
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure";
DROP TABLE test_wl5522.t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test_wl5522", "t1");
EOF
DROP DATABASE test_wl5522;
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
-- disable_warnings
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
-- enable_warnings
--disable_query_log
call mtr.add_suppression("'Resource temporarily unavailable'");
call mtr.add_suppression("Monitor ibuf_merges is already enabled");
call mtr.add_suppression("Monitor ibuf_merges_insert is already enabled");
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache.*");
call mtr.add_suppression("InnoDB: Freeing existing tablespace '.*' entry from the cache with id.*");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
call mtr.add_suppression(".*There was an error writing to the meta data file.*");
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file");
call mtr.add_suppression("Unsupported tablespace format");
call mtr.add_suppression("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\"");
call mtr.add_suppression("Page is marked as free");
call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted");
call mtr.add_suppression("but tablespace with that id or name does not exist");
call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache");
call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'");
--enable_query_log
#cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,544 @@
# Not supported in embedded
--source include/not_embedded.inc
-- source include/have_innodb.inc
# compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16
# Table creatation fails if KEY_BLOCK_SIZE > innodb-page-size,so
# allow test to run only when innodb-page-size=16
--source include/have_innodb_16k.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
b char(22),
c varchar(255),
KEY (b))
ENGINE = InnoDB ROW_FORMAT=COMPRESSED ;
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;
--list_files $MYSQLD_DATADIR/test
--echo # Restarting server
-- source include/restart_mysqld.inc
--echo # Done restarting server
FLUSH TABLE t1 FOR EXPORT;
--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
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
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
# restore session variable
SET SESSION innodb_strict_mode=1;
SELECT @@SESSION.innodb_strict_mode;
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 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
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 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
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 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
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 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
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 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
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
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
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
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
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
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
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
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
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;
ALTER TABLE t1 DROP INDEX x;
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
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;
# Table without the secondary index
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) 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
# 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
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
# 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
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
# 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 fail because KEY_BLOCK_SIZE is different
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
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 is KEY_BLOCK_SIZE=4
# but KEY_BLOCK_SIZE=8 is exported table
# Need better error message for following
--replace_regex /\(.*\)//
-- 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;
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");
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;

View file

@ -0,0 +1,884 @@
# Not supported in embedded
--source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
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;
--list_files $MYSQLD_DATADIR/test
--echo # Restarting server
-- source include/restart_mysqld.inc
--echo # Done restarting server
FLUSH TABLE t1 FOR EXPORT;
--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
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
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
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;
ALTER TABLE t1 DROP INDEX x;
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;
#
# Row format tests [EXPORT REDUNDANT - IMPORT COMPACT & DYNAMIC]
#
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;
# 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;
#
# Row format tests [EXPORT COMPACT - IMPORT REDUNDANT & DYNAMIC]
#
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;
# 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;
#
# Row format tests [EXPORT DYNAMIC- IMPORT REDUNDANT & DYNAMIC]
#
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;
# 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;
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");
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;

View file

@ -113,7 +113,7 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARN
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
NULL NULL NULL 55 32 1 2
statements_digest b7123a38bb99ce09f09d127df4e39b18 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
statements_digest 0e98ee6a98e296530ec59c12dbc08dfe TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
SHOW VARIABLES LIKE "performance_schema_digests_size";
Variable_name Value
performance_schema_digests_size 2

View file

@ -112,43 +112,43 @@ DROP TRIGGER trg;
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
statements_digest b7123a38bb99ce09f09d127df4e39b18 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
statements_digest b84133205e24517207248a0eefded78a SELECT ? FROM t1 1 0 0 0
statements_digest 88a673e6a76a2bd1ad72dddc7e9be037 SELECT ? FROM `t1` 1 0 0 0
statements_digest a885b0a3ae7886d11bfdc7c51b3d7110 SELECT ?, ... FROM t1 2 0 0 0
statements_digest e3a97cc772f0acebfe7ee5537dfcc881 SELECT ? FROM t2 1 0 0 0
statements_digest 9ecf822210da222eae9b56a0017765fc SELECT ?, ... FROM t2 2 0 0 0
statements_digest 98bbad9fba6ace6566d118333c00c67d INSERT INTO t1 VALUES (?) 1 1 0 0
statements_digest 724ab5bcd5f11b3975a65331c89443c0 INSERT INTO t2 VALUES (?) 1 1 0 0
statements_digest a351a420a8ef3b894177d2620be682ca INSERT INTO t3 VALUES (...) 4 4 0 0
statements_digest f66804d1ba3de87895f9a82c6cef04d4 INSERT INTO t4 VALUES (...) 1 1 0 0
statements_digest 797b00d27cc1a212f4f4d61d3ad11e66 INSERT INTO t5 VALUES (...) 1 1 0 0
statements_digest 90427cb3f602eaa97b1cc97c0ef16d85 INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
statements_digest 1691e787cfe88075cb3e9fd48ac4a52b INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
statements_digest cf401a585c798da2f55f72b0a99ded18 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
statements_digest 1e25bc6303e3968077c586dab9c5562c INSERT INTO t1 VALUES ( NULL ) 1 1 0 0
statements_digest 30f72e28c64b3e6ca888715a848cd085 INSERT INTO t6 VALUES (...) 5 5 0 0
statements_digest 551dce993b267c981c5b3eb285c2fe57 SELECT ? + ? 3 0 0 0
statements_digest d31e1af4dc7ed5fe3ff61c78db7b327e SELECT ? 1 0 0 0
statements_digest 33003a7b4de282603814a057945694d3 CREATE SCHEMA statements_digest_temp 2 2 0 0
statements_digest 6ce84f85f37b9996e3dcbed9d55b88dd DROP SCHEMA statements_digest_temp 2 0 0 0
statements_digest 08c862f2422dd8464a3b7b96d9de1dfa SELECT ? FROM no_such_table 1 0 0 1
statements_digest c41b789a3176e6dbd8157848c6ff4aaf CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1
statements_digest fe693f8cf543b249a89f9f76c363d9d5 DROP TABLE dup_table 1 0 0 0
statements_digest 5a6a862982ca17eff9038f2d852d848f INSERT INTO t11 VALUES (?) 1 1 1 0
statements_digest b72d811ed58c8f2ec01e110bcad3138b SHOW WARNINGS 1 0 0 0
statements_digest 63e18c50006c39c70200e63e720a9f0a PREPARE stmt FROM ? 1 0 0 0
statements_digest eac5a2c580910e14eb0894ef21a25353 EXECUTE stmt 2 0 0 0
statements_digest 5f1eaa4567c93974669fc403159245db DEALLOCATE PREPARE stmt 1 0 0 0
statements_digest acb8e84440f68ee053d486688dfc88b2 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0
statements_digest 44c11865a2c9cd9f884bca10564ac818 CALL p1 ( ) 2 0 0 0
statements_digest fb004af2d0db6f35a97ccdbbc51343ef DROP PROCEDURE p1 1 0 0 0
statements_digest 6566febd24d7b17c53f75785ce94936c CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0
statements_digest 5bc097b58c334afe0875d7b74d0eb86e SELECT func (...) 2 0 0 0
statements_digest 183cce493d199f32fad2174aab485298 DROP FUNCTION func 1 0 0 0
statements_digest b0f05e1bd191be18730e2e24801a448d CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 0 0 0
statements_digest 4a20ca3773c57af8a3949b76f446505a INSERT INTO t12 VALUES (?) 2 2 0 0
statements_digest b345f3bef14924fea5ce7129cd374576 DROP TRIGGER trg 1 0 0 0
statements_digest 0e98ee6a98e296530ec59c12dbc08dfe TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1 0 0 0
statements_digest 954f43425c3234acc8e194afd97e8a0a SELECT ? FROM t1 1 0 0 0
statements_digest fc365a54bc19d746bd24c27aba46b990 SELECT ? FROM `t1` 1 0 0 0
statements_digest 27ba28f6252e4ae0e9b14b36da536fbe SELECT ?, ... FROM t1 2 0 0 0
statements_digest 81d03922612900032ec4b81934ab4841 SELECT ? FROM t2 1 0 0 0
statements_digest adce8aec12b6b5046cd4bf55951014c7 SELECT ?, ... FROM t2 2 0 0 0
statements_digest 59a1bd93c424b10802fe66bb6dcd94d2 INSERT INTO t1 VALUES (?) 1 1 0 0
statements_digest 91b2da58b0eb49c35a38fbc49f5e491d INSERT INTO t2 VALUES (?) 1 1 0 0
statements_digest 967114adbf91d8a4a99ec5e49e909ff4 INSERT INTO t3 VALUES (...) 4 4 0 0
statements_digest 8f25e7a48487e0aa7377e816816bb658 INSERT INTO t4 VALUES (...) 1 1 0 0
statements_digest 4e51253af793867fba66166de1f314f7 INSERT INTO t5 VALUES (...) 1 1 0 0
statements_digest fa47b3109e117216cd10209690d28596 INSERT INTO t1 VALUES (?) /* , ... */ 2 7 0 0
statements_digest 72409f84bc236e6fe9f2f7b4d727f2d3 INSERT INTO t3 VALUES (...) /* , ... */ 1 3 0 0
statements_digest d40aaddb41ed794d65dd8273f0c75700 INSERT INTO t5 VALUES (...) /* , ... */ 1 3 0 0
statements_digest 57a82b28388e52e99fc64339dd30edde INSERT INTO t1 VALUES ( NULL ) 1 1 0 0
statements_digest 6a56b694106442474cb0e5fb7575c8b9 INSERT INTO t6 VALUES (...) 5 5 0 0
statements_digest c9abf55e296c4317dbaf2d14ef907ad7 SELECT ? + ? 3 0 0 0
statements_digest 156304a0851a3e3626b39fb3da841a82 SELECT ? 1 0 0 0
statements_digest 3b085ab0d2063dfca1a39212e3ea1831 CREATE SCHEMA statements_digest_temp 2 2 0 0
statements_digest 09f9fabef2feb9a54ba01455e5ae83b9 DROP SCHEMA statements_digest_temp 2 0 0 0
statements_digest 7910a63ffd31cbcb742e15270c8958c8 SELECT ? FROM no_such_table 1 0 0 1
statements_digest fa34540a438bc672478b1162505ee28c CREATE TABLE dup_table ( c CHARACTER (?) ) 2 0 0 1
statements_digest 2c720f176bb7c8510ff8aca8921b9945 DROP TABLE dup_table 1 0 0 0
statements_digest 0c7d9fd8c27ab067511da41ca3bcdff3 INSERT INTO t11 VALUES (?) 1 1 1 0
statements_digest 81681ff345065ed72bcd1e9407ab85e4 SHOW WARNINGS 1 0 0 0
statements_digest d766f5823ae5d8e4cf4602b8e7a3fb80 PREPARE stmt FROM ? 1 0 0 0
statements_digest 3ab1e87eabd9688edf919754cce6348b EXECUTE stmt 2 0 0 0
statements_digest 470094469d250b9f45cab45bf610efe8 DEALLOCATE PREPARE stmt 1 0 0 0
statements_digest 1b4d25358e08b35ad54e49dfe5eaf3e4 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1 0 0 0
statements_digest 84554971243e91106214dcb8f4eaa89b CALL p1 ( ) 2 0 0 0
statements_digest 77206e4bf30979c56752a7ed9150213a DROP PROCEDURE p1 1 0 0 0
statements_digest 03b91dcdba6b0e29f7fb240ae4bcd97f CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1 0 0 0
statements_digest 72bc532f308f2dca62f5291df8c50e6f SELECT func (...) 2 0 0 0
statements_digest 0b5a5297689c5036def6af8e8a8ce113 DROP FUNCTION func 1 0 0 0
statements_digest d08331e42c67555ece50e46eef0f2b47 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1 0 0 0
statements_digest 754a49a4de995c5a729e9ab52f135f59 INSERT INTO t12 VALUES (?) 2 2 0 0
statements_digest 68df17752bca7c2c8ee2a6a19a0674e7 DROP TRIGGER trg 1 0 0 0
####################################
# CLEANUP
####################################

View file

@ -125,43 +125,43 @@ DROP TRIGGER trg;
####################################
SELECT schema_name, digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
schema_name digest digest_text count_star
statements_digest b7123a38bb99ce09f09d127df4e39b18 TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
statements_digest b84133205e24517207248a0eefded78a SELECT ? FROM t1 1
statements_digest 88a673e6a76a2bd1ad72dddc7e9be037 SELECT ? FROM `t1` 1
statements_digest a885b0a3ae7886d11bfdc7c51b3d7110 SELECT ?, ... FROM t1 2
statements_digest e3a97cc772f0acebfe7ee5537dfcc881 SELECT ? FROM t2 1
statements_digest 9ecf822210da222eae9b56a0017765fc SELECT ?, ... FROM t2 2
statements_digest 98bbad9fba6ace6566d118333c00c67d INSERT INTO t1 VALUES (?) 1
statements_digest 724ab5bcd5f11b3975a65331c89443c0 INSERT INTO t2 VALUES (?) 1
statements_digest a351a420a8ef3b894177d2620be682ca INSERT INTO t3 VALUES (...) 4
statements_digest f66804d1ba3de87895f9a82c6cef04d4 INSERT INTO t4 VALUES (...) 1
statements_digest 797b00d27cc1a212f4f4d61d3ad11e66 INSERT INTO t5 VALUES (...) 1
statements_digest 90427cb3f602eaa97b1cc97c0ef16d85 INSERT INTO t1 VALUES (?) /* , ... */ 2
statements_digest 1691e787cfe88075cb3e9fd48ac4a52b INSERT INTO t3 VALUES (...) /* , ... */ 1
statements_digest cf401a585c798da2f55f72b0a99ded18 INSERT INTO t5 VALUES (...) /* , ... */ 1
statements_digest 1e25bc6303e3968077c586dab9c5562c INSERT INTO t1 VALUES ( NULL ) 1
statements_digest 30f72e28c64b3e6ca888715a848cd085 INSERT INTO t6 VALUES (...) 5
statements_digest 551dce993b267c981c5b3eb285c2fe57 SELECT ? + ? 3
statements_digest d31e1af4dc7ed5fe3ff61c78db7b327e SELECT ? 1
statements_digest 33003a7b4de282603814a057945694d3 CREATE SCHEMA statements_digest_temp 2
statements_digest 6ce84f85f37b9996e3dcbed9d55b88dd DROP SCHEMA statements_digest_temp 2
statements_digest 08c862f2422dd8464a3b7b96d9de1dfa SELECT ? FROM no_such_table 1
statements_digest c41b789a3176e6dbd8157848c6ff4aaf CREATE TABLE dup_table ( c CHARACTER (?) ) 2
statements_digest fe693f8cf543b249a89f9f76c363d9d5 DROP TABLE dup_table 1
statements_digest 5a6a862982ca17eff9038f2d852d848f INSERT INTO t11 VALUES (?) 1
statements_digest b72d811ed58c8f2ec01e110bcad3138b SHOW WARNINGS 1
statements_digest 63e18c50006c39c70200e63e720a9f0a PREPARE stmt FROM ? 1
statements_digest eac5a2c580910e14eb0894ef21a25353 EXECUTE stmt 2
statements_digest 5f1eaa4567c93974669fc403159245db DEALLOCATE PREPARE stmt 1
statements_digest acb8e84440f68ee053d486688dfc88b2 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1
statements_digest 44c11865a2c9cd9f884bca10564ac818 CALL p1 ( ) 2
statements_digest fb004af2d0db6f35a97ccdbbc51343ef DROP PROCEDURE p1 1
statements_digest 6566febd24d7b17c53f75785ce94936c CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1
statements_digest 5bc097b58c334afe0875d7b74d0eb86e SELECT func (...) 2
statements_digest 183cce493d199f32fad2174aab485298 DROP FUNCTION func 1
statements_digest b0f05e1bd191be18730e2e24801a448d CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1
statements_digest 4a20ca3773c57af8a3949b76f446505a INSERT INTO t12 VALUES (?) 2
statements_digest b345f3bef14924fea5ce7129cd374576 DROP TRIGGER trg 1
statements_digest 0e98ee6a98e296530ec59c12dbc08dfe TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
statements_digest 954f43425c3234acc8e194afd97e8a0a SELECT ? FROM t1 1
statements_digest fc365a54bc19d746bd24c27aba46b990 SELECT ? FROM `t1` 1
statements_digest 27ba28f6252e4ae0e9b14b36da536fbe SELECT ?, ... FROM t1 2
statements_digest 81d03922612900032ec4b81934ab4841 SELECT ? FROM t2 1
statements_digest adce8aec12b6b5046cd4bf55951014c7 SELECT ?, ... FROM t2 2
statements_digest 59a1bd93c424b10802fe66bb6dcd94d2 INSERT INTO t1 VALUES (?) 1
statements_digest 91b2da58b0eb49c35a38fbc49f5e491d INSERT INTO t2 VALUES (?) 1
statements_digest 967114adbf91d8a4a99ec5e49e909ff4 INSERT INTO t3 VALUES (...) 4
statements_digest 8f25e7a48487e0aa7377e816816bb658 INSERT INTO t4 VALUES (...) 1
statements_digest 4e51253af793867fba66166de1f314f7 INSERT INTO t5 VALUES (...) 1
statements_digest fa47b3109e117216cd10209690d28596 INSERT INTO t1 VALUES (?) /* , ... */ 2
statements_digest 72409f84bc236e6fe9f2f7b4d727f2d3 INSERT INTO t3 VALUES (...) /* , ... */ 1
statements_digest d40aaddb41ed794d65dd8273f0c75700 INSERT INTO t5 VALUES (...) /* , ... */ 1
statements_digest 57a82b28388e52e99fc64339dd30edde INSERT INTO t1 VALUES ( NULL ) 1
statements_digest 6a56b694106442474cb0e5fb7575c8b9 INSERT INTO t6 VALUES (...) 5
statements_digest c9abf55e296c4317dbaf2d14ef907ad7 SELECT ? + ? 3
statements_digest 156304a0851a3e3626b39fb3da841a82 SELECT ? 1
statements_digest 3b085ab0d2063dfca1a39212e3ea1831 CREATE SCHEMA statements_digest_temp 2
statements_digest 09f9fabef2feb9a54ba01455e5ae83b9 DROP SCHEMA statements_digest_temp 2
statements_digest 7910a63ffd31cbcb742e15270c8958c8 SELECT ? FROM no_such_table 1
statements_digest fa34540a438bc672478b1162505ee28c CREATE TABLE dup_table ( c CHARACTER (?) ) 2
statements_digest 2c720f176bb7c8510ff8aca8921b9945 DROP TABLE dup_table 1
statements_digest 0c7d9fd8c27ab067511da41ca3bcdff3 INSERT INTO t11 VALUES (?) 1
statements_digest 81681ff345065ed72bcd1e9407ab85e4 SHOW WARNINGS 1
statements_digest d766f5823ae5d8e4cf4602b8e7a3fb80 PREPARE stmt FROM ? 1
statements_digest 3ab1e87eabd9688edf919754cce6348b EXECUTE stmt 2
statements_digest 470094469d250b9f45cab45bf610efe8 DEALLOCATE PREPARE stmt 1
statements_digest 1b4d25358e08b35ad54e49dfe5eaf3e4 CREATE PROCEDURE p1 ( ) BEGIN SELECT * FROM t12 ; END 1
statements_digest 84554971243e91106214dcb8f4eaa89b CALL p1 ( ) 2
statements_digest 77206e4bf30979c56752a7ed9150213a DROP PROCEDURE p1 1
statements_digest 03b91dcdba6b0e29f7fb240ae4bcd97f CREATE FUNCTION `func` ( a INTEGER , b INTEGER ) RETURNS INTEGER (?) RETURN a + b 1
statements_digest 72bc532f308f2dca62f5291df8c50e6f SELECT func (...) 2
statements_digest 0b5a5297689c5036def6af8e8a8ce113 DROP FUNCTION func 1
statements_digest d08331e42c67555ece50e46eef0f2b47 CREATE TRIGGER trg BEFORE INSERT ON t12 FOR EACH ROW SET @ ? := ? 1
statements_digest 754a49a4de995c5a729e9ab52f135f59 INSERT INTO t12 VALUES (?) 2
statements_digest 68df17752bca7c2c8ee2a6a19a0674e7 DROP TRIGGER trg 1
SELECT digest, digest_text FROM performance_schema.events_statements_current;
digest digest_text
####################################

View file

@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT schema_name, digest, digest_text, count_star FROM events_statements_summary_by_digest;
schema_name digest digest_text count_star
performance_schema 85f61b5db68f69a59a90190e8077e4af TRUNCATE TABLE events_statements_summary_by_digest 1
performance_schema 0cc3fae5d60042494d108e9075b594d3 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1
performance_schema 9d35ff74210c6b30efa4559d627ed0f7 TRUNCATE TABLE events_statements_summary_by_digest 1
performance_schema d78a04c1c42765b8552e0483c50ae9ff SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ... 1

View file

@ -0,0 +1,69 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
--echo # Test 7: Check privileges required.
--echo #
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT) engine= InnoDB;
GRANT RELOAD, SELECT, LOCK TABLES ON *.* TO user1@localhost;
GRANT CREATE, DROP ON *.* TO user2@localhost;
GRANT RELOAD, SELECT ON *.* TO user3@localhost;
GRANT SELECT, LOCK TABLES ON *.* TO user4@localhost;
GRANT RELOAD, LOCK TABLES ON *.* TO user5@localhost;
--echo # Connection con1 as user1
--connect(con1, localhost, user1)
FLUSH TABLE db1.t1 FOR EXPORT;
UNLOCK TABLES;
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
--echo # Connection con1 as user2
--connect(con1, localhost, user2)
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
FLUSH TABLE db1.t1 FOR EXPORT;
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
--echo # Connection con1 as user3
--connect(con1, localhost, user3)
--error ER_DBACCESS_DENIED_ERROR
FLUSH TABLE db1.t1 FOR EXPORT;
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
--echo # Connection con1 as user4
--connect(con1, localhost, user4)
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
FLUSH TABLE db1.t1 FOR EXPORT;
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
--echo # Connection con1 as user5
--connect(con1, localhost, user5)
--error ER_TABLEACCESS_DENIED_ERROR
FLUSH TABLE db1.t1 FOR EXPORT;
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
DROP USER user1@localhost, user2@localhost, user3@localhost,
user4@localhost, user5@localhost;
DROP TABLE db1.t1;
DROP DATABASE db1;
--echo # End of 5.6 tests

View file

@ -7,3 +7,472 @@ CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES ( REPEAT('i',1048576) );
DROP TABLE t1;
--echo
--echo #
--echo # WL#6168: FLUSH TABLES ... FOR EXPORT -- parser
--echo #
--echo
--echo # Requires innodb_file_per_table
SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
--echo # new "EXPORT" keyword is a valid user variable name:
SET @export = 10;
--echo # new "EXPORT" keyword is a valid SP parameter name:
CREATE PROCEDURE p1(export INT) BEGIN END;
DROP PROCEDURE p1;
--echo # new "EXPORT" keyword is a valid local variable name:
DELIMITER |;
CREATE PROCEDURE p1()
BEGIN
DECLARE export INT;
END|
DELIMITER ;|
DROP PROCEDURE p1;
--echo # new "EXPORT" keyword is a valid SP name:
CREATE PROCEDURE export() BEGIN END;
DROP PROCEDURE export;
--echo # new FLUSH TABLES ... FOR EXPORT syntax:
--error ER_PARSE_ERROR
FLUSH TABLES FOR EXPORT;
--error ER_PARSE_ERROR
FLUSH TABLES WITH EXPORT;
CREATE TABLE t1 (i INT) engine=InnoDB;
CREATE TABLE t2 LIKE t1;
--error ER_PARSE_ERROR
FLUSH TABLES t1,t2 WITH EXPORT;
FLUSH TABLES t1, t2 FOR EXPORT;
UNLOCK TABLES;
--echo # case check
FLUSH TABLES t1, t2 for ExPoRt;
UNLOCK TABLES;
--echo # With LOCAL keyword
FLUSH LOCAL TABLES t1, t2 FOR EXPORT;
UNLOCK TABLES;
--echo # Tables with fully qualified names
FLUSH LOCAL TABLES test.t1, test.t2 for ExPoRt;
UNLOCK TABLES;
DROP TABLES t1, t2;
--echo # new "EXPORT" keyword is a valid table name:
CREATE TABLE export (i INT) engine=InnoDB;
--echo # it's ok to lock the "export" table for export:
FLUSH TABLE export FOR EXPORT;
UNLOCK TABLES;
DROP TABLE export;
--echo #
--echo # WL#6169 FLUSH TABLES ... FOR EXPORT -- runtime
--echo #
--echo # Test 1: Views, temporary tables, non-existent tables
--echo #
CREATE VIEW v1 AS SELECT 1;
CREATE TEMPORARY TABLE t1 (a INT);
--error ER_WRONG_OBJECT
FLUSH TABLES v1 FOR EXPORT;
--error ER_NO_SUCH_TABLE
FLUSH TABLES t1 FOR EXPORT;
--error ER_NO_SUCH_TABLE
FLUSH TABLES non_existent FOR EXPORT;
DROP TEMPORARY TABLE t1;
DROP VIEW v1;
--echo # Test 2: Blocked by update transactions, blocks updates.
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
--echo # Connection con1
--connect (con1, localhost, root)
START TRANSACTION;
INSERT INTO t1 VALUES (1, 1);
--echo # Connection default
--connection default
--echo # Should be blocked
--echo # Sending:
--send FLUSH TABLES t1 FOR EXPORT
--echo # Connection con1
--connection con1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "FLUSH TABLES t1 FOR EXPORT";
--source include/wait_condition.inc
COMMIT;
--echo # Connection default
--connection default
--echo # Reaping: FLUSH TABLES t1 FOR EXPORT
--reap
--echo # Connection con1
--connection con1
--echo # Should not be blocked
INSERT INTO t2 VALUES (1);
--echo # Should be blocked
--echo # Sending:
--send INSERT INTO t1 VALUES (2, 2)
--echo # Connection default
--connection default
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "INSERT INTO t1 VALUES (2, 2)";
--source include/wait_condition.inc
UNLOCK TABLES;
--echo # Connection con1
--connection con1
--echo # Reaping: INSERT INTO t1 VALUES (2, 2);
--reap
--echo # Test 3: Read operations should not be affected.
--echo #
START TRANSACTION;
SELECT * FROM t1;
--echo # Connection default
--connection default
--echo # Should not be blocked
FLUSH TABLES t1 FOR EXPORT;
--echo # Connection con1
--connection con1
COMMIT;
--echo # Should not be blocked
SELECT * FROM t1;
--echo # Connection default
--connection default
UNLOCK TABLES;
--echo # Test 4: Blocked by DDL, blocks DDL.
--echo #
START TRANSACTION;
SELECT * FROM t1;
--echo # Connection con2
--connect (con2, localhost, root)
--echo # Sending:
--send ALTER TABLE t1 ADD INDEX i1(b)
--echo # Connection con1
--connection con1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "ALTER TABLE t1 ADD INDEX i1(b)";
--source include/wait_condition.inc
--echo # Should be blocked
--send FLUSH TABLE t1 FOR EXPORT
--echo # Connection default
--connection default
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "FLUSH TABLE t1 FOR EXPORT";
--source include/wait_condition.inc
COMMIT;
--echo # Connection con2
--connection con2
--echo # Reaping ALTER TABLE ...
--reap
--echo # Connection con1
--connection con1
--echo # Reaping FLUSH TABLE t1 FOR EXPORT
--reap
UNLOCK TABLES;
--echo # Connection default
--connection default
FLUSH TABLE t1 FOR EXPORT;
--echo # Connection con2
--connection con2
--echo # Should be blocked
--send DROP TABLE t1
--echo # Connection default
--connection default
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "DROP TABLE t1";
--source include/wait_condition.inc
UNLOCK TABLES;
--echo # Connection con2
--connection con2
--echo # Reaping DROP TABLE t1
--reap
--disconnect con2
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
DROP TABLE t2;
--echo # Test 5: Compatibilty with FLUSH TABLES WITH READ LOCK
--echo #
CREATE TABLE t1(a INT) engine= InnoDB;
FLUSH TABLES WITH READ LOCK;
--echo # Connection con1
--connection con1
--echo # This should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
--echo # Connection default
--connection default
UNLOCK TABLES;
DROP TABLE t1;
--echo # Test 6: Unsupported storage engines.
--echo #
CREATE TABLE t1(a INT) engine= MyISAM;
--error ER_ILLEGAL_HA
FLUSH TABLE t1 FOR EXPORT;
DROP TABLE t1;
--echo # Connection con1
--connection con1
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection defalt
--connection default
--echo # Test 7: Check privileges required.
--echo # in flush-innodb-notembedded.test
--echo # Test 8: FLUSH TABLE <table_list> FOR EXPORT is incompatible
--echo # with itself (to avoid race conditions in metadata
--echo # file handling).
--echo #
CREATE TABLE t1 (a INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
--echo # Connection con1
--connect (con1, localhost, root)
FLUSH TABLE t1 FOR EXPORT;
--echo # Connection default
--connection default
--echo # This should not block
FLUSH TABLE t2 FOR EXPORT;
UNLOCK TABLES;
--echo # This should block
--echo # Sending:
--send FLUSH TABLE t1 FOR EXPORT
--echo # Connection con1
--connection con1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "FLUSH TABLE t1 FOR EXPORT";
--source include/wait_condition.inc
UNLOCK TABLES;
--echo # Connection default
--connection default
--echo # Reaping: FLUSH TABLE t1 FOR EXPORT
--reap
UNLOCK TABLES;
--echo # Test 9: LOCK TABLES ... READ is not affected
--echo #
LOCK TABLE t1 READ;
--echo # Connection con1
--connection con1
--echo # Should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
--echo # Connection default
--connection default
UNLOCK TABLES;
FLUSH TABLE t1 FOR EXPORT;
--echo # Connection con1
--connection con1
--echo # Should not block
LOCK TABLE t1 READ;
UNLOCK TABLES;
--echo # Connection default
--connection default
UNLOCK TABLES;
--echo # Connection con1
--connection con1
--disconnect con1
--source include/wait_until_disconnected.inc
--echo # Connection default
--connection default
DROP TABLE t1, t2;
--echo # Test 10: Lock is released if transaction is started after doing
--echo # 'flush table..' in same session
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
FLUSH TABLE t1 FOR EXPORT;
--echo # error as active locks already exist
--error ER_LOCK_OR_ACTIVE_TRANSACTION
FLUSH TABLE t1 FOR EXPORT;
--echo # active locks will be released due to start transaction
START TRANSACTION;
--echo # passes as start transaction released ealier locks
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE t1;
--echo # Test 11: Test 'flush table with fully qualified table names
--echo # and with syntax local/NO_WRITE_TO_BINLOG
--echo # Connection con1
--connect (con1, localhost, root)
--echo # Connection default
--connection default
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
FLUSH LOCAL TABLES test.t1 FOR EXPORT;
--echo # Connection con1
--connection con1
--echo # Should be blocked
--echo # Sending:
--send FLUSH LOCAL TABLES t1 FOR EXPORT
--echo # Connection default
--connection default
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "FLUSH LOCAL TABLES t1 FOR EXPORT";
--source include/wait_condition.inc
UNLOCK TABLE;
--echo # Connection con1
--connection con1
--echo # Reaping: FLUSH LOCAL TABLES t1 FOR EXPORT
--reap
SELECT * FROM t1 ORDER BY i;
--echo # Connection default
--connection default
--echo # Should be blocked
--echo # Sending:
--send FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
--echo # Connection con1
--connection con1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table metadata lock" AND
info = "FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT";
--source include/wait_condition.inc
UNLOCK TABLES;
--echo # Connection default
--connection default
--echo # Reaping: FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
--reap
SELECT * FROM t1 ORDER BY i;
UNLOCK TABLE;
DROP TABLE t1;
--echo # Test 12: Active transaction get committed if user execute
--echo # "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.."
--echo # Connection default
--connection default
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
START TRANSACTION;
INSERT INTO t1 VALUES (300);
--echo # 'flush table..' commit active transaction from same session
FLUSH LOCAL TABLES test.t1 FOR EXPORT;
ROLLBACK;
SELECT * FROM t1 ORDER BY i;
START TRANSACTION;
INSERT INTO t1 VALUES (400);
--echo # 'lock table ..' commit active transaction from same session
LOCK TABLES test.t1 READ;
ROLLBACK;
SELECT * FROM t1 ORDER BY i;
UNLOCK TABLES;
DROP TABLE t1;
--echo # Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.."
--echo # in same session
--echo # Connection default
--connection default
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
--echo # Lock table
LOCK TABLES test.t1 WRITE;
--echo # 'lock table ..' completes even if table lock is acquired
--echo # in same session using 'lock table'. Previous locks are released.
LOCK TABLES test.t1 READ;
--echo # 'flush table ..' gives error if table lock is acquired
--echo # in same session using 'lock table ..'
--error ER_LOCK_OR_ACTIVE_TRANSACTION
FLUSH TABLES test.t1 FOR EXPORT;
--echo # 'lock table ..' completes even if table lock is acquired
--echo # in same session using 'flush table'. Previous locks are released.
LOCK TABLES test.t1 WRITE;
UNLOCK TABLES;
DROP TABLE t1;
--connection con1
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
--echo # Reset innodb_file_per_table
SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table;
--echo # End of 5.6 tests

View file

@ -247,6 +247,13 @@ enum enum_alter_inplace_result {
*/
#define HA_CAN_FULLTEXT_EXT (1LL << 44)
/*
Storage engine supports table export using the
FLUSH TABLE <table_list> FOR EXPORT statement.
*/
#define HA_CAN_EXPORT (1LL << 45)
/*
Set of all binlog flags. Currently only contain the capabilities
flags.

View file

@ -223,6 +223,7 @@ static SYMBOL symbols[] = {
{ "EXISTS", SYM(EXISTS)},
{ "EXIT", SYM(EXIT_SYM)},
{ "EXPANSION", SYM(EXPANSION_SYM)},
{ "EXPORT", SYM(EXPORT_SYM)},
{ "EXPLAIN", SYM(DESCRIBE)},
{ "EXTENDED", SYM(EXTENDED_SYM)},
{ "EXTENT_SIZE", SYM(EXTENT_SIZE_SYM)},

View file

@ -6757,7 +6757,7 @@ ER_TABLESPACE_DISCARDED
eng "Tablespace has been discarded for table '%-.192s'"
ER_INTERNAL_ERROR
eng "Internal error: '%-.192s'"
eng "Internal error: %-.192s"
ER_INNODB_IMPORT_ERROR
eng "ALTER TABLE '%-.192s' IMPORT TABLESPACE failed with error %lu : '%s'"

View file

@ -4232,6 +4232,17 @@ end_with_restore_list:
my_ok(thd);
break;
}
else if (first_table && lex->type & REFRESH_FOR_EXPORT)
{
/* Check table-level privileges. */
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
FALSE, UINT_MAX, FALSE))
goto error;
if (flush_tables_for_export(thd, all_tables))
goto error;
my_ok(thd);
break;
}
/*
reload_acl_and_cache() will tell us if we are allowed to write to the

View file

@ -522,7 +522,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
/*
Before opening and locking tables the below call also waits
for old shares to go away, so the fact that we don't pass
MYSQL_LOCK_IGNORE_FLUSH flag to it is important.
MYSQL_OPEN_IGNORE_FLUSH flag to it is important.
Also we don't pass MYSQL_OPEN_HAS_MDL_LOCK flag as we want
to open underlying tables if merge table is flushed.
For underlying tables of the merge the below call has to
@ -552,6 +552,85 @@ error:
}
/**
Prepare tables for export (transportable tablespaces) by
a) waiting until write transactions/DDL operations using these
tables have completed.
b) block new write operations/DDL operations on these tables.
Once this is done, notify the storage engines using handler::extra().
Finally, enter LOCK TABLES mode, so that locks are held
until UNLOCK TABLES is executed.
@param thd Thread handler
@param all_tables TABLE_LIST for tables to be exported
@retval false Ok
@retval true Error
*/
bool flush_tables_for_export(THD *thd, TABLE_LIST *all_tables)
{
Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
/*
This is called from SQLCOM_FLUSH, the transaction has
been committed implicitly.
*/
if (thd->locked_tables_mode)
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return true;
}
/*
Acquire SNW locks on tables to be exported. Don't acquire
global IX as this will make this statement incompatible
with FLUSH TABLES WITH READ LOCK.
*/
if (open_and_lock_tables(thd, all_tables, false,
MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK,
&lock_tables_prelocking_strategy))
{
return true;
}
// Check if all storage engines support FOR EXPORT.
for (TABLE_LIST *table_list= all_tables; table_list;
table_list= table_list->next_global)
{
if (!(table_list->table->file->ha_table_flags() & HA_CAN_EXPORT))
{
my_error(ER_ILLEGAL_HA, MYF(0),table_list->table->file->table_type(),
table_list->db, table_list->table_name);
return true;
}
}
// Notify the storage engines that the tables should be made ready for export.
for (TABLE_LIST *table_list= all_tables; table_list;
table_list= table_list->next_global)
{
handler *handler_file= table_list->table->file;
int error= handler_file->extra(HA_EXTRA_EXPORT);
if (error)
{
handler_file->print_error(error, MYF(0));
return true;
}
}
// Enter LOCKED TABLES mode.
if (thd->locked_tables_list.init_locked_tables(thd))
return true;
thd->variables.option_bits|= OPTION_TABLE_LOCK;
return false;
}
/**
Disable checkpoints for all handlers
This is released in unlock_global_read_lock()

View file

@ -22,5 +22,6 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
TABLE_LIST *tables, int *write_to_binlog);
bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables);
bool flush_tables_for_export(THD *thd, TABLE_LIST *all_tables);
#endif

View file

@ -1155,6 +1155,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token EXISTS /* SQL-2003-R */
%token EXIT_SYM
%token EXPANSION_SYM
%token EXPORT_SYM
%token EXTENDED_SYM
%token EXTENT_SIZE_SYM
%token EXTRACT_SYM /* SQL-2003-N */
@ -1828,7 +1829,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
object_privilege object_privilege_list user_list user_and_role_list
rename_list
clear_privileges flush_options flush_option
opt_with_read_lock flush_options_list
opt_flush_lock flush_options_list
equal optional_braces
opt_mi_check_type opt_to mi_check_types
table_to_table_list table_to_table opt_table_list opt_as
@ -12779,11 +12780,11 @@ flush_options:
YYPS->m_mdl_type= MDL_SHARED_HIGH_PRIO;
}
opt_table_list {}
opt_with_read_lock {}
opt_flush_lock {}
| flush_options_list
;
opt_with_read_lock:
opt_flush_lock:
/* empty */ {}
| WITH READ_SYM LOCK_SYM optional_flush_tables_arguments
{
@ -12796,6 +12797,25 @@ opt_with_read_lock:
tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
}
}
| FOR_SYM
{
if (Lex->query_tables == NULL) // Table list can't be empty
{
my_parse_error(ER(ER_NO_TABLES_USED));
MYSQL_YYABORT;
}
}
EXPORT_SYM
{
TABLE_LIST *tables= Lex->query_tables;
Lex->type|= REFRESH_FOR_EXPORT;
for (; tables; tables= tables->next_global)
{
tables->mdl_request.set_type(MDL_SHARED_NO_WRITE);
tables->required_type= FRMTYPE_TABLE; /* Don't try to flush views. */
tables->open_type= OT_BASE_ONLY; /* Ignore temporary tables. */
}
}
;
flush_options_list:
@ -14139,6 +14159,7 @@ keyword_sp:
| EVERY_SYM {}
| EXCHANGE_SYM {}
| EXPANSION_SYM {}
| EXPORT_SYM {}
| EXTENDED_SYM {}
| EXTENT_SIZE_SYM {}
| FAULTS_SYM {}

View file

@ -2252,7 +2252,7 @@ ha_innobase::ha_innobase(
HA_BINLOG_ROW_CAPABLE |
HA_CAN_GEOMETRY | HA_PARTIAL_COLUMN_READ |
HA_TABLE_SCAN_ON_INDEX | HA_CAN_FULLTEXT |
HA_CAN_FULLTEXT_EXT),
HA_CAN_FULLTEXT_EXT | HA_CAN_EXPORT),
start_of_scan(0),
num_write_row(0)
{}
@ -17090,7 +17090,6 @@ ib_senderrf(
ib_uint32_t code, /*!< MySQL error code */
...) /*!< Args */
{
char* str;
va_list args;
const char* format = innobase_get_err_msg(code);
@ -17104,48 +17103,24 @@ ib_senderrf(
va_start(args, code);
#ifdef __WIN__
int size = _vscprintf(format, args) + 1;
str = static_cast<char*>(malloc(size));
str[size - 1] = 0x0;
vsnprintf(str, size, format, args);
#elif HAVE_VASPRINTF
if (vasprintf(&str, format, args) == -1) {
/* In case of failure use a fixed length string */
str = static_cast<char*>(malloc(BUFSIZ));
my_vsnprintf(str, BUFSIZ, format, args);
}
#else
/* Use a fixed length string. */
str = static_cast<char*>(malloc(BUFSIZ));
my_vsnprintf(str, BUFSIZ, format, args);
#endif /* __WIN__ */
Sql_condition::enum_warning_level l;
l = Sql_condition::WARN_LEVEL_NOTE;
myf l;
switch(level) {
case IB_LOG_LEVEL_INFO:
l = ME_JUST_INFO;
break;
case IB_LOG_LEVEL_WARN:
l = Sql_condition::WARN_LEVEL_WARN;
l = ME_JUST_WARNING;
break;
case IB_LOG_LEVEL_ERROR:
/* We can't use push_warning_printf(), it is a hard error. */
my_printf_error(code, "%s", MYF(0), str);
break;
case IB_LOG_LEVEL_FATAL:
l = Sql_condition::WARN_LEVEL_END;
l = 0;
break;
}
if (level != IB_LOG_LEVEL_ERROR) {
push_warning_printf(thd, l, code, "InnoDB: %s", str);
}
my_printv_error(code, format, MYF(l), args);
va_end(args);
free(str);
if (level == IB_LOG_LEVEL_FATAL) {
ut_error;

View file

@ -3659,8 +3659,8 @@ row_import_for_mysql(
row_mysql_unlock_data_dictionary(trx);
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_FILE_NOT_FOUND,
filepath, err, ut_strerr(err));
ER_GET_ERRMSG,
err, ut_strerr(err), filepath);
mem_free(filepath);

View file

@ -2544,7 +2544,7 @@ ha_innobase::ha_innobase(
HA_BINLOG_ROW_CAPABLE |
HA_CAN_GEOMETRY | HA_PARTIAL_COLUMN_READ |
HA_TABLE_SCAN_ON_INDEX | HA_CAN_FULLTEXT |
HA_CAN_FULLTEXT_EXT),
HA_CAN_FULLTEXT_EXT | HA_CAN_EXPORT),
start_of_scan(0),
num_write_row(0)
{}
@ -18216,7 +18216,6 @@ ib_senderrf(
ib_uint32_t code, /*!< MySQL error code */
...) /*!< Args */
{
char* str;
va_list args;
const char* format = innobase_get_err_msg(code);
@ -18230,44 +18229,24 @@ ib_senderrf(
va_start(args, code);
#ifdef __WIN__
int size = _vscprintf(format, args) + 1;
str = static_cast<char*>(malloc(size));
str[size - 1] = 0x0;
vsnprintf(str, size, format, args);
#elif HAVE_VASPRINTF
(void) vasprintf(&str, format, args);
#else
/* Use a fixed length string. */
str = static_cast<char*>(malloc(BUFSIZ));
my_vsnprintf(str, BUFSIZ, format, args);
#endif /* __WIN__ */
Sql_condition::enum_warning_level l;
l = Sql_condition::WARN_LEVEL_NOTE;
myf l;
switch(level) {
case IB_LOG_LEVEL_INFO:
l = ME_JUST_INFO;
break;
case IB_LOG_LEVEL_WARN:
l = Sql_condition::WARN_LEVEL_WARN;
l = ME_JUST_WARNING;
break;
case IB_LOG_LEVEL_ERROR:
/* We can't use push_warning_printf(), it is a hard error. */
my_printf_error(code, "%s", MYF(0), str);
break;
case IB_LOG_LEVEL_FATAL:
l = Sql_condition::WARN_LEVEL_END;
l = 0;
break;
}
if (level != IB_LOG_LEVEL_ERROR) {
push_warning_printf(thd, l, code, "InnoDB: %s", str);
}
my_printv_error(code, format, MYF(l), args);
va_end(args);
free(str);
if (level == IB_LOG_LEVEL_FATAL) {
ut_error;

View file

@ -3659,8 +3659,8 @@ row_import_for_mysql(
row_mysql_unlock_data_dictionary(trx);
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_FILE_NOT_FOUND,
filepath, err, ut_strerr(err));
ER_GET_ERRMSG,
err, ut_strerr(err), filepath);
mem_free(filepath);