Commit d929342b authored by Sergei Golubchik's avatar Sergei Golubchik

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.
parent 65121806
......@@ -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
......
# 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
......@@ -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
#
# 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);
}
}
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;
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;
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;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#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;
-- 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;
-- 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;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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
......
......@@ -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
####################################
......
......@@ -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
####################################
......
......@@ -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
--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
This diff is collapsed.
......@@ -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.
......
......@@ -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)},
......
......@@ -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'"
......
......@@ -4232,6 +4232,17 @@ case SQLCOM_PREPARE:
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
......
......@@ -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 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
}
/**
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()
......
......@@ -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
This diff is collapsed.
This diff is collapsed.
......@@ -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);
......
This diff is collapsed.
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment