diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-06-28 22:01:55 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-28 22:01:55 +0200 |
commit | 3361aee591b1eb8c676f60887ffc535cd509890a (patch) | |
tree | 54a65f83ba7d9293e6f8e8281ad920fbae6eb823 /mysql-test/suite | |
parent | 6ce20fb2b9fe57330c797694b9dbea4028f40d7c (diff) | |
parent | 0fdb17e6c3f50ae22eb97b6363bcbd8b0cd9e040 (diff) | |
download | mariadb-git-3361aee591b1eb8c676f60887ffc535cd509890a.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'mysql-test/suite')
19 files changed, 807 insertions, 129 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-fkcheck.result b/mysql-test/suite/innodb/r/innodb-fkcheck.result new file mode 100644 index 00000000000..c6beabb0f50 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-fkcheck.result @@ -0,0 +1,89 @@ +set global innodb_file_per_table = 1; +drop table if exists b; +drop database if exists bug_fk; +create database bug_fk; +use bug_fk; +CREATE TABLE b ( +b int unsigned NOT NULL, +d1 datetime NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +CREATE TABLE c ( +b int unsigned NOT NULL, +d1 datetime NOT NULL, +d2 datetime NOT NULL, +PRIMARY KEY (b,d1), +CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; +show warnings; +Level Code Message +set foreign_key_checks = 0; +DROP TABLE IF EXISTS b; +show create table c; +Table Create Table +c CREATE TABLE `c` ( + `b` int(10) unsigned NOT NULL, + `d1` datetime NOT NULL, + `d2` datetime NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +DROP TABLE IF EXISTS d; +Warnings: +Note 1051 Unknown table 'bug_fk.d' +CREATE TABLE d ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1), +CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; +show warnings; +Level Code Message +set foreign_key_checks = 1; +show create table c; +Table Create Table +c CREATE TABLE `c` ( + `b` int(10) unsigned NOT NULL, + `d1` datetime NOT NULL, + `d2` datetime NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `b_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table d; +Table Create Table +d CREATE TABLE `d` ( + `b` bigint(20) unsigned NOT NULL, + `d1` date NOT NULL, + PRIMARY KEY (`b`,`d1`), + CONSTRAINT `bd_fk` FOREIGN KEY (`b`) REFERENCES `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE b ( +b bigint unsigned NOT NULL, +d1 date NOT NULL, +PRIMARY KEY (b,d1) +) ENGINE=InnoDB; +ERROR HY000: Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `bug_fk`.`b` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +set foreign_key_checks=0; +drop table c; +drop table d; +create table b(id int) engine=innodb; +show warnings; +Level Code Message +b.frm +b.ibd +drop table if exists b; +drop database if exists bug_fk; diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result index 353303825e5..0ef6f65d0ff 100644 --- a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result +++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result @@ -1,82 +1,48 @@ -set names utf8; -CREATE TABLE corrupt_bit_test_ā( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(100), -c INT, -z INT, -INDEX(b)) -ENGINE=InnoDB; -INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); -CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b); -CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); -SELECT * FROM corrupt_bit_test_ā; a b c z 1 x 1 1 -select @@unique_checks; -@@unique_checks -0 -select @@innodb_change_buffering_debug; -@@innodb_change_buffering_debug -1 -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā; -select count(*) from corrupt_bit_test_ā; count(*) -1024 -CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); -INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1); -CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); -check table corrupt_bit_test_ā; +2 Table Op Msg_type Msg_text -test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxā" is corrupted. -test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxē" is corrupted. +test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted +test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check error Corrupt -select c from corrupt_bit_test_ā; +ERROR HY000: Index "idx" is corrupted +ERROR HY000: Index "idx" is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted -select z from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted -show warnings; Level Code Message Warning 180 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted Error 1712 Index corrupt_bit_test_ā is corrupted -insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); -select * from corrupt_bit_test_ā use index(primary) where a = 10001; a b c z 10001 a 20001 20001 -begin; -insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002); -delete from corrupt_bit_test_ā where a = 10001; -insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); -rollback; -drop index idxā on corrupt_bit_test_ā; -check table corrupt_bit_test_ā; Table Op Msg_type Msg_text +test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check error Corrupt -set names utf8; -select z from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted -drop index idxē on corrupt_bit_test_ā; -select z from corrupt_bit_test_ā limit 10; +Table Create Table +corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` char(100) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `z` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `idxē` (`z`,`b`), + KEY `idx` (`b`) +) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 +ERROR HY000: Index "idx" is corrupted +ERROR HY000: Index "idx" is corrupted +Table Create Table +corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` char(100) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `z` int(11) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `idx` (`b`) +) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 z 20001 1 -1 2 -11 -12 -21 -22 -31 -32 -drop table corrupt_bit_test_ā; -DROP DATABASE pad; -SET GLOBAL innodb_change_buffering_debug = 0; diff --git a/mysql-test/suite/innodb/t/innodb-fkcheck.test b/mysql-test/suite/innodb/t/innodb-fkcheck.test new file mode 100644 index 00000000000..51e36ae6984 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-fkcheck.test @@ -0,0 +1,115 @@ +--source include/have_innodb.inc + +# +# MDEV-10083: Orphan ibd file when playing with foreign keys +# +--disable_query_log +SET @start_global_fpt = @@global.innodb_file_per_table; +SET @start_global_fkc = @@global.foreign_key_checks; +--enable_query_log + +set global innodb_file_per_table = 1; + +--disable_warnings +drop table if exists b; +drop database if exists bug_fk; +--enable_warnings + +let $MYSQLD_DATADIR = `select @@datadir`; + +create database bug_fk; +use bug_fk; + +CREATE TABLE b ( + b int unsigned NOT NULL, + d1 datetime NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; + +CREATE TABLE c ( + b int unsigned NOT NULL, + d1 datetime NOT NULL, + d2 datetime NOT NULL, + PRIMARY KEY (b,d1), + CONSTRAINT b_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; + +show warnings; + +set foreign_key_checks = 0; + +DROP TABLE IF EXISTS b; + +show create table c; + +# +# Note that column b has different type in parent table +# +--error 1005 +CREATE TABLE b ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; + +show warnings; + +DROP TABLE IF EXISTS d; + +CREATE TABLE d ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1), + CONSTRAINT bd_fk FOREIGN KEY (b) REFERENCES b (b) +) ENGINE=InnoDB; + +show warnings; + +set foreign_key_checks = 1; + +show create table c; +show create table d; + +# +# Table c column b used on foreign key has different type +# compared referenced column b in table b, but this +# create still produced b.ibd file. This is because +# we row_drop_table_for_mysql was called and referenced +# table is not allowed to be dropped even in case +# when actual create is not successfull. +# +--error 1005 +CREATE TABLE b ( + b bigint unsigned NOT NULL, + d1 date NOT NULL, + PRIMARY KEY (b,d1) +) ENGINE=InnoDB; + +show warnings; + +--list_files $MYSQLD_DATADIR/bug_fk b* + +set foreign_key_checks=0; + +drop table c; +drop table d; + +--list_files $MYSQLD_DATADIR/bug_fk b* + +create table b(id int) engine=innodb; +show warnings; + +--list_files $MYSQLD_DATADIR/bug_fk b* + +# +# Cleanup +# +--disable_query_log +SET @@global.innodb_file_per_table = @start_global_fpt; +SET @@global.foreign_key_checks = @start_global_fkc; +--enable_query_log + +--disable_warnings +drop table if exists b; +drop database if exists bug_fk; +--enable_warnings diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test index d6d77076b83..ee04e8d66fc 100644 --- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test +++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test @@ -2,46 +2,24 @@ # Test for persistent corrupt bit for corrupted index and table # -- source include/have_innodb.inc --- source include/have_innodb_16k.inc - -# Issues with innodb_change_buffering_debug on Windows, so the test scenario -# cannot be created on windows ---source include/not_windows.inc - +#-- source include/have_innodb_16k.inc +-- source include/not_embedded.inc # This test needs debug server ---source include/have_debug.inc +-- source include/have_debug.inc -- disable_query_log -call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE"); -# This test setup is extracted from bug56680.test: -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. -SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug; -SET GLOBAL innodb_change_buffering_debug = 1; - -# Turn off Unique Check to create corrupted index with dup key -SET UNIQUE_CHECKS=0; - -CREATE DATABASE pad; -let $i=338; -while ($i) -{ ---eval CREATE TABLE pad.t$i(a INT PRIMARY KEY)ENGINE=InnoDB; - dec $i; -} - --- enable_query_log +call mtr.add_suppression("Flagged corruption of idx.*in"); set names utf8; +SET UNIQUE_CHECKS=0; + CREATE TABLE corrupt_bit_test_ā( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(100), c INT, z INT, - INDEX(b)) + INDEX idx(b)) ENGINE=InnoDB; INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); @@ -54,38 +32,21 @@ CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); SELECT * FROM corrupt_bit_test_ā; -select @@unique_checks; -select @@innodb_change_buffering_debug; - -# Create enough rows for the table, so that the insert buffer will be -# used for modifying the secondary index page. There must be multiple -# index pages, because changes to the root page are never buffered. - INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā; -INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā; -CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); - -# Create a dup key error on index "idxē" and "idxā" by inserting a dup value -INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1); +# This will flag all secondary indexes corrupted +SET SESSION debug_dbug="+d,dict_set_index_corrupted"; +check table corrupt_bit_test_ā; +SET SESSION debug_dbug=""; -# creating an index should succeed even if other secondary indexes are corrupted +# Cannot create new indexes while corrupted indexes exist +--error ER_INDEX_CORRUPT +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +--error ER_INDEX_CORRUPT CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); -# Check table will find the unique indexes corrupted -# with dup key -check table corrupt_bit_test_ā; - # This selection intend to use the corrupted index. Expect to fail -- error ER_INDEX_CORRUPT select c from corrupt_bit_test_ā; @@ -109,7 +70,6 @@ delete from corrupt_bit_test_ā where a = 10001; insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); rollback; -# Drop one corrupted index before reboot drop index idxā on corrupt_bit_test_ā; check table corrupt_bit_test_ā; @@ -119,14 +79,26 @@ set names utf8; -- error ER_INDEX_CORRUPT select z from corrupt_bit_test_ā; +show create table corrupt_bit_test_ā; + # Drop the corrupted index drop index idxē on corrupt_bit_test_ā; +# Cannot create new indexes while a corrupt index exists. +--error ER_INDEX_CORRUPT +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +--error ER_INDEX_CORRUPT +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); + +show create table corrupt_bit_test_ā; +drop index idx on corrupt_bit_test_ā; + +# Now that there exist no corrupted indexes, we can create new indexes. +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); + # Now select back to normal select z from corrupt_bit_test_ā limit 10; # Drop table drop table corrupt_bit_test_ā; -DROP DATABASE pad; - -SET GLOBAL innodb_change_buffering_debug = 0; diff --git a/mysql-test/suite/perfschema/r/sizing_low.result b/mysql-test/suite/perfschema/r/sizing_low.result index dce5a994099..a698f55aa07 100644 --- a/mysql-test/suite/perfschema/r/sizing_low.result +++ b/mysql-test/suite/perfschema/r/sizing_low.result @@ -67,3 +67,4 @@ Performance_schema_table_instances_lost 0 Performance_schema_thread_classes_lost 0 Performance_schema_thread_instances_lost 0 Performance_schema_users_lost 0 +CALL mtr.add_suppression("innodb_open_files should not be greater than the open_files_limit."); diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest.result b/mysql-test/suite/perfschema/r/start_server_low_digest.result index ba71e4ea6b0..8cc92f21964 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_digest.result +++ b/mysql-test/suite/perfschema/r/start_server_low_digest.result @@ -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 event_name, digest, digest_text, sql_text FROM events_statements_history_long; event_name digest digest_text sql_text -statement/sql/truncate 9d8bb20bae9d3c7cdfd36bc9d78b1d63 TRUNCATE TABLE truncate table events_statements_history_long -statement/sql/select d4c5d748dcc95f29805e3c04d47d7f64 SELECT ? + ? + 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+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 +statement/sql/truncate e1c917a43f978456fab15240f89372ca TRUNCATE TABLE truncate table events_statements_history_long +statement/sql/select 3f7ca34376814d0e985337bd588b5ffd SELECT ? + ? + 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+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 diff --git a/mysql-test/suite/perfschema/r/table_name.result b/mysql-test/suite/perfschema/r/table_name.result new file mode 100644 index 00000000000..d6369ffc79e --- /dev/null +++ b/mysql-test/suite/perfschema/r/table_name.result @@ -0,0 +1,156 @@ + +# +# TEST 1: Normal tables prefixed with "#sql" and "sql". +# +USE test; +CREATE TABLE `#sql_1` (a int, b text); +INSERT INTO `#sql_1` VALUES(1,'one'); + +CREATE TABLE `sql_1` (a int, b text); +INSERT INTO `sql_1` VALUES(1,'one'); + +# Verify that the tables are treated as normal tables . + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name +TABLE test #sql_1 +TABLE test sql_1 + +# Drop the tables, verify that the table objects are removed. + +DROP TABLE `#sql_1`; +DROP TABLE `sql_1`; + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 2: Temporary tables, no special prefix. +# +CREATE TEMPORARY TABLE sql_temp2_myisam (a int, b text) ENGINE=MYISAM; +INSERT INTO sql_temp2_myisam VALUES(1,'one'); + +CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB; +INSERT INTO sql_temp2_innodb VALUES(1,'one'); + +# Confirm that the temporary tables are ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the tables, verify that the table objects are not created. + +DROP TABLE sql_temp2_myisam; +DROP TABLE sql_temp2_innodb; + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 3: Temporary tables with the "#sql" prefix. +# +CREATE TEMPORARY TABLE `#sql_temp3_myisam` (a int, b text) ENGINE=MYISAM; +CHECK TABLE `#sql_temp3_myisam`; +Table Op Msg_type Msg_text +test.#sql_temp3_myisam check status OK +INSERT INTO `#sql_temp3_myisam` VALUES(1,'one'); + +CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB; +CHECK TABLE `#sql_temp3_innodb`; +Table Op Msg_type Msg_text +test.#sql_temp3_innodb check status OK +INSERT INTO `#sql_temp3_innodb` VALUES(1,'one'); + +# Confirm that the temporary tables are ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the temporary tables. + +DROP TABLE `#sql_temp3_myisam`; +DROP TABLE `#sql_temp3_innodb`; + +# Confirm that the temporary tables are still ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 4: Special case: MyISAM temporary tables are recreated as non-temporary +# when they are truncated. +# +CREATE TEMPORARY TABLE `sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `sql_temp4_myisam` VALUES(1,'one'); + +CREATE TEMPORARY TABLE `#sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `#sql_temp4_myisam` VALUES(1,'one'); + +# Confirm that the MyISAM temporary tables are ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Truncate the MyISAM temporary tables, forcing them to be recreated as non-temporary. + +TRUNCATE TABLE `sql_temp4_myisam`; +TRUNCATE TABLE `#sql_temp4_myisam`; + +# Confirm that the recreated MyISAM tables are still regarded as temporary and ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the recreated MyISAM tables; + +DROP TABLE `sql_temp4_myisam`; +DROP TABLE `#sql_temp4_myisam`; + +# Confirm that the recreated temporary tables are still ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# +# TEST 5: Generate temporary tables with ALTER MyISAM table. +# +USE test; +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1), (2), (3); +ALTER TABLE t1 ADD COLUMN (b int); + +# Confirm that the recreated temporary tables are still ignored. + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name + +# Drop the MyISAM table + +DROP TABLE t1; + +# Confirm that no tables remain; + +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +object_type object_schema object_name diff --git a/mysql-test/suite/perfschema/t/sizing_low.test b/mysql-test/suite/perfschema/t/sizing_low.test index 4d02d41aecd..56446fd6973 100644 --- a/mysql-test/suite/perfschema/t/sizing_low.test +++ b/mysql-test/suite/perfschema/t/sizing_low.test @@ -7,3 +7,4 @@ --source ../include/sizing_auto.inc +CALL mtr.add_suppression("innodb_open_files should not be greater than the open_files_limit."); diff --git a/mysql-test/suite/perfschema/t/table_name.test b/mysql-test/suite/perfschema/t/table_name.test new file mode 100644 index 00000000000..a8179f2d1f8 --- /dev/null +++ b/mysql-test/suite/perfschema/t/table_name.test @@ -0,0 +1,165 @@ +# +# Performance Schema +# +# Verify that the Performance Schema correctly identifies normal and temporary +# tables with non-standard names. + +# The server uses the table name prefix "#sql" for temporary and intermediate +# tables, however user-defined tables having the "#sql" prefix are also permitted. +# Independent of the table name, temporary or intermediate tables always have the +# "#sql" prefix in the filename. (For non-temporary tables starting with "#", +# the "#" is encoded to @0023 in the filename.) +# +# Given the ambiguity with temporary table names, the Performance Schema identifies +# temporary tables tables either by the table category or by the filename. +# +--source include/have_perfschema.inc +--source include/have_innodb.inc +--source include/not_embedded.inc + +--echo +--echo # +--echo # TEST 1: Normal tables prefixed with "#sql" and "sql". +--echo # +USE test; +CREATE TABLE `#sql_1` (a int, b text); +# INSERT forces path through get_table_share() +INSERT INTO `#sql_1` VALUES(1,'one'); +--echo +CREATE TABLE `sql_1` (a int, b text); +INSERT INTO `sql_1` VALUES(1,'one'); +--echo +--echo # Verify that the tables are treated as normal tables . +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the tables, verify that the table objects are removed. +--echo +DROP TABLE `#sql_1`; +DROP TABLE `sql_1`; +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 2: Temporary tables, no special prefix. +--echo # +CREATE TEMPORARY TABLE sql_temp2_myisam (a int, b text) ENGINE=MYISAM; +INSERT INTO sql_temp2_myisam VALUES(1,'one'); +--echo +CREATE TEMPORARY TABLE sql_temp2_innodb (a int, b text) ENGINE=INNODB; +INSERT INTO sql_temp2_innodb VALUES(1,'one'); +--echo +--echo # Confirm that the temporary tables are ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the tables, verify that the table objects are not created. +--echo +DROP TABLE sql_temp2_myisam; +DROP TABLE sql_temp2_innodb; +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 3: Temporary tables with the "#sql" prefix. +--echo # +CREATE TEMPORARY TABLE `#sql_temp3_myisam` (a int, b text) ENGINE=MYISAM; +CHECK TABLE `#sql_temp3_myisam`; +INSERT INTO `#sql_temp3_myisam` VALUES(1,'one'); +--echo +CREATE TEMPORARY TABLE `#sql_temp3_innodb` (a int, b text) ENGINE=INNODB; +CHECK TABLE `#sql_temp3_innodb`; +INSERT INTO `#sql_temp3_innodb` VALUES(1,'one'); +--echo +--echo # Confirm that the temporary tables are ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the temporary tables. +--echo +DROP TABLE `#sql_temp3_myisam`; +DROP TABLE `#sql_temp3_innodb`; +--echo +--echo # Confirm that the temporary tables are still ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 4: Special case: MyISAM temporary tables are recreated as non-temporary +--echo # when they are truncated. +--echo # +CREATE TEMPORARY TABLE `sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `sql_temp4_myisam` VALUES(1,'one'); +--echo +CREATE TEMPORARY TABLE `#sql_temp4_myisam` (a int, b text) ENGINE=MYISAM; +INSERT INTO `#sql_temp4_myisam` VALUES(1,'one'); +--echo +--echo # Confirm that the MyISAM temporary tables are ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Truncate the MyISAM temporary tables, forcing them to be recreated as non-temporary. +--echo +TRUNCATE TABLE `sql_temp4_myisam`; +TRUNCATE TABLE `#sql_temp4_myisam`; +--echo +--echo # Confirm that the recreated MyISAM tables are still regarded as temporary and ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the recreated MyISAM tables; +--echo +DROP TABLE `sql_temp4_myisam`; +DROP TABLE `#sql_temp4_myisam`; +--echo +--echo # Confirm that the recreated temporary tables are still ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; + +--echo +--echo # +--echo # TEST 5: Generate temporary tables with ALTER MyISAM table. +--echo # +USE test; +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1), (2), (3); +# Force a path throug mysql_alter_table() and ha_create_table(). +ALTER TABLE t1 ADD COLUMN (b int); +--echo +--echo # Confirm that the recreated temporary tables are still ignored. +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; +--echo +--echo # Drop the MyISAM table +--echo +DROP TABLE t1; + +--echo +--echo # Confirm that no tables remain; +--echo +SELECT object_type, object_schema, object_name +FROM performance_schema.objects_summary_global_by_type +WHERE object_schema="test"; diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 2577a36cad4..83b88ed0480 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1=<secret>; -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 '=<secret>' at line 1 +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 '<secret>' at line 1 CREATE USER u3 IDENTIFIED BY ''; drop user u1, u2, u3; select 2; diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result index 2577a36cad4..83b88ed0480 100644 --- a/mysql-test/suite/plugins/r/thread_pool_server_audit.result +++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result @@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1=<secret>; -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 '=<secret>' at line 1 +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 '<secret>' at line 1 CREATE USER u3 IDENTIFIED BY ''; drop user u1, u2, u3; select 2; diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result new file mode 100644 index 00000000000..67af4a068d6 --- /dev/null +++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.result @@ -0,0 +1,21 @@ +include/master-slave.inc +[connection master] +create role r1; +set role r1; +grant select on db.* to current_role; +revoke all privileges, grant option from current_role; +drop role r1; +include/rpl_end.inc +connection server_2; +connection server_2; +connection server_2; +connection server_2; +connection server_1; +connection server_1; +connection server_1; +connection server_2; +connection server_1; +connection server_2; +connection server_2; +connection server_1; +connection server_1; diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test new file mode 100644 index 00000000000..6a6c4f2a756 --- /dev/null +++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test @@ -0,0 +1,12 @@ +--source include/master-slave.inc +--source include/have_binlog_format_mixed.inc + +--enable_connect_log + +create role r1; +set role r1; +grant select on db.* to current_role; +revoke all privileges, grant option from current_role; +drop role r1; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/roles/set_role-9614.result b/mysql-test/suite/roles/set_role-9614.result new file mode 100644 index 00000000000..37f6db070c0 --- /dev/null +++ b/mysql-test/suite/roles/set_role-9614.result @@ -0,0 +1,99 @@ +# +# MDEV-9614 Roles and Users Longer than 6 characters +# +# This test case checks the edge case presented in the MDEV. The +# real issue is actually apparent when the username is longer than the +# rolename. +# +# We need a separate database not including test or test_% names. Due to +# default privileges given on these databases. +# +DROP DATABASE IF EXISTS `bug_db`; +Warnings: +Note 1008 Can't drop database 'bug_db'; database doesn't exist +# +# The first user did not show the bug as john's length is smaller +# than client. The bug is apparent most of the time for usertestjohn. +# +CREATE USER `john`@`%`; +CREATE USER `usertestjohn`@`%`; +CREATE ROLE `client`; +# +# Setup the required tables. +# +CREATE DATABASE `bug_db`; +CREATE TABLE `bug_db`.`t0`(`c0` INT); +# +# Setup select privileges only on the role. Setting the role should give +# select access to bug_db.t0. +# +GRANT SELECT ON `bug_db`.`t0` TO `client`; +GRANT `client` TO `john`@`%`; +GRANT `client` TO `usertestjohn`@`%`; +# +# Check to see grants are set. +# +SHOW GRANTS FOR `john`@`%`; +Grants for john@% +GRANT client TO 'john'@'%' +GRANT USAGE ON *.* TO 'john'@'%' +SHOW GRANTS FOR `usertestjohn`@`%`; +Grants for usertestjohn@% +GRANT client TO 'usertestjohn'@'%' +GRANT USAGE ON *.* TO 'usertestjohn'@'%' +SHOW GRANTS FOR `client`; +Grants for client +GRANT USAGE ON *.* TO 'client' +GRANT SELECT ON `bug_db`.`t0` TO 'client' +show databases; +Database +bug_db +information_schema +mtr +mysql +performance_schema +test +# +# Try using the database as john. +# +connect john, localhost, john,,information_schema; +show databases; +Database +information_schema +test +set role client; +show databases; +Database +bug_db +information_schema +test +use bug_db; +# +# Try using the database as usertestjohn. +# +connect usertestjohn, localhost, usertestjohn,,information_schema; +show databases; +Database +information_schema +test +set role client; +show databases; +Database +bug_db +information_schema +test +show grants; +Grants for usertestjohn@% +GRANT client TO 'usertestjohn'@'%' +GRANT USAGE ON *.* TO 'usertestjohn'@'%' +GRANT USAGE ON *.* TO 'client' +GRANT SELECT ON `bug_db`.`t0` TO 'client' +use bug_db; +# +# Cleanup +# +connection default; +drop user john; +drop user usertestjohn; +drop role client; +drop database bug_db; diff --git a/mysql-test/suite/roles/set_role-9614.test b/mysql-test/suite/roles/set_role-9614.test new file mode 100644 index 00000000000..5e9f7dacf19 --- /dev/null +++ b/mysql-test/suite/roles/set_role-9614.test @@ -0,0 +1,79 @@ +--source include/not_embedded.inc + +--echo # +--echo # MDEV-9614 Roles and Users Longer than 6 characters +--echo # +--echo # This test case checks the edge case presented in the MDEV. The +--echo # real issue is actually apparent when the username is longer than the +--echo # rolename. + +--enable_connect_log +--echo # +--echo # We need a separate database not including test or test_% names. Due to +--echo # default privileges given on these databases. +--echo # +DROP DATABASE IF EXISTS `bug_db`; + +--echo # +--echo # The first user did not show the bug as john's length is smaller +--echo # than client. The bug is apparent most of the time for usertestjohn. +--echo # +CREATE USER `john`@`%`; +CREATE USER `usertestjohn`@`%`; +CREATE ROLE `client`; + +--echo # +--echo # Setup the required tables. +--echo # +CREATE DATABASE `bug_db`; +CREATE TABLE `bug_db`.`t0`(`c0` INT); + +--echo # +--echo # Setup select privileges only on the role. Setting the role should give +--echo # select access to bug_db.t0. +--echo # +GRANT SELECT ON `bug_db`.`t0` TO `client`; +GRANT `client` TO `john`@`%`; +GRANT `client` TO `usertestjohn`@`%`; + +--echo # +--echo # Check to see grants are set. +--echo # +SHOW GRANTS FOR `john`@`%`; +SHOW GRANTS FOR `usertestjohn`@`%`; +SHOW GRANTS FOR `client`; + +show databases; + +--echo # +--echo # Try using the database as john. +--echo # +connect (john, localhost, john,,information_schema); + +show databases; +set role client; +show databases; +use bug_db; + +--echo # +--echo # Try using the database as usertestjohn. +--echo # +connect (usertestjohn, localhost, usertestjohn,,information_schema); + +show databases; +set role client; +show databases; + +show grants; +use bug_db; + + +--echo # +--echo # Cleanup +--echo # +connection default; +drop user john; +drop user usertestjohn; +drop role client; +drop database bug_db; +--disable_connect_log diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result index aa5f6d3e6db..75445bec823 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_table.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result @@ -144,4 +144,5 @@ HEX(word) SELECT * FROM tmptbl504451f4258$1; ERROR 42S02: Table 'test.tmptbl504451f4258$1' doesn't exist DROP TABLE t5; +flush privileges; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test index f9b01c83917..111b6159ec7 100644 --- a/mysql-test/suite/rpl/t/rpl_ignore_table.test +++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test @@ -1,6 +1,6 @@ -source include/master-slave.inc; let collation=utf8_unicode_ci; ---source include/have_collation.inc +source include/have_collation.inc; +source include/master-slave.inc; call mtr.add_suppression("Can't find record in 't.'"); call mtr.add_suppression("Can't find record in 'user'"); @@ -181,6 +181,7 @@ SELECT HEX(word) FROM t5; SELECT * FROM tmptbl504451f4258$1; connection master; DROP TABLE t5; +flush privileges; sync_slave_with_master; --source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index 002cf66300a..6d95a517b33 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -661,8 +661,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.30 -+GLOBAL_VALUE 5.6.29-76.2 +-GLOBAL_VALUE 5.6.31 ++GLOBAL_VALUE 5.6.30-76.3 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 4f09270a6aa..9f92ea99437 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -2359,7 +2359,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.30 +GLOBAL_VALUE 5.6.31 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL |