diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-01 15:23:18 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-01 15:23:18 +0200 |
commit | ec40980ddd921a3a765c23cc430c9c219e48ea85 (patch) | |
tree | 6553832d3d3fb4b2cb39aea6a1d69e54275f6eb2 /mysql-test/suite | |
parent | 6801f80aface011811d2978f86c03a25ca7b9165 (diff) | |
parent | 9c72963d2aef783cae652b5b8ac01f7aa2bcb43a (diff) | |
download | mariadb-git-ec40980ddd921a3a765c23cc430c9c219e48ea85.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/suite')
43 files changed, 1731 insertions, 126 deletions
diff --git a/mysql-test/suite/binlog/r/read_only.result b/mysql-test/suite/binlog/r/read_only.result new file mode 100644 index 00000000000..9a173d9a96e --- /dev/null +++ b/mysql-test/suite/binlog/r/read_only.result @@ -0,0 +1,129 @@ +# +# MDEV-17863 DROP TEMPORARY TABLE creates a transaction in +# binary log on read only server +# MDEV-19074 Improved read_only mode for slaves with +# gtid_strict_mode enabled +# +create user test@localhost; +grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost; +create table t1 (a int) engine=myisam; +insert into t1 values (1),(2); +reset master; +set global read_only=1; +# Ensure that optimize and analyze doesn't log to binary log +connect con1,localhost,test,,test; +insert into t1 values(3); +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair Error The MariaDB server is running with the --read-only option so it cannot execute this statement +test.t1 repair error Corrupt +optimize table t1; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +# Ensure that using temporary tables is not logged +create temporary table tmp1 (a int) engine=myisam; +insert into tmp1 values (1),(2); +update tmp1 set a=10 where a=2; +delete from tmp1 where a=1; +create temporary table tmp2 select * from t1; +select * from tmp1; +a +10 +select * from tmp2; +a +1 +2 +create temporary table tmp3 like t1; +create or replace temporary table tmp3 like t1; +alter table tmp2 add column (b int); +select * from tmp2; +a b +1 NULL +2 NULL +insert into t1 select a+100 from tmp2; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +drop table tmp1,tmp2,tmp3; +# Clean up test connection +disconnect con1; +connection default; +# Execute some commands as root that should not be logged +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +# Changes to temporary tables created under readonly should not +# be logged +create temporary table tmp4 (a int) engine=myisam; +insert into tmp4 values (1),(2); +create temporary table tmp5 (a int) engine=myisam; +insert into tmp5 select * from tmp4; +alter table tmp5 add column (b int); +set global read_only=0; +insert into tmp4 values (3),(4); +insert into tmp5 values (10,3),(11,4); +select * from tmp4; +a +1 +2 +3 +4 +select * from tmp5; +a b +1 NULL +2 NULL +10 3 +11 4 +update tmp4 set a=10 where a=2; +delete from tmp4 where a=1; +create table t2 select * from tmp4; +alter table tmp5 add column (c int); +insert into tmp5 values (20,5,1),(21,5,2); +select * from tmp5; +a b c +1 NULL NULL +2 NULL NULL +10 3 NULL +11 4 NULL +20 5 1 +21 5 2 +insert into t1 select a+200 from tmp5; +select * from t1; +a +1 +2 +201 +202 +210 +211 +220 +221 +drop table tmp4,tmp5; +# Check what is logged. Only last create select and the insert...select's should be +# row-logged +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4 +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +# Clean up +drop user test@localhost; +drop table t1,t2; diff --git a/mysql-test/suite/binlog/r/read_only_statement.result b/mysql-test/suite/binlog/r/read_only_statement.result new file mode 100644 index 00000000000..9a173d9a96e --- /dev/null +++ b/mysql-test/suite/binlog/r/read_only_statement.result @@ -0,0 +1,129 @@ +# +# MDEV-17863 DROP TEMPORARY TABLE creates a transaction in +# binary log on read only server +# MDEV-19074 Improved read_only mode for slaves with +# gtid_strict_mode enabled +# +create user test@localhost; +grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost; +create table t1 (a int) engine=myisam; +insert into t1 values (1),(2); +reset master; +set global read_only=1; +# Ensure that optimize and analyze doesn't log to binary log +connect con1,localhost,test,,test; +insert into t1 values(3); +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair Error The MariaDB server is running with the --read-only option so it cannot execute this statement +test.t1 repair error Corrupt +optimize table t1; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +# Ensure that using temporary tables is not logged +create temporary table tmp1 (a int) engine=myisam; +insert into tmp1 values (1),(2); +update tmp1 set a=10 where a=2; +delete from tmp1 where a=1; +create temporary table tmp2 select * from t1; +select * from tmp1; +a +10 +select * from tmp2; +a +1 +2 +create temporary table tmp3 like t1; +create or replace temporary table tmp3 like t1; +alter table tmp2 add column (b int); +select * from tmp2; +a b +1 NULL +2 NULL +insert into t1 select a+100 from tmp2; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +drop table tmp1,tmp2,tmp3; +# Clean up test connection +disconnect con1; +connection default; +# Execute some commands as root that should not be logged +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +# Changes to temporary tables created under readonly should not +# be logged +create temporary table tmp4 (a int) engine=myisam; +insert into tmp4 values (1),(2); +create temporary table tmp5 (a int) engine=myisam; +insert into tmp5 select * from tmp4; +alter table tmp5 add column (b int); +set global read_only=0; +insert into tmp4 values (3),(4); +insert into tmp5 values (10,3),(11,4); +select * from tmp4; +a +1 +2 +3 +4 +select * from tmp5; +a b +1 NULL +2 NULL +10 3 +11 4 +update tmp4 set a=10 where a=2; +delete from tmp4 where a=1; +create table t2 select * from tmp4; +alter table tmp5 add column (c int); +insert into tmp5 values (20,5,1),(21,5,2); +select * from tmp5; +a b c +1 NULL NULL +2 NULL NULL +10 3 NULL +11 4 NULL +20 5 1 +21 5 2 +insert into t1 select a+200 from tmp5; +select * from t1; +a +1 +2 +201 +202 +210 +211 +220 +221 +drop table tmp4,tmp5; +# Check what is logged. Only last create select and the insert...select's should be +# row-logged +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4 +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5 +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +# Clean up +drop user test@localhost; +drop table t1,t2; diff --git a/mysql-test/suite/binlog/t/read_only.inc b/mysql-test/suite/binlog/t/read_only.inc new file mode 100644 index 00000000000..37f1cb3b2b8 --- /dev/null +++ b/mysql-test/suite/binlog/t/read_only.inc @@ -0,0 +1,79 @@ +--echo # +--echo # MDEV-17863 DROP TEMPORARY TABLE creates a transaction in +--echo # binary log on read only server +--echo # MDEV-19074 Improved read_only mode for slaves with +--echo # gtid_strict_mode enabled +--echo # + +create user test@localhost; +grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost; +create table t1 (a int) engine=myisam; +insert into t1 values (1),(2); +reset master; + +set global read_only=1; +--echo # Ensure that optimize and analyze doesn't log to binary log +connect (con1,localhost,test,,test); +--error ER_OPTION_PREVENTS_STATEMENT +insert into t1 values(3); +analyze table t1; +check table t1; +repair table t1; +--error ER_OPTION_PREVENTS_STATEMENT +optimize table t1; + +--echo # Ensure that using temporary tables is not logged +create temporary table tmp1 (a int) engine=myisam; +insert into tmp1 values (1),(2); +update tmp1 set a=10 where a=2; +delete from tmp1 where a=1; +create temporary table tmp2 select * from t1; +select * from tmp1; +select * from tmp2; +create temporary table tmp3 like t1; +create or replace temporary table tmp3 like t1; +alter table tmp2 add column (b int); +select * from tmp2; +--error ER_OPTION_PREVENTS_STATEMENT +insert into t1 select a+100 from tmp2; +drop table tmp1,tmp2,tmp3; + +--echo # Clean up test connection +disconnect con1; +connection default; + +--echo # Execute some commands as root that should not be logged +optimize table t1; +repair table t1; + +--echo # Changes to temporary tables created under readonly should not +--echo # be logged +create temporary table tmp4 (a int) engine=myisam; +insert into tmp4 values (1),(2); +create temporary table tmp5 (a int) engine=myisam; +insert into tmp5 select * from tmp4; +alter table tmp5 add column (b int); + +set global read_only=0; + +insert into tmp4 values (3),(4); +insert into tmp5 values (10,3),(11,4); +select * from tmp4; +select * from tmp5; +update tmp4 set a=10 where a=2; +delete from tmp4 where a=1; +create table t2 select * from tmp4; +alter table tmp5 add column (c int); +insert into tmp5 values (20,5,1),(21,5,2); +select * from tmp5; +insert into t1 select a+200 from tmp5; +select * from t1; +drop table tmp4,tmp5; + +--echo # Check what is logged. Only last create select and the insert...select's should be +--echo # row-logged +source include/show_binlog_events.inc; + +--echo # Clean up +drop user test@localhost; +drop table t1,t2; diff --git a/mysql-test/suite/binlog/t/read_only.test b/mysql-test/suite/binlog/t/read_only.test new file mode 100644 index 00000000000..14a4650b36f --- /dev/null +++ b/mysql-test/suite/binlog/t/read_only.test @@ -0,0 +1,2 @@ +--source include/have_binlog_format_mixed_or_row.inc +--source read_only.inc diff --git a/mysql-test/suite/binlog/t/read_only_statement.test b/mysql-test/suite/binlog/t/read_only_statement.test new file mode 100644 index 00000000000..a976854fbb2 --- /dev/null +++ b/mysql-test/suite/binlog/t/read_only_statement.test @@ -0,0 +1,2 @@ +--source include/have_binlog_format_statement.inc +--source read_only.inc diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result index f9468648c61..235022e3f43 100644 --- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result +++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result @@ -337,7 +337,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE SELECT * FROM information_schema.schema_privileges WHERE table_schema = 'information_schema'; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE -CREATE VIEW db_datadict.v2 AS +CREATE SQL SECURITY INVOKER VIEW db_datadict.v2 AS SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE FROM information_schema.tables WHERE table_schema = 'db_datadict'; SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test index 901441a3557..bed3f633212 100644 --- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test +++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test @@ -281,8 +281,9 @@ WHERE table_schema = 'information_schema'; # 2. This user (testuser1) is also able to GRANT the SELECT privilege # on this VIEW to another user (testuser2). # 3. The other user (testuser2) must be able to SELECT on this VIEW -# but gets a different result set than testuser1. -CREATE VIEW db_datadict.v2 AS +# but gets a different result set than testuser1, if the view +# has SQL SECURITY INVOKER. +CREATE SQL SECURITY INVOKER VIEW db_datadict.v2 AS SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE FROM information_schema.tables WHERE table_schema = 'db_datadict'; SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff index a1fa20c2ba1..805ccdb563c 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff @@ -1,6 +1,6 @@ --- alter_algorithm.result +++ alter_algorithm.reject -@@ -7,44 +7,44 @@ +@@ -7,40 +7,40 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; @@alter_algorithm @@ -19,12 +19,6 @@ -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 - # Make existing column NON-NULLABLE - ALTER TABLE t1 MODIFY f3 INT NOT NULL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 # Drop Stored Column ALTER TABLE t1 DROP COLUMN f5; -affected rows: 1 @@ -64,7 +58,7 @@ DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, -@@ -57,22 +57,22 @@ +@@ -53,22 +53,22 @@ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; @@ -97,7 +91,7 @@ DROP TABLE t2, t1; affected rows: 0 CREATE TABLE t1(f1 INT NOT NULL, -@@ -85,27 +85,27 @@ +@@ -81,27 +81,27 @@ INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; @@ -135,7 +129,7 @@ # Column length varies ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); affected rows: 0 -@@ -113,12 +113,12 @@ +@@ -109,12 +109,12 @@ SET foreign_key_checks = 0; affected rows: 0 ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff index 879bba43932..6d2ee160e46 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff @@ -1,6 +1,6 @@ --- alter_algorithm.result +++ alter_algorithm.reject -@@ -7,44 +7,35 @@ +@@ -7,40 +7,32 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; @@alter_algorithm @@ -17,11 +17,6 @@ -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +Got one of the listed errors - # Make existing column NON-NULLABLE - ALTER TABLE t1 MODIFY f3 INT NOT NULL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors # Drop Stored Column ALTER TABLE t1 DROP COLUMN f5; -affected rows: 1 @@ -55,7 +50,7 @@ DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, -@@ -57,22 +48,17 @@ +@@ -53,22 +45,17 @@ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; @@ -83,7 +78,7 @@ DROP TABLE t2, t1; affected rows: 0 CREATE TABLE t1(f1 INT NOT NULL, -@@ -85,27 +71,27 @@ +@@ -81,27 +68,27 @@ INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; @@ -121,7 +116,7 @@ # Column length varies ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); affected rows: 0 -@@ -113,12 +99,12 @@ +@@ -109,12 +96,12 @@ SET foreign_key_checks = 0; affected rows: 0 ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff index 6db0f2af347..c6ce83b5d9f 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff @@ -1,6 +1,6 @@ --- alter_algorithm.result +++ alter_algorithm.reject -@@ -7,44 +7,35 @@ +@@ -7,40 +7,32 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; @@alter_algorithm @@ -17,11 +17,6 @@ -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +Got one of the listed errors - # Make existing column NON-NULLABLE - ALTER TABLE t1 MODIFY f3 INT NOT NULL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors # Drop Stored Column ALTER TABLE t1 DROP COLUMN f5; -affected rows: 1 @@ -55,7 +50,7 @@ DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, -@@ -57,22 +48,22 @@ +@@ -53,22 +45,22 @@ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; @@ -88,7 +83,7 @@ DROP TABLE t2, t1; affected rows: 0 CREATE TABLE t1(f1 INT NOT NULL, -@@ -85,27 +76,27 @@ +@@ -81,27 +73,27 @@ INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; @@ -126,7 +121,7 @@ # Column length varies ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); affected rows: 0 -@@ -113,12 +104,12 @@ +@@ -109,12 +101,12 @@ SET foreign_key_checks = 0; affected rows: 0 ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result index 3d3a7e85444..bcfbe3355f9 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm.result +++ b/mysql-test/suite/innodb/r/alter_algorithm.result @@ -17,10 +17,6 @@ info: Records: 1 Duplicates: 0 Warnings: 0 ALTER TABLE t1 MODIFY f2 INT; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -# Make existing column NON-NULLABLE -ALTER TABLE t1 MODIFY f3 INT NOT NULL; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 # Drop Stored Column ALTER TABLE t1 DROP COLUMN f5; affected rows: 1 diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result index 667f0b2c90b..32814e032fc 100644 --- a/mysql-test/suite/innodb/r/ibuf_not_empty.result +++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result @@ -18,7 +18,7 @@ INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; -# restart: --innodb-force-recovery=6 +# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump check table t1; Table Op Msg_type Msg_text test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096. diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result new file mode 100644 index 00000000000..6ef1ce170cd --- /dev/null +++ b/mysql-test/suite/innodb/r/information_schema_grants.result @@ -0,0 +1,304 @@ +select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE'; +plugin_name Must be ACTIVE +create user select_only@localhost; +grant select on *.* to select_only@localhost; +connect select_only,localhost,select_only; +connection default; +create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page; +create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page; +create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru; +create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru; +create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats; +create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats; +create sql security invoker view i_cmp as select * from information_schema.innodb_cmp; +create sql security definer view d_cmp as select * from information_schema.innodb_cmp; +create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index; +create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index; +create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset; +create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset; +create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset; +create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset; +create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem; +create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem; +create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset; +create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset; +create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted; +create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted; +create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config; +create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config; +create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword; +create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword; +create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted; +create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted; +create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache; +create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache; +create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table; +create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table; +create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits; +create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits; +create sql security invoker view i_locks as select * from information_schema.innodb_locks; +create sql security definer view d_locks as select * from information_schema.innodb_locks; +create sql security invoker view i_metrics as select * from information_schema.innodb_metrics; +create sql security definer view d_metrics as select * from information_schema.innodb_metrics; +create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes; +create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes; +create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns; +create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns; +create sql security invoker view i_sys_datafiles as select * from information_schema.innodb_sys_datafiles; +create sql security definer view d_sys_datafiles as select * from information_schema.innodb_sys_datafiles; +create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields; +create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields; +create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign; +create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign; +create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols; +create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols; +create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes; +create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes; +create sql security invoker view i_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits; +create sql security definer view d_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits; +create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables; +create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables; +create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces; +create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces; +create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats; +create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats; +create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual; +create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual; +create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption; +create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption; +create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing; +create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing; +create sql security invoker view i_trx as select * from information_schema.innodb_trx; +create sql security definer view d_trx as select * from information_schema.innodb_trx; +connection select_only; +select count(*) > -1 from information_schema.innodb_buffer_page; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_buffer_page; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_buffer_page; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_buffer_page_lru; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_buffer_page_lru; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_buffer_page_lru; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_buffer_pool_stats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_buffer_pool_stats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_buffer_pool_stats; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp_per_index; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp_per_index; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp_per_index; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp_per_index_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp_per_index_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp_per_index_reset; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmp_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmp_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmp_reset; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmpmem; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmpmem; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmpmem; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_cmpmem_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_cmpmem_reset; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_cmpmem_reset; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_being_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_being_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_being_deleted; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_config; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_config; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_config; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_default_stopword; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_deleted; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_deleted; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_index_cache; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_index_cache; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_index_cache; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_ft_index_table; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_ft_index_table; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_ft_index_table; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_lock_waits; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_lock_waits; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_lock_waits; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_locks; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_locks; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_locks; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_metrics; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_metrics; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_metrics; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_mutexes; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_mutexes; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_mutexes; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_columns; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_columns; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_columns; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_datafiles; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_datafiles; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_datafiles; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_fields; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_fields; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_fields; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_foreign; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_foreign; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_foreign; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_foreign_cols; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_foreign_cols; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_foreign_cols; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_indexes; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_indexes; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_indexes; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_semaphore_waits; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_semaphore_waits; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_semaphore_waits; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_tables; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_tables; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_tables; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_tablespaces; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_tablespaces; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_tablespaces; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_tablestats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_tablestats; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_tablestats; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_sys_virtual; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_sys_virtual; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_sys_virtual; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_tablespaces_encryption; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +select count(*) > -1 from i_tablespaces_encryption; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +select count(*) > -1 from d_tablespaces_encryption; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +select count(*) > -1 from i_tablespaces_scrubbing; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +select count(*) > -1 from d_tablespaces_scrubbing; +count(*) > -1 +1 +select count(*) > -1 from information_schema.innodb_trx; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from i_trx; +ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation +select count(*) > -1 from d_trx; +count(*) > -1 +1 +connection default; +drop database test; +create database test; +drop user select_only@localhost; diff --git a/mysql-test/suite/innodb/r/innodb-alter-nullable.result b/mysql-test/suite/innodb/r/innodb-alter-nullable.result index 68ad6762335..1d481cf2bfe 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-nullable.result +++ b/mysql-test/suite/innodb/r/innodb-alter-nullable.result @@ -96,8 +96,8 @@ INSERT INTO t3 SET c=NULL; SET @old_sql_mode = @@sql_mode; SET sql_mode = ''; ALTER TABLE t1 MODIFY c INT NOT NULL; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'c' at row 1 ALTER TABLE t2 MODIFY c INT NOT NULL; @@ -111,10 +111,9 @@ info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'c' at row 1 SET sql_mode = @old_sql_mode; -# MDEV-18819 FIXME: Wrong result g=NULL SELECT * FROM t1; c g -0 NULL +0 0 SELECT * FROM t2; c v 0 0 @@ -137,8 +136,8 @@ INSERT INTO t1 SET c=NULL; INSERT INTO t2 SET c=NULL; INSERT INTO t3 SET c=NULL; ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'c' at row 1 ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL; @@ -151,10 +150,9 @@ affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'c' at row 1 -# MDEV-18819 FIXME: Wrong result g=NULL SELECT * FROM t1; c g -0 NULL +0 0 SELECT * FROM t2; c v 0 0 @@ -186,12 +184,11 @@ UPDATE t1 SET c=0; UPDATE t2 SET c=0; UPDATE t3 SET c=0; ALTER TABLE t1 MODIFY c INT NOT NULL; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 ALTER TABLE t2 MODIFY c INT NOT NULL; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 -# MDEV-18819 FIXME: This should not require ALGORITHM=COPY. ALTER TABLE t3 MODIFY c INT NOT NULL; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index ebc5391dbea..273da66073e 100644 --- a/mysql-test/suite/innodb/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -567,7 +567,7 @@ Variable_name Value auto_increment_increment 65535 auto_increment_offset 65535 INSERT INTO t1 VALUES (NULL),(NULL); -ERROR HY000: Failed to read auto-increment value from storage engine +ERROR 22003: Out of range value for column 'c1' at row 1 SELECT * FROM t1; c1 1 @@ -677,7 +677,7 @@ SELECT a,b FROM t; a b 1 S1 3 S2 -4 S2 +5 S2 disconnect con1; connection default; # Client 1: Insert a record with auto_increment_increment=1 @@ -688,14 +688,14 @@ t CREATE TABLE `t` ( `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 INSERT INTO t(b) VALUES('S1'); SELECT a,b FROM t; a b 1 S1 3 S2 -4 S2 -5 S1 +5 S2 +6 S1 DROP TABLE t; # Autoincrement behaviour with mixed insert. CREATE TABLE t( @@ -733,22 +733,22 @@ t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1 INSERT INTO t(b) VALUES('S4'); SELECT * FROM t; a b 1 S0 11 S1 -22 S3 -23 S4 28 S2 +31 S3 +32 S4 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `a` tinyint(4) NOT NULL AUTO_INCREMENT, `b` varchar(200) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1 DROP TABLE t; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; DROP TABLE IF EXISTS t1; @@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` ( `n` int(10) unsigned NOT NULL, `o` enum('FALSE','TRUE') DEFAULT NULL, PRIMARY KEY (`m`) -) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; SHOW CREATE TABLE t1; Table Create Table @@ -1475,13 +1475,13 @@ SELECT * FROM t; i 1 301 -351 +601 SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( `i` int(11) NOT NULL AUTO_INCREMENT, KEY `i` (`i`) -) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1 DROP TABLE t; SET auto_increment_increment = DEFAULT; # diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result index 11a352e625d..e25ab2a8a24 100644 --- a/mysql-test/suite/innodb/r/innodb_stats_persistent.result +++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result @@ -1,22 +1,15 @@ +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked; SET GLOBAL innodb_stats_include_delete_marked = ON; SET @saved_traditional = @@GLOBAL.innodb_stats_traditional; SET GLOBAL innodb_stats_traditional=false; SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter; SET GLOBAL innodb_stats_modified_counter=1; -CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val)) +CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val)) ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1; -CREATE TABLE t1 LIKE t0; -CREATE TABLE t2 LIKE t0; -INSERT INTO t0 (val) VALUES (4); -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t1 SELECT * FROM t0; -SELECT COUNT(*) FROM t1; -COUNT(*) -16 +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected @@ -49,7 +42,7 @@ COUNT(*) 0 connection default; BEGIN; -INSERT INTO t2 SELECT * FROM t0; +INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16; # The INSERT will show up before COMMIT. EXPLAIN SELECT * FROM t2 WHERE val=4; id select_type table type possible_keys key key_len ref rows Extra @@ -66,17 +59,14 @@ connection con1; EXPLAIN SELECT * FROM t2 WHERE val=4; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref val val 4 const 1 Using index -SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; -SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; InnoDB 0 transactions not purged -SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; # After COMMIT and purge, the DELETE must show up. EXPLAIN SELECT * FROM t1 WHERE val=4; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref val val 4 const 1 Using index SET GLOBAL innodb_stats_include_delete_marked = OFF; BEGIN; -INSERT INTO t1 SELECT * FROM t0; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; EXPLAIN SELECT * FROM t1 WHERE val=4; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref val val 4 const 16 Using index @@ -85,7 +75,7 @@ EXPLAIN SELECT * FROM t1 WHERE val=4; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref val val 4 const 1 Using index BEGIN; -INSERT INTO t1 SELECT * FROM t0; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; COMMIT; EXPLAIN SELECT * FROM t1 WHERE val=4; id select_type table type possible_keys key key_len ref rows Extra @@ -111,7 +101,8 @@ COUNT(*) 16 disconnect con1; connection default; -DROP TABLE t0,t1,t2; +DROP TABLE t1,t2; SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked; SET GLOBAL innodb_stats_traditional = @saved_traditional; SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index 661db48099d..19262246c9b 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -130,6 +130,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0; pk f1 f2 f3 f4 f5 f6 f7 f8 filler HANDLER h CLOSE; DROP TABLE t1; +# +# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys +# which are pointed to the table being altered +# CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb; CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL, status ENUM ('a', 'b', 'c'), INDEX idx1(f2), @@ -156,6 +160,17 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ALTER TABLE t2 CHANGE status status VARCHAR(20) DEFAULT NULL; DROP TABLE t2, t1; +# +# MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE +# +CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE, +FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB; +ALTER TABLE t2 +DROP FOREIGN KEY fk1, +CHANGE b d INT UNSIGNED, +ADD c INT; +DROP TABLE t2, t1; create table t ( a varchar(9), b int, diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result new file mode 100644 index 00000000000..bb449570479 --- /dev/null +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -0,0 +1,15 @@ +rename table mysql.table_stats to mysql.table_stats_save; +flush tables; +set use_stat_tables= PREFERABLY; +create table t1 (a int) engine=InnoDB; +start transaction; +insert t1 values (1); +insert t1 values (2); +commit; +select * from t1; +a +1 +2 +drop table t1; +rename table mysql.table_stats_save to mysql.table_stats; +flush tables; diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test index 7cb706e865a..d410a15154d 100644 --- a/mysql-test/suite/innodb/t/alter_algorithm.test +++ b/mysql-test/suite/innodb/t/alter_algorithm.test @@ -31,10 +31,6 @@ ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col --error $error_code ALTER TABLE t1 MODIFY f2 INT; ---echo # Make existing column NON-NULLABLE ---error $error_code -ALTER TABLE t1 MODIFY f3 INT NOT NULL; - --echo # Drop Stored Column --error $error_code ALTER TABLE t1 DROP COLUMN f5; diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test index 5adbfb72550..470d375c661 100644 --- a/mysql-test/suite/innodb/t/ibuf_not_empty.test +++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test @@ -43,7 +43,7 @@ INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; ---let $restart_parameters= --innodb-force-recovery=6 +--let $restart_parameters= --innodb-force-recovery=6 --innodb-change-buffer-dump --source include/restart_mysqld.inc --replace_regex /contains \d+ entries/contains #### entries/ diff --git a/mysql-test/suite/innodb/t/information_schema_grants.opt b/mysql-test/suite/innodb/t/information_schema_grants.opt new file mode 100644 index 00000000000..ce08c46f047 --- /dev/null +++ b/mysql-test/suite/innodb/t/information_schema_grants.opt @@ -0,0 +1,33 @@ +--enable-plugin-innodb-trx +--enable-plugin-innodb-locks +--enable-plugin-innodb-lock-waits +--enable-plugin-innodb-cmp +--enable-plugin-innodb-cmp-reset +--enable-plugin-innodb-cmpmem +--enable-plugin-innodb-cmpmem-reset +--enable-plugin-innodb-cmp-per-index +--enable-plugin-innodb-cmp-per-index-reset +--enable-plugin-innodb-buffer-page +--enable-plugin-innodb-buffer-page-lru +--enable-plugin-innodb-buffer-pool-stats +--enable-plugin-innodb-metrics +--enable-plugin-innodb-ft-default-stopword +--enable-plugin-innodb-ft-deleted +--enable-plugin-innodb-ft-being-deleted +--enable-plugin-innodb-ft-config +--enable-plugin-innodb-ft-index-cache +--enable-plugin-innodb-ft-index-table +--enable-plugin-innodb-sys-tables +--enable-plugin-innodb-sys-tablestats +--enable-plugin-innodb-sys-indexes +--enable-plugin-innodb-sys-columns +--enable-plugin-innodb-sys-fields +--enable-plugin-innodb-sys-foreign +--enable-plugin-innodb-sys-foreign-cols +--enable-plugin-innodb-sys-tablespaces +--enable-plugin-innodb-sys-datafiles +--enable-plugin-innodb-sys-virtual +--enable-plugin-innodb-mutexes +--enable-plugin-innodb-sys-semaphore-waits +--enable-plugin-innodb-tablespaces-encryption +--enable-plugin-innodb-tablespaces-scrubbing diff --git a/mysql-test/suite/innodb/t/information_schema_grants.test b/mysql-test/suite/innodb/t/information_schema_grants.test new file mode 100644 index 00000000000..34565f76352 --- /dev/null +++ b/mysql-test/suite/innodb/t/information_schema_grants.test @@ -0,0 +1,311 @@ +source include/have_innodb.inc; +source include/not_embedded.inc; + +# make sure we've enabled everything: +select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE'; + +create user select_only@localhost; +grant select on *.* to select_only@localhost; + +connect select_only,localhost,select_only; +connection default; + +create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page; +create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page; + +create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru; +create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru; + +create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats; +create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats; + +create sql security invoker view i_cmp as select * from information_schema.innodb_cmp; +create sql security definer view d_cmp as select * from information_schema.innodb_cmp; + +create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index; +create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index; + +create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset; +create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset; + +create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset; +create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset; + +create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem; +create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem; + +create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset; +create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset; + +create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted; +create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted; + +create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config; +create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config; + +create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword; +create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword; + +create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted; +create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted; + +create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache; +create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache; + +create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table; +create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table; + +create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits; +create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits; + +create sql security invoker view i_locks as select * from information_schema.innodb_locks; +create sql security definer view d_locks as select * from information_schema.innodb_locks; + +create sql security invoker view i_metrics as select * from information_schema.innodb_metrics; +create sql security definer view d_metrics as select * from information_schema.innodb_metrics; + +create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes; +create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes; + +create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns; +create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns; + +create sql security invoker view i_sys_datafiles as select * from information_schema.innodb_sys_datafiles; +create sql security definer view d_sys_datafiles as select * from information_schema.innodb_sys_datafiles; + +create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields; +create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields; + +create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign; +create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign; + +create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols; +create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols; + +create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes; +create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes; + +create sql security invoker view i_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits; +create sql security definer view d_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits; + +create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables; +create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables; + +create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces; +create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces; + +create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats; +create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats; + +create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual; +create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual; + +create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption; +create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption; + +create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing; +create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing; + +create sql security invoker view i_trx as select * from information_schema.innodb_trx; +create sql security definer view d_trx as select * from information_schema.innodb_trx; + +connection select_only; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_buffer_page; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_buffer_page; +select count(*) > -1 from d_buffer_page; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_buffer_page_lru; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_buffer_page_lru; +select count(*) > -1 from d_buffer_page_lru; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_buffer_pool_stats; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_buffer_pool_stats; +select count(*) > -1 from d_buffer_pool_stats; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_cmp; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_cmp; +select count(*) > -1 from d_cmp; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_cmp_per_index; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_cmp_per_index; +select count(*) > -1 from d_cmp_per_index; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_cmp_per_index_reset; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_cmp_per_index_reset; +select count(*) > -1 from d_cmp_per_index_reset; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_cmp_reset; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_cmp_reset; +select count(*) > -1 from d_cmp_reset; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_cmpmem; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_cmpmem; +select count(*) > -1 from d_cmpmem; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_cmpmem_reset; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_cmpmem_reset; +select count(*) > -1 from d_cmpmem_reset; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_ft_being_deleted; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_ft_being_deleted; +select count(*) > -1 from d_ft_being_deleted; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_ft_config; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_ft_config; +select count(*) > -1 from d_ft_config; + +# non-privileged table +select count(*) > -1 from information_schema.innodb_ft_default_stopword; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_ft_deleted; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_ft_deleted; +select count(*) > -1 from d_ft_deleted; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_ft_index_cache; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_ft_index_cache; +select count(*) > -1 from d_ft_index_cache; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_ft_index_table; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_ft_index_table; +select count(*) > -1 from d_ft_index_table; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_lock_waits; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_lock_waits; +select count(*) > -1 from d_lock_waits; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_locks; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_locks; +select count(*) > -1 from d_locks; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_metrics; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_metrics; +select count(*) > -1 from d_metrics; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_mutexes; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_mutexes; +select count(*) > -1 from d_mutexes; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_columns; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_columns; +select count(*) > -1 from d_sys_columns; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_datafiles; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_datafiles; +select count(*) > -1 from d_sys_datafiles; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_fields; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_fields; +select count(*) > -1 from d_sys_fields; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_foreign; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_foreign; +select count(*) > -1 from d_sys_foreign; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_foreign_cols; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_foreign_cols; +select count(*) > -1 from d_sys_foreign_cols; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_indexes; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_indexes; +select count(*) > -1 from d_sys_indexes; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_semaphore_waits; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_semaphore_waits; +select count(*) > -1 from d_sys_semaphore_waits; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_tables; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_tables; +select count(*) > -1 from d_sys_tables; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_tablespaces; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_tablespaces; +select count(*) > -1 from d_sys_tablespaces; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_tablestats; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_tablestats; +select count(*) > -1 from d_sys_tablestats; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_sys_virtual; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_sys_virtual; +select count(*) > -1 from d_sys_virtual; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_tablespaces_encryption; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_tablespaces_encryption; +select count(*) > -1 from d_tablespaces_encryption; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_tablespaces_scrubbing; +select count(*) > -1 from d_tablespaces_scrubbing; + +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from information_schema.innodb_trx; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +select count(*) > -1 from i_trx; +select count(*) > -1 from d_trx; + +connection default; +drop database test; +create database test; +drop user select_only@localhost; diff --git a/mysql-test/suite/innodb/t/innodb-alter-nullable.test b/mysql-test/suite/innodb/t/innodb-alter-nullable.test index 9e6f5df2bc9..af13a12ab41 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-nullable.test +++ b/mysql-test/suite/innodb/t/innodb-alter-nullable.test @@ -104,7 +104,6 @@ ALTER TABLE t2 MODIFY c INT NOT NULL; ALTER TABLE t3 MODIFY c INT NOT NULL; --disable_info SET sql_mode = @old_sql_mode; ---echo # MDEV-18819 FIXME: Wrong result g=NULL SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; @@ -123,7 +122,6 @@ ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL; ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL; ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL; --disable_info ---echo # MDEV-18819 FIXME: Wrong result g=NULL SELECT * FROM t1; SELECT * FROM t2; SELECT * FROM t3; @@ -151,7 +149,6 @@ UPDATE t3 SET c=0; --enable_info ALTER TABLE t1 MODIFY c INT NOT NULL; ALTER TABLE t2 MODIFY c INT NOT NULL; ---echo # MDEV-18819 FIXME: This should not require ALGORITHM=COPY. ALTER TABLE t3 MODIFY c INT NOT NULL; --disable_info SELECT * FROM t1; diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index 74a52caba12..ca7727d4cef 100644 --- a/mysql-test/suite/innodb/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 SELECT * FROM t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; SHOW VARIABLES LIKE "auto_inc%"; ---error 1467 +--error HA_ERR_AUTOINC_ERANGE INSERT INTO t1 VALUES (NULL),(NULL); SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test index 652b201c4b4..f79ae37e8de 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_persistent.test +++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test @@ -1,6 +1,8 @@ --source include/have_innodb.inc ---source include/big_test.inc +--source include/have_sequence.inc +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked; SET GLOBAL innodb_stats_include_delete_marked = ON; SET @saved_traditional = @@GLOBAL.innodb_stats_traditional; @@ -8,19 +10,11 @@ SET GLOBAL innodb_stats_traditional=false; SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter; SET GLOBAL innodb_stats_modified_counter=1; -CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val)) +CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val)) ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1; -CREATE TABLE t1 LIKE t0; -CREATE TABLE t2 LIKE t0; +CREATE TABLE t2 LIKE t1; -INSERT INTO t0 (val) VALUES (4); -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t0 (val) SELECT 4 FROM t0; -INSERT INTO t0 (val) SELECT 4 FROM t0; - -INSERT INTO t1 SELECT * FROM t0; -SELECT COUNT(*) FROM t1; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; ANALYZE TABLE t1; connect(con1, localhost, root,,); @@ -46,7 +40,7 @@ SELECT COUNT(*) FROM t1; connection default; BEGIN; -INSERT INTO t2 SELECT * FROM t0; +INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16; --echo # The INSERT will show up before COMMIT. EXPLAIN SELECT * FROM t2 WHERE val=4; @@ -57,21 +51,18 @@ SELECT COUNT(*) FROM t2; connection con1; EXPLAIN SELECT * FROM t2 WHERE val=4; -SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; -SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; --source include/wait_all_purged.inc -SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; --echo # After COMMIT and purge, the DELETE must show up. EXPLAIN SELECT * FROM t1 WHERE val=4; SET GLOBAL innodb_stats_include_delete_marked = OFF; BEGIN; -INSERT INTO t1 SELECT * FROM t0; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; EXPLAIN SELECT * FROM t1 WHERE val=4; ROLLBACK; EXPLAIN SELECT * FROM t1 WHERE val=4; BEGIN; -INSERT INTO t1 SELECT * FROM t0; +INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; COMMIT; EXPLAIN SELECT * FROM t1 WHERE val=4; BEGIN; @@ -89,7 +80,8 @@ disconnect con1; connection default; -DROP TABLE t0,t1,t2; +DROP TABLE t1,t2; SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked; SET GLOBAL innodb_stats_traditional = @saved_traditional; SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index 9f49d1d4682..090a4aef787 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -138,8 +138,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0; HANDLER h CLOSE; DROP TABLE t1; -# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys which are pointed -# to the table being altered +--echo # +--echo # MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys +--echo # which are pointed to the table being altered +--echo # CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb; CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL, status ENUM ('a', 'b', 'c'), INDEX idx1(f2), @@ -158,6 +160,19 @@ DROP TABLE t2, t1; --let $datadir= `select @@datadir` --remove_file $datadir/test/load.data +--echo # +--echo # MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE +--echo # + +CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE, + FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB; +ALTER TABLE t2 + DROP FOREIGN KEY fk1, + CHANGE b d INT UNSIGNED, + ADD c INT; +DROP TABLE t2, t1; + create table t ( a varchar(9), diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test new file mode 100644 index 00000000000..68344b3f425 --- /dev/null +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -0,0 +1,17 @@ +source include/have_innodb.inc; + +# +# MDEV-20354 All but last insert ignored in InnoDB tables when table locked +# +rename table mysql.table_stats to mysql.table_stats_save; +flush tables; +set use_stat_tables= PREFERABLY; +create table t1 (a int) engine=InnoDB; +start transaction; +insert t1 values (1); +insert t1 values (2); +commit; +select * from t1; +drop table t1; +rename table mysql.table_stats_save to mysql.table_stats; +flush tables; diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result index cb6a441f905..37c0ff27046 100644 --- a/mysql-test/suite/innodb_fts/r/crash_recovery.result +++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result @@ -42,9 +42,11 @@ INSERT INTO articles (title,body) VALUES ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), ('MySQL vs. YourSQL','In the following database comparison ...'), ('MySQL Security','When configured properly, MySQL ...'); +connect dml, localhost, root,,; BEGIN; INSERT INTO articles (title,body) VALUES ('MySQL Tutorial','DBMS stands for DataBase ...'); +connection default; # Make durable the AUTO_INCREMENT in the above incomplete transaction. connect flush_redo_log,localhost,root,,; SET GLOBAL innodb_flush_log_at_trx_commit=1; @@ -54,6 +56,7 @@ ROLLBACK; disconnect flush_redo_log; connection default; # restart +disconnect dml; INSERT INTO articles (title,body) VALUES ('MySQL Tutorial','DBMS stands for DataBase ...'); SELECT * FROM articles @@ -81,10 +84,40 @@ INSERT INTO articles VALUES (4, 11, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), (5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'), (7, 4, 'MySQL Security','When configured properly, MySQL ...'); +connect dml, localhost, root,,; BEGIN; INSERT INTO articles VALUES (100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...'); +connect dml2, localhost, root,,; +# +# MDEV-19073 FTS row mismatch after crash recovery +# +CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT, +FULLTEXT(title,body)) ENGINE=InnoDB; +INSERT INTO mdev19073 (title, body) VALUES +('MySQL Tutorial', 'DBMS stands for Database...'); +CREATE FULLTEXT INDEX idx ON mdev19073(title, body); +CREATE TABLE mdev19073_2 LIKE mdev19073; +INSERT INTO mdev19073_2 (title, body) VALUES +('MySQL Tutorial', 'DBMS stands for Database...'); +INSERT INTO mdev19073 (title, body) VALUES +('MariaDB Tutorial', 'DB means Database ...'); +INSERT INTO mdev19073_2 (title, body) VALUES +('MariaDB Tutorial', 'DB means Database ...'); +SELECT * FROM mdev19073 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +SELECT * FROM mdev19073_2 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +connection default; # restart +disconnect dml; +disconnect dml2; INSERT INTO articles VALUES (8, 12, 'MySQL Tutorial','DBMS stands for DataBase ...'); SELECT * FROM articles WHERE MATCH (title, body) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); @@ -93,3 +126,14 @@ id FTS_DOC_ID title body 1 10 MySQL Tutorial DBMS stands for DataBase ... 8 12 MySQL Tutorial DBMS stands for DataBase ... DROP TABLE articles; +SELECT * FROM mdev19073 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +SELECT * FROM mdev19073_2 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +DROP TABLE mdev19073, mdev19073_2; diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test index f39d6680dfb..1b321af236a 100644 --- a/mysql-test/suite/innodb_fts/t/crash_recovery.test +++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test @@ -6,6 +6,7 @@ --source include/have_innodb.inc # The embedded server tests do not support restarting. --source include/not_embedded.inc +--source include/maybe_debug.inc FLUSH TABLES; # Following are test for crash recovery on FTS index, the first scenario @@ -73,10 +74,12 @@ INSERT INTO articles (title,body) VALUES ('MySQL vs. YourSQL','In the following database comparison ...'), ('MySQL Security','When configured properly, MySQL ...'); +connect(dml, localhost, root,,); BEGIN; INSERT INTO articles (title,body) VALUES ('MySQL Tutorial','DBMS stands for DataBase ...'); +connection default; --echo # Make durable the AUTO_INCREMENT in the above incomplete transaction. --connect (flush_redo_log,localhost,root,,) @@ -89,6 +92,8 @@ ROLLBACK; --source include/restart_mysqld.inc +disconnect dml; + # This insert will re-initialize the Doc ID counter, it should not crash INSERT INTO articles (title,body) VALUES ('MySQL Tutorial','DBMS stands for DataBase ...'); @@ -121,6 +126,7 @@ INSERT INTO articles VALUES (5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'), (7, 4, 'MySQL Security','When configured properly, MySQL ...'); +connect(dml, localhost, root,,); BEGIN; # Below we do not depend on the durability of the AUTO_INCREMENT sequence, @@ -128,7 +134,49 @@ BEGIN; INSERT INTO articles VALUES (100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...'); +connect(dml2, localhost, root,,); + +--echo # +--echo # MDEV-19073 FTS row mismatch after crash recovery +--echo # + +CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT, + FULLTEXT(title,body)) ENGINE=InnoDB; +INSERT INTO mdev19073 (title, body) VALUES + ('MySQL Tutorial', 'DBMS stands for Database...'); +CREATE FULLTEXT INDEX idx ON mdev19073(title, body); +CREATE TABLE mdev19073_2 LIKE mdev19073; +if ($have_debug) +{ +--disable_query_log +SET @saved_dbug = @@debug_dbug; +SET DEBUG_DBUG = '+d,fts_instrument_sync_debug'; +--enable_query_log +} +INSERT INTO mdev19073_2 (title, body) VALUES + ('MySQL Tutorial', 'DBMS stands for Database...'); +if ($have_debug) +{ +--disable_query_log +SET DEBUG_DBUG = @saved_dbug; +--enable_query_log +} + +INSERT INTO mdev19073 (title, body) VALUES + ('MariaDB Tutorial', 'DB means Database ...'); +INSERT INTO mdev19073_2 (title, body) VALUES + ('MariaDB Tutorial', 'DB means Database ...'); + +# Should return 2 rows +SELECT * FROM mdev19073 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +SELECT * FROM mdev19073_2 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); + +connection default; --source include/restart_mysqld.inc +disconnect dml; +disconnect dml2; # This would re-initialize the FTS index and do the re-tokenization # of above records @@ -138,3 +186,10 @@ SELECT * FROM articles WHERE MATCH (title, body) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); DROP TABLE articles; + +# Should return 2 rows +SELECT * FROM mdev19073 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +SELECT * FROM mdev19073_2 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +DROP TABLE mdev19073, mdev19073_2; diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result index 660f64070ca..de24b987524 100644 --- a/mysql-test/suite/maria/lock.result +++ b/mysql-test/suite/maria/lock.result @@ -109,6 +109,39 @@ ALTER TABLE t1 ADD UNIQUE KEY (f1); ERROR 23000: Duplicate entry 'foo' for key 'f1' ALTER TABLE t1 ADD KEY (f2); DROP TABLE t1; +# +# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE +# +CREATE TABLE t1 (a INT, b INT) ENGINE=Aria; +SELECT * FROM t1; +a b +CREATE TABLE t2 (c INT) ENGINE=Aria; +LOCK TABLE t2 READ, t1 WRITE; +ALTER TABLE t1 CHANGE b a INT; +ERROR 42S21: Duplicate column name 'a' +UNLOCK TABLES; +DROP TABLE t1, t2; +# +# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE +# +CREATE TABLE t1 (a INT) ENGINE=Aria; +CREATE TABLE t2 (b INT) ENGINE=Aria; +LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE; +ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY; +UNLOCK TABLES; +DROP TABLE t1, t2; +# More complex test, from RQG +CREATE TABLE t1 (a INT) ENGINE=Aria; +CREATE TABLE t2 (b INT) ENGINE=Aria; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ; +LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE; +ALTER TABLE t1 FORCE; +ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY; +UNLOCK TABLES; +DROP VIEW v2; +DROP TABLE t1, t2; # End of 10.2 tests # # MDEV-14669 Assertion `file->trn == trn' failed in ha_maria::start_stmt diff --git a/mysql-test/suite/maria/lock.test b/mysql-test/suite/maria/lock.test index 37356a359d8..bb709f8a69c 100644 --- a/mysql-test/suite/maria/lock.test +++ b/mysql-test/suite/maria/lock.test @@ -118,6 +118,52 @@ ALTER TABLE t1 ADD UNIQUE KEY (f1); ALTER TABLE t1 ADD KEY (f2); DROP TABLE t1; + +--echo # +--echo # MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE +--echo # + +CREATE TABLE t1 (a INT, b INT) ENGINE=Aria; +SELECT * FROM t1; +CREATE TABLE t2 (c INT) ENGINE=Aria; + +LOCK TABLE t2 READ, t1 WRITE; +--error ER_DUP_FIELDNAME +ALTER TABLE t1 CHANGE b a INT; + +# Cleanup +UNLOCK TABLES; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE +--echo # + +CREATE TABLE t1 (a INT) ENGINE=Aria; +CREATE TABLE t2 (b INT) ENGINE=Aria; + +LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE; +ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY; +UNLOCK TABLES; +DROP TABLE t1, t2; + +--echo # More complex test, from RQG + +CREATE TABLE t1 (a INT) ENGINE=Aria; +CREATE TABLE t2 (b INT) ENGINE=Aria; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ; + +LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE; + +ALTER TABLE t1 FORCE; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE; +ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY; + +UNLOCK TABLES; +DROP VIEW v2; +DROP TABLE t1, t2; + --echo # End of 10.2 tests --echo # diff --git a/mysql-test/suite/rpl/r/rpl_read_only2.result b/mysql-test/suite/rpl/r/rpl_read_only2.result new file mode 100644 index 00000000000..db0f1c1f742 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_read_only2.result @@ -0,0 +1,54 @@ +include/master-slave.inc +[connection master] +# +# Ensure that read-only slave logs temporary table statements under statement based +# replication. This is related to MDEV-17863. +# +connection slave; +set global read_only=1; +connection master; +create table t1(a int) engine=MyISAM; +create temporary table tmp1 (a int) engine=MyISAM; +insert into t1 values(1); +insert into tmp1 values (2); +insert into t1 select * from tmp1; +insert into t1 values(3); +select * from t1; +a +1 +2 +3 +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +drop table t1; +drop temporary table tmp1; +connection slave; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; create table t1(a int) engine=MyISAM +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; create temporary table tmp1 (a int) engine=MyISAM +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into t1 values(1) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into tmp1 values (2) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into t1 select * from tmp1 +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into t1 values(3) +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; analyze table t1 +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tmp1` /* generated by server */ +set global read_only=0; +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_read_only2.test b/mysql-test/suite/rpl/t/rpl_read_only2.test new file mode 100644 index 00000000000..da825c8fc7f --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_read_only2.test @@ -0,0 +1,30 @@ +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--echo # +--echo # Ensure that read-only slave logs temporary table statements under statement based +--echo # replication. This is related to MDEV-17863. +--echo # + +connection slave; +set global read_only=1; + +connection master; + +create table t1(a int) engine=MyISAM; +create temporary table tmp1 (a int) engine=MyISAM; +insert into t1 values(1); +insert into tmp1 values (2); +insert into t1 select * from tmp1; +insert into t1 values(3); +select * from t1; +analyze table t1; +drop table t1; +drop temporary table tmp1; + +sync_slave_with_master; +--source include/show_binlog_events.inc +set global read_only=0; +connection master; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/sql_sequence/other.result b/mysql-test/suite/sql_sequence/other.result index ff58e35772b..abc101b3c00 100644 --- a/mysql-test/suite/sql_sequence/other.result +++ b/mysql-test/suite/sql_sequence/other.result @@ -209,4 +209,95 @@ delete s,t1 from t1,s; ERROR HY000: Storage engine SEQUENCE of the table `test`.`s` doesn't have this option DROP SEQUENCE s; DROP TABLE t1; +# +# MDEV-20074: Lost connection on update trigger +# +# INSERT & table +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +INSERT INTO t2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name); +END; +$$ +update t1 set p_first_name='Yunxi' where p_id=1; +drop sequence s1; +drop table t1,t2; +# INSERT & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +INSERT INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name); +END; +$$ +update t1 set p_first_name='Yunxi' where p_id=1; +drop view v2; +drop table t1,t2; +drop sequence s1; +# INSERT SELECT & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +INSERT INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name; +END; +$$ +update t1 set p_first_name='Yunxi' where p_id=1; +drop view v2; +drop table t1,t2; +drop sequence s1; +# REPLACE & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +REPLACE INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name); +END; +$$ +update t1 set p_first_name='Yunxi' where p_id=1; +drop view v2; +drop table t1,t2; +drop sequence s1; +# REPLACE SELECT & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +REPLACE INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name; +END; +$$ +update t1 set p_first_name='Yunxi' where p_id=1; +drop view v2; +drop table t1,t2; +drop sequence s1; # End of 10.3 tests diff --git a/mysql-test/suite/sql_sequence/other.test b/mysql-test/suite/sql_sequence/other.test index 5759b195950..70c4efa40e5 100644 --- a/mysql-test/suite/sql_sequence/other.test +++ b/mysql-test/suite/sql_sequence/other.test @@ -179,4 +179,140 @@ DROP SEQUENCE s; DROP TABLE t1; +--echo # +--echo # MDEV-20074: Lost connection on update trigger +--echo # + +--echo # INSERT & table +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); + +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); + +DELIMITER $$; + +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +INSERT INTO t2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name); +END; +$$ +DELIMITER ;$$ + +update t1 set p_first_name='Yunxi' where p_id=1; + +drop sequence s1; +drop table t1,t2; + + +--echo # INSERT & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; + +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); + +DELIMITER $$; + +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +INSERT INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name); +END; +$$ +DELIMITER ;$$ + +update t1 set p_first_name='Yunxi' where p_id=1; + +drop view v2; +drop table t1,t2; +drop sequence s1; + + +--echo # INSERT SELECT & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; + +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); + +DELIMITER $$; + +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +INSERT INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name; +END; +$$ +DELIMITER ;$$ + +update t1 set p_first_name='Yunxi' where p_id=1; + +drop view v2; +drop table t1,t2; +drop sequence s1; + + +--echo # REPLACE & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; + +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); + +DELIMITER $$; + +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +REPLACE INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name); +END; +$$ +DELIMITER ;$$ + +update t1 set p_first_name='Yunxi' where p_id=1; + +drop view v2; +drop table t1,t2; +drop sequence s1; + + +--echo # REPLACE SELECT & view +create sequence s1 increment by 1 start with 1; +create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128)); +create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp); +create view v2 as select * from t2; + +insert into t1 values +(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa'); + +DELIMITER $$; + +CREATE TRIGGER tr_upd +BEFORE UPDATE on t1 +FOR EACH ROW +BEGIN +REPLACE INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name; +END; +$$ +DELIMITER ;$$ + +update t1 set p_first_name='Yunxi' where p_id=1; + +drop view v2; +drop table t1,t2; +drop sequence s1; + --echo # End of 10.3 tests diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 9c1d121ede6..f91c01c285a 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -333,6 +333,18 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_CHANGE_BUFFER_DUMP +SESSION_VALUE NULL +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Dump the change buffer at startup. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_CHANGE_BUFFER_MAX_SIZE SESSION_VALUE NULL DEFAULT_VALUE 25 diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result index f3bbd6039eb..9419c35bb38 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result @@ -274,3 +274,18 @@ index(col_char,vcol_blob(64)) insert ignore into t1 (pk) values (1),(2); update t1 set col_char = 'foo' where pk = 1; drop table t1; +create table t1 ( +id int not null primary key, +a varchar(200), +b varchar(200), +c int, +va char(200) generated always as (ucase(a)) virtual, +vb char(200) generated always as (ucase(b)) virtual, +key (c,va,vb) +) engine=innodb; +insert t1 (id,a,c) select seq,seq,seq from seq_1_to_330; +select IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') from t1; +IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') +GOOD +alter table t1 drop column va; +drop table t1; diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.opt b/mysql-test/suite/vcol/t/vcol_keys_innodb.opt new file mode 100644 index 00000000000..778b4443d4f --- /dev/null +++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.opt @@ -0,0 +1 @@ +--innodb-sort-buffer-size=64k diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.test b/mysql-test/suite/vcol/t/vcol_keys_innodb.test index 58fb8378ac7..c475dd71a69 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_innodb.test +++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.test @@ -117,3 +117,21 @@ create table t1 ( insert ignore into t1 (pk) values (1),(2); update t1 set col_char = 'foo' where pk = 1; drop table t1; + +# +# MDEV-20799 DROP Virtual Column crashes MariaDB +# +--source include/have_sequence.inc +create table t1 ( + id int not null primary key, + a varchar(200), + b varchar(200), + c int, + va char(200) generated always as (ucase(a)) virtual, + vb char(200) generated always as (ucase(b)) virtual, + key (c,va,vb) +) engine=innodb; +insert t1 (id,a,c) select seq,seq,seq from seq_1_to_330; +select IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') from t1; +alter table t1 drop column va; +drop table t1; diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result index 67d80584a90..1b9925b1e62 100644 --- a/mysql-test/suite/versioning/r/foreign.result +++ b/mysql-test/suite/versioning/r/foreign.result @@ -400,3 +400,32 @@ Warning 1265 Data truncated for column 'f12' at row 7 SET timestamp = 9; REPLACE INTO t2 SELECT * FROM t2; DROP TABLE t1, t2; +# +# MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation +# +create or replace table t1 (a int, key(a)) engine innodb with system versioning; +create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb; +insert into t1 values (1),(2); +insert into t2 values (1); +# DELETE from referenced table is not allowed +delete from t1 where a = 1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`)) +drop tables t2, t1; +# +# MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 or server crash in row_ins_foreign_report_err upon DELETE from versioned table with FK +# +create or replace table t1 (x int primary key) engine innodb; +create or replace table t2 (x int, foreign key (x) references t1(x)) engine innodb with system versioning; +set foreign_key_checks= off; +insert into t2 values (1), (1); +set foreign_key_checks= on; +# DELETE from foreign table is allowed +delete from t2; +drop tables t2, t1; +create or replace table t1 (a int, key(a)) engine innodb; +insert into t1 values (1); +create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb with system versioning; +insert into t2 values (1), (1); +# DELETE from foreign table is allowed +delete from t2; +drop tables t2, t1; diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test index 9d754cb05fe..453ddd34034 100644 --- a/mysql-test/suite/versioning/t/foreign.test +++ b/mysql-test/suite/versioning/t/foreign.test @@ -426,4 +426,36 @@ DROP TABLE t1, t2; --remove_file $datadir/test/t1.data.2 --remove_file $datadir/test/t2.data +--echo # +--echo # MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation +--echo # +create or replace table t1 (a int, key(a)) engine innodb with system versioning; +create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb; +insert into t1 values (1),(2); +insert into t2 values (1); +--echo # DELETE from referenced table is not allowed +--error ER_ROW_IS_REFERENCED_2 +delete from t1 where a = 1; +drop tables t2, t1; + +--echo # +--echo # MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 or server crash in row_ins_foreign_report_err upon DELETE from versioned table with FK +--echo # +create or replace table t1 (x int primary key) engine innodb; +create or replace table t2 (x int, foreign key (x) references t1(x)) engine innodb with system versioning; +set foreign_key_checks= off; +insert into t2 values (1), (1); +set foreign_key_checks= on; +--echo # DELETE from foreign table is allowed +delete from t2; +drop tables t2, t1; + +create or replace table t1 (a int, key(a)) engine innodb; +insert into t1 values (1); +create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb with system versioning; +insert into t2 values (1), (1); +--echo # DELETE from foreign table is allowed +delete from t2; +drop tables t2, t1; + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 6314132ca6c..ebd6c41d9bc 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -190,14 +190,15 @@ wsrep_thread_count 0 # applier/rollbacker threads. SET GLOBAL wsrep_cluster_address= 'gcomm://'; # Wait for applier thread to get created 1. -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; -VARIABLE_VALUE +# Wait for applier thread to get created 2. +SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; +EXPECT_1 1 -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; -VARIABLE_VALUE +SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; +EXPECT_1 1 -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; -VARIABLE_VALUE +SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; +EXPECT_2 2 SELECT @@global.wsrep_provider; @@global.wsrep_provider @@ -215,14 +216,14 @@ wsrep_thread_count 2 SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads; SET GLOBAL wsrep_slave_threads= 10; # Wait for 9 applier threads to get created. -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; -VARIABLE_VALUE +SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; +EXPECT_10 10 -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; -VARIABLE_VALUE +SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; +EXPECT_1 1 -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; -VARIABLE_VALUE +SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; +EXPECT_11 11 SHOW STATUS LIKE 'threads_connected'; Variable_name Value diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 5032398fc42..6caa5cff500 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -102,10 +102,13 @@ SET GLOBAL wsrep_cluster_address= 'gcomm://'; --echo # Wait for applier thread to get created 1. --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; --source include/wait_condition.inc +--echo # Wait for applier thread to get created 2. +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; +--source include/wait_condition.inc -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; +SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; +SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; +SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -121,9 +124,9 @@ SET GLOBAL wsrep_slave_threads= 10; --let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; --source include/wait_condition.inc -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; +SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; +SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count'; +SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count'; SHOW STATUS LIKE 'threads_connected'; |