diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-08-30 13:33:02 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-08-30 13:33:02 +0300 |
commit | e71aca8200558d590f8b1b8dbafa9693fcf5078b (patch) | |
tree | 13b6bb1f06307266c08df7ca8515ede4616481d5 /mysql-test/suite | |
parent | 259050f864f5417fd047d16a793933e34941f1b4 (diff) | |
parent | 50d6966c503c7fdc7121eb1756b27c66b12fe0bb (diff) | |
download | mariadb-git-e71aca8200558d590f8b1b8dbafa9693fcf5078b.tar.gz |
Merge 10.9 into 10.10
Diffstat (limited to 'mysql-test/suite')
20 files changed, 511 insertions, 72 deletions
diff --git a/mysql-test/suite/compat/oracle/r/sp-row.result b/mysql-test/suite/compat/oracle/r/sp-row.result index 7fd986a71c8..c978d4be983 100644 --- a/mysql-test/suite/compat/oracle/r/sp-row.result +++ b/mysql-test/suite/compat/oracle/r/sp-row.result @@ -24,7 +24,7 @@ RETURN a; END; $$ SELECT f1(ROW(10,20)); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(ROW(10,20))` DROP FUNCTION f1; # # ROW as an SP parameter @@ -261,7 +261,7 @@ SELECT f1(a); END; $$ CALL p1(); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `a` DROP PROCEDURE p1; DROP FUNCTION f1; CREATE FUNCTION f1(a INT) RETURN INT @@ -278,7 +278,7 @@ SELECT f1(a); END; $$ CALL p1(); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `a` DROP PROCEDURE p1; DROP FUNCTION f1; # @@ -332,7 +332,7 @@ RETURN rec; END; $$ SELECT f1(10); -ERROR 21000: Operand should contain 1 column(s) +ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f1(10)` DROP FUNCTION f1; # # Using the entire ROW in SELECT..CREATE diff --git a/mysql-test/suite/compat/oracle/t/sp-row.test b/mysql-test/suite/compat/oracle/t/sp-row.test index ebd0a2a2137..c7658c76838 100644 --- a/mysql-test/suite/compat/oracle/t/sp-row.test +++ b/mysql-test/suite/compat/oracle/t/sp-row.test @@ -35,7 +35,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(ROW(10,20)); DROP FUNCTION f1; @@ -334,7 +334,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1(); DROP PROCEDURE p1; DROP FUNCTION f1; @@ -355,7 +355,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CALL p1(); DROP PROCEDURE p1; DROP FUNCTION f1; @@ -427,7 +427,7 @@ BEGIN END; $$ DELIMITER ;$$ ---error ER_OPERAND_COLUMNS +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT f1(10); DROP FUNCTION f1; diff --git a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result index 5ae577a6323..b40c57c5d90 100644 --- a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result +++ b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result @@ -14,7 +14,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -32,7 +32,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -50,7 +50,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -68,7 +68,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -86,7 +86,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -104,7 +104,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -122,7 +122,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -140,7 +140,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -158,7 +158,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -176,7 +176,7 @@ connection node_1_u; begin; update user set j = j + 1 WHERE id > 0; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; insert into user_session(id,fk1,fk2) values (2, 2, 2); connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -202,7 +202,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -220,7 +220,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -238,7 +238,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -256,7 +256,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -274,7 +274,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -292,7 +292,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -310,7 +310,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -328,7 +328,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -346,7 +346,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; @@ -364,7 +364,7 @@ connection node_1_u; begin; execute upd; connection node_1_i; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; +set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; execute ins1; connection node_1; set debug_sync='now WAIT_FOR ins_waiting'; diff --git a/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test index 02322fc02ec..6dd1fee1d4e 100644 --- a/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test +++ b/mysql-test/suite/galera/t/galera_FK_duplicate_client_insert.test @@ -72,7 +72,7 @@ while($counter > 0) update user set j = j + 1 WHERE id > 0; --connection node_1_i - set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; + set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; send insert into user_session(id,fk1,fk2) values (2, 2, 2); --connection node_1 @@ -126,7 +126,7 @@ while($counter > 0) #update user set j = j + 1 WHERE id > 0; --connection node_1_i - set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; + set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins'; send execute ins1; --connection node_1 diff --git a/mysql-test/suite/innodb/r/cursor-restore-locking.result b/mysql-test/suite/innodb/r/cursor-restore-locking.result index bc1127f57b3..beeb5a87844 100644 --- a/mysql-test/suite/innodb/r/cursor-restore-locking.result +++ b/mysql-test/suite/innodb/r/cursor-restore-locking.result @@ -7,12 +7,12 @@ SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_m DELETE FROM t WHERE b = 20; connect con_ins_1,localhost,root,,; SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished'; -SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL first_ins_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL first_ins_locked'; SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont'; INSERT INTO t VALUES(10, 20); connect con_del_2,localhost,root,,; SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked'; -SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL second_del_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked'; DELETE FROM t WHERE b = 20; connection default; SET DEBUG_SYNC = 'now WAIT_FOR second_del_locked'; diff --git a/mysql-test/suite/innodb/r/deadlock_victim_race.result b/mysql-test/suite/innodb/r/deadlock_victim_race.result new file mode 100644 index 00000000000..9a7ef51ef24 --- /dev/null +++ b/mysql-test/suite/innodb/r/deadlock_victim_race.result @@ -0,0 +1,42 @@ +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB; +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); +BEGIN; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +a b +20 20 +connect con_2,localhost,root,,; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont EXECUTE 2'; +UPDATE t SET b = 100; +connect con_3,localhost,root,,; +BEGIN; +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 30 FOR UPDATE; +a b +30 30 +SET DEBUG_SYNC='now WAIT_FOR upd_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL sel_locked'; +SELECT * FROM t WHERE a = 20 FOR UPDATE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR sel_locked'; +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL upd_cont'; +SET innodb_lock_wait_timeout=1; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +SET DEBUG_SYNC="lock_wait_end SIGNAL upd_cont"; +SELECT * FROM t WHERE a = 10 FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con_3; +a b +20 20 +connection con_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +disconnect con_3; +disconnect con_2; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/foreign_key_not_windows.result b/mysql-test/suite/innodb/r/foreign_key_not_windows.result index 764ba911214..aaff06f8d68 100644 --- a/mysql-test/suite/innodb/r/foreign_key_not_windows.result +++ b/mysql-test/suite/innodb/r/foreign_key_not_windows.result @@ -11,6 +11,21 @@ CREATE TABLE `d255`.`_##################################################` ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023 CREATE TABLE `d255`.`##################################################` (a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; +# +# MDEV-29258 Failing assertion for name length on RENAME TABLE +# +CREATE TABLE `d255`.`d245` (x INT) ENGINE=InnoDB; +DROP TABLE `d255`.`d250`; +RENAME TABLE `d250#`.`d245` TO `d250#`.`d250`; +RENAME TABLE `d255`.`d250` TO a; +DROP TABLE a,t; +# +# MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE +# +CREATE TABLE `d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB; +CREATE TABLE `d255`.u(a INT PRIMARY KEY, +CONSTRAINT `d320` FOREIGN KEY (a) REFERENCES `d255`.t (a)) ENGINE=InnoDB; +RENAME TABLE `d255`.u TO u; +DROP TABLE u; DROP DATABASE `d255`; -DROP TABLE t; # End of 10.3 tests diff --git a/mysql-test/suite/innodb/r/update-cascade.result b/mysql-test/suite/innodb/r/update-cascade.result index a3c8fed931e..21d8f11e1cb 100644 --- a/mysql-test/suite/innodb/r/update-cascade.result +++ b/mysql-test/suite/innodb/r/update-cascade.result @@ -38,7 +38,7 @@ select f1, f2 from t2 for update; f1 f2 1 2 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f1 = 10 where f1 = 2; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; @@ -97,7 +97,7 @@ select f1, f2 from t2 for update; f1 f2 1 91 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f2 = 28 where f2 = 91; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; @@ -164,7 +164,7 @@ select f1 from t3 for update; f1 2 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f1 = 10 where f1 = 2; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; @@ -253,7 +253,7 @@ select f1 from t3 for update; f1 2 connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; update t1 set f2 = 28 where f2 = 91; connection con1; set debug_sync='now WAIT_FOR upd_waiting'; diff --git a/mysql-test/suite/innodb/t/cursor-restore-locking.test b/mysql-test/suite/innodb/t/cursor-restore-locking.test index d032d8a8def..a398768fc66 100644 --- a/mysql-test/suite/innodb/t/cursor-restore-locking.test +++ b/mysql-test/suite/innodb/t/cursor-restore-locking.test @@ -16,19 +16,19 @@ SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_m --connect(con_ins_1,localhost,root,,) SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished'; # It's supposed the following INSERT will be suspended just after -# lock_wait_suspend_thread_enter syncpoint, and will be awaken +# lock_wait_start syncpoint, and will be awaken # after the previous DELETE commits. ib_after_row_insert will be executed # after the INSERT is woken up. The previous DELETE will wait for # first_del_cont signal before commit, and this signal will be sent later. # So it's safe to use two signals in a row here, it's guaranted the first # signal will be received before the second signal is sent. -SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL first_ins_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL first_ins_locked'; SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont'; --send INSERT INTO t VALUES(10, 20) --connect(con_del_2,localhost,root,,) SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked'; -SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL second_del_locked'; +SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked'; ############################################################################### # This DELETE is locked by the previous DELETE, after that DELETE is # committed, it will still be locked by the next INSERT on delete-marked diff --git a/mysql-test/suite/innodb/t/deadlock_victim_race.test b/mysql-test/suite/innodb/t/deadlock_victim_race.test new file mode 100644 index 00000000000..3c9dd15fb4d --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_victim_race.test @@ -0,0 +1,102 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc + +CREATE TABLE t (a int PRIMARY KEY, b int) engine = InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) engine = InnoDB; + +INSERT INTO t VALUES (10, 10), (20, 20), (30, 30); +INSERT INTO t2 VALUES (10), (20), (30); + +BEGIN; # trx 1 +SELECT * FROM t WHERE a = 20 FOR UPDATE; +# Locking order: +# (10,10) (20,20) (30,30) +# ^ +# trx 1 + +--connect(con_2,localhost,root,,) +# RC is neccessary to do semi-consistent read +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +BEGIN; # trx 2 +# The first time it will be hit on trying to lock (20,20), the second hit +# will be on (30,30). +SET DEBUG_SYNC = 'lock_trx_handle_wait_enter SIGNAL upd_locked WAIT_FOR upd_cont EXECUTE 2'; +# We must not modify primary key fields to cause rr_sequential() read record +# function choosing in mysql_update(), i.e. both query_plan.using_filesort and +# query_plan.using_io_buffer must be false during init_read_record() call. +--send UPDATE t SET b = 100 + +--connect(con_3,localhost,root,,) +BEGIN; # trx 3 +# The following update is necessary to increase the transaction weight, which is +# calculated as the number of locks + the number of undo records during deadlock +# report. Victim's transaction should have minimum weight. We need trx 2 to be +# choosen as victim, that's why we need to increase the current transaction +# weight. +UPDATE t2 SET a = a + 100; +SELECT * FROM t WHERE a = 30 FOR UPDATE; +SET DEBUG_SYNC='now WAIT_FOR upd_locked'; +# Locking queue: +# (10,10) (20,20) (30,30) +# ^ ^ ^ +# trx 2 trx 1 trx 3 +# trx 2 (waiting for 1) + +SET DEBUG_SYNC = 'lock_wait_start SIGNAL sel_locked'; +--send SELECT * FROM t WHERE a = 20 FOR UPDATE +--connection default +SET DEBUG_SYNC='now WAIT_FOR sel_locked'; +# Locking queue: +# (10,10) (20,20) (30,30) +# ^ ^ ^ +# trx 2 trx 1 trx 3 +# trx 2 (waiting for 1) +# trx 3 (waiting for 1) +# +# Note trx 1 must grant lock to trx2 before trx 2 checks the lock state in +# lock_trx_handle_wait(), i.e. the function must return DB_SUCCESS, that's why +# the following ROLLBACK must be executed before sending upd_cont signal. +ROLLBACK; +SET DEBUG_SYNC='now SIGNAL upd_cont'; + +SET innodb_lock_wait_timeout=1; +SET DEBUG_SYNC="now WAIT_FOR upd_locked"; +# Locking queue: +# (10,10) (20,20) (30,30) +# ^ ^ ^ +# trx 2 trx 2 trx 3 +# trx 3 (waiting for 2) trx 2 (waiting for 3) +# +# Deadlock happened after trx 1 granted lock to trx 2, and trx2 continued +# sequential read (with rr_sequential() read record function), and requested +# lock on (30,30). But the deadlock has not been determined yet. + +SET DEBUG_SYNC="lock_wait_end SIGNAL upd_cont"; +--error ER_LOCK_WAIT_TIMEOUT +# The deadlock will be determined in lock_wait() after lock wait timeout +# expired. +SELECT * FROM t WHERE a = 10 FOR UPDATE; + +--connection con_3 +--reap + +--connection con_2 +# As lock_trx_handle_wait() wrongly returned DB_SUCCESS instead of +# DB_DEADLOCK, row_search_mvcc() of trx 2 behaves so as if (30,30) was locked. +# But the waiting(for trx 3) lock was cancelled by deadlock checker after +# trx 2 was choosen as a victim (see lock_cancel_waiting_and_release() call +# from Deadlock::report() for details). The try to update non-locked record +# will cause assertion if the bug is not fixed. +--error ER_LOCK_DEADLOCK +--reap + +--disconnect con_3 +--disconnect con_2 + +--connection default +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t; +DROP TABLE t2; + +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/foreign_key_not_windows.test b/mysql-test/suite/innodb/t/foreign_key_not_windows.test index 7ad3723d5de..e5f42a0ddab 100644 --- a/mysql-test/suite/innodb/t/foreign_key_not_windows.test +++ b/mysql-test/suite/innodb/t/foreign_key_not_windows.test @@ -38,8 +38,40 @@ eval CREATE TABLE `$d255`.`_$d250` --replace_result $d255 d255 eval CREATE TABLE `$d255`.`$d250` (a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB; + +--echo # +--echo # MDEV-29258 Failing assertion for name length on RENAME TABLE +--echo # + +let $d245=-------------------------------------------------; +--replace_result $d245 d245 $d255 d255 +eval CREATE TABLE `$d255`.`$d245` (x INT) ENGINE=InnoDB; +--replace_result $d250 d250 $d255 d255 +eval DROP TABLE `$d255`.`$d250`; + +--replace_result $d245 d245 $d250 d250 d255 d255 +eval RENAME TABLE `$d255`.`$d245` TO `$d255`.`$d250`; +--replace_result $d250 d250 $d255 d255 +eval RENAME TABLE `$d255`.`$d250` TO a; +--replace_result $d255 d255 +DROP TABLE a,t; + +--echo # +--echo # MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE +--echo # + +let $d225=#############################################; +let $d320=################################################################; + +--replace_result $d255 d255 +eval CREATE TABLE `$d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB; +--replace_result $d255 d255 $d320 d320 +eval CREATE TABLE `$d255`.u(a INT PRIMARY KEY, +CONSTRAINT `$d320` FOREIGN KEY (a) REFERENCES `$d255`.t (a)) ENGINE=InnoDB; +--replace_result $d255 d255 +eval RENAME TABLE `$d255`.u TO u; +DROP TABLE u; --replace_result $d255 d255 eval DROP DATABASE `$d255`; -DROP TABLE t; --echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb/t/update-cascade.test b/mysql-test/suite/innodb/t/update-cascade.test index de8294703b4..69e81ac4a2f 100644 --- a/mysql-test/suite/innodb/t/update-cascade.test +++ b/mysql-test/suite/innodb/t/update-cascade.test @@ -28,7 +28,7 @@ start transaction; select f1, f2 from t2 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f1 = 10 where f1 = 2; connection con1; @@ -72,7 +72,7 @@ start transaction; select f1, f2 from t2 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f2 = 28 where f2 = 91; connection con1; @@ -120,7 +120,7 @@ start transaction; select f1 from t3 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f1 = 10 where f1 = 2; connection con1; @@ -183,7 +183,7 @@ start transaction; select f1 from t3 for update; connection default; -set debug_sync='lock_wait_suspend_thread_enter SIGNAL upd_waiting WAIT_FOR go_upd'; +set debug_sync='lock_wait_start SIGNAL upd_waiting WAIT_FOR go_upd'; send update t1 set f2 = 28 where f2 = 91; connection con1; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result index 60be41d5839..b9b2350c00b 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result @@ -1,4 +1,5 @@ INSTALL PLUGIN simple_parser SONAME 'mypluglib'; +FLUSH TABLES; # Test Part 1: Grammar Test CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, @@ -31,7 +32,7 @@ INSERT INTO articles (title, body) VALUES ('1001 MySQL Tricks','How to use full-text search engine'), ('Go MySQL Tricks','How to use full text search engine'); SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('mysql'); +MATCH(title, body) AGAINST('mysql') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... @@ -68,7 +69,7 @@ INSERT INTO articles (title, body) VALUES ('Go MySQL Tricks','How to use full text search engine'); ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('mysql'); +MATCH(title, body) AGAINST('mysql') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... @@ -88,21 +89,23 @@ MATCH(title, body) AGAINST('full text'); id title body 5 Go MySQL Tricks How to use full text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); +MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION) +ORDER BY id; id title body -4 1001 MySQL Tricks How to use full-text search engine -5 Go MySQL Tricks How to use full text search engine -2 How To Use MySQL Well After you went through a ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... 3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); +MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION) +ORDER BY id; id title body -5 Go MySQL Tricks How to use full text search engine -4 1001 MySQL Tricks How to use full-text search engine -2 How To Use MySQL Well After you went through a ... 1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... 3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine SELECT * FROM articles WHERE MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); id title body @@ -138,27 +141,27 @@ INSERT INTO articles (title, body) VALUES ('Go MariaDB Tricks','How to use full text search engine'); # restart SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('MySQL'); +MATCH(title, body) AGAINST('MySQL') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... 3 Optimizing MySQL In this tutorial we will show ... 4 1001 MySQL Tricks How to use full-text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('tutorial'); +MATCH(title, body) AGAINST('tutorial') ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 3 Optimizing MySQL In this tutorial we will show ... SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('Tricks'); +MATCH(title, body) AGAINST('Tricks') ORDER BY id; id title body 4 1001 MySQL Tricks How to use full-text search engine 5 Go MariaDB Tricks How to use full text search engine SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('full text search'); +MATCH(title, body) AGAINST('full text search') ORDER BY id; id title body -5 Go MariaDB Tricks How to use full text search engine 4 1001 MySQL Tricks How to use full-text search engine +5 Go MariaDB Tricks How to use full text search engine SELECT COUNT(*) FROM articles; COUNT(*) 5 @@ -186,7 +189,8 @@ UNINSTALL PLUGIN simple_parser; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown SELECT * FROM articles WHERE -MATCH(title, body) AGAINST('mysql'); +MATCH(title, body) AGAINST('mysql') +ORDER BY id; id title body 1 MySQL Tutorial DBMS stands for MySQL DataBase ... 2 How To Use MySQL Well After you went through a ... diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test index aa52ef5051a..6a7ad8c7d82 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test @@ -6,6 +6,9 @@ # Install fts parser plugin INSTALL PLUGIN simple_parser SONAME 'mypluglib'; +# Flush the table mysql.plugin in case the server shutdown would time out. +FLUSH TABLES; + -- echo # Test Part 1: Grammar Test # Create a myisam table and alter it to innodb table CREATE TABLE articles ( @@ -52,7 +55,7 @@ INSERT INTO articles (title, body) VALUES # Simple term search SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('mysql'); + MATCH(title, body) AGAINST('mysql') ORDER BY id; # Test stopword and word len less than fts_min_token_size SELECT * FROM articles WHERE @@ -90,7 +93,7 @@ ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; # Simple term search SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('mysql'); + MATCH(title, body) AGAINST('mysql') ORDER BY id; # Test stopword and word len less than fts_min_token_size SELECT * FROM articles WHERE @@ -105,10 +108,12 @@ SELECT * FROM articles WHERE # Test query expansion SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION); + MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION) + ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION); + MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION) + ORDER BY id; # No result here, we get '"mysql' 'database"' by simple parser SELECT * FROM articles WHERE @@ -152,13 +157,13 @@ INSERT INTO articles (title, body) VALUES --source include/restart_mysqld.inc SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('MySQL'); + MATCH(title, body) AGAINST('MySQL') ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('tutorial'); + MATCH(title, body) AGAINST('tutorial') ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('Tricks'); + MATCH(title, body) AGAINST('Tricks') ORDER BY id; SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('full text search'); + MATCH(title, body) AGAINST('full text search') ORDER BY id; SELECT COUNT(*) FROM articles; INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234'); @@ -195,7 +200,8 @@ UNINSTALL PLUGIN simple_parser; # Simple term search SELECT * FROM articles WHERE - MATCH(title, body) AGAINST('mysql'); + MATCH(title, body) AGAINST('mysql') + ORDER BY id; # Test stopword and word len less than fts_min_token_size SELECT * FROM articles WHERE diff --git a/mysql-test/suite/mariabackup/backup_grants.result b/mysql-test/suite/mariabackup/backup_grants.result index ed793e7ff1a..56899f8d9c0 100644 --- a/mysql-test/suite/mariabackup/backup_grants.result +++ b/mysql-test/suite/mariabackup/backup_grants.result @@ -3,4 +3,12 @@ FOUND 1 /missing required privilege RELOAD/ in backup.log FOUND 1 /missing required privilege PROCESS/ in backup.log FOUND 1 /GRANT USAGE ON/ in backup.log GRANT RELOAD, PROCESS on *.* to backup@localhost; +NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log +GRANT REPLICA MONITOR ON *.* TO backup@localhost; +REVOKE REPLICA MONITOR ON *.* FROM backup@localhost; +GRANT CONNECTION ADMIN ON *.* TO backup@localhost; +FOUND 1 /missing required privilege REPLICATION SLAVE ADMIN/ in backup.log +NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log +GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost; +GRANT REPLICA MONITOR ON *.* TO backup@localhost; DROP USER backup@localhost; diff --git a/mysql-test/suite/mariabackup/backup_grants.test b/mysql-test/suite/mariabackup/backup_grants.test index eadeedd9b5f..894ae73aeb9 100644 --- a/mysql-test/suite/mariabackup/backup_grants.test +++ b/mysql-test/suite/mariabackup/backup_grants.test @@ -25,7 +25,62 @@ GRANT RELOAD, PROCESS on *.* to backup@localhost; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir; --enable_result_log +rmdir $targetdir; -DROP USER backup@localhost; -# Cleanup +# MDEV-23607 Warning: missing required privilege REPLICATION CLIENT +# --slave-info and galera info require REPLICA MONITOR +--disable_result_log +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +--enable_result_log +rmdir $targetdir; + +--let SEARCH_PATTERN= missing required privilege REPLICA MONITOR +--source include/search_pattern_in_file.inc + +GRANT REPLICA MONITOR ON *.* TO backup@localhost; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; +REVOKE REPLICA MONITOR ON *.* FROM backup@localhost; + +# TODO need a query that would delay a BACKUP STAGE START/ BACKUP STAGE BLOCK_COMMIT longer than the kill-long-queries-timeout +#--send SELECT SLEEP(9) kill_me +## kill-long-query-type=(not empty) requires CONNECTION ADMIN +#--disable_result_log +#error 1; +#--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=all --kill-long-queries-timeout=4 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +#--reap +#--enable_result_log +#rmdir $targetdir; +# +#--let SEARCH_PATTERN= missing required privilege CONNECTION ADMIN +#--source include/search_pattern_in_file.inc + +GRANT CONNECTION ADMIN ON *.* TO backup@localhost; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=all --kill-long-queries-timeout=1 --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; + +# --safe-slave-backup requires REPLICATION SLAVE ADMIN, and REPLICA MONITOR +--disable_result_log +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --safe-slave-backup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +--enable_result_log rmdir $targetdir; + +--let SEARCH_PATTERN= missing required privilege REPLICATION SLAVE ADMIN +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= missing required privilege REPLICA MONITOR +--source include/search_pattern_in_file.inc + +GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost; +GRANT REPLICA MONITOR ON *.* TO backup@localhost; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --safe-slave-backup --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; + +DROP USER backup@localhost; diff --git a/mysql-test/suite/period/r/alter.result b/mysql-test/suite/period/r/alter.result index 7b9d1fea861..8aa94cee59e 100644 --- a/mysql-test/suite/period/r/alter.result +++ b/mysql-test/suite/period/r/alter.result @@ -191,6 +191,20 @@ ERROR 23000: Duplicate entry '1-2020-03-01-2020-03-02' for key 'PRIMARY' alter table t1 add system versioning; drop table t1; # +# MDEV-18873 Server crashes in Compare_identifiers::operator or in +# my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name +# +alter table t add period if not exists for `` (s,e); +ERROR 42000: Incorrect column name '' +create table t(s DATE, e DATE); +alter table t add period if not exists for `` (s,e); +ERROR 42000: Incorrect column name '' +alter table t add period if not exists for ` ` (s,e); +ERROR 42000: Incorrect column name ' ' +create table t2 (period for `` (s,e)) select * from t; +ERROR 42000: Incorrect column name '' +drop table t; +# # MDEV-21941 RENAME doesn't work for system time or period fields # create or replace table t1 ( diff --git a/mysql-test/suite/period/t/alter.test b/mysql-test/suite/period/t/alter.test index 68d9adf476a..fab933eca87 100644 --- a/mysql-test/suite/period/t/alter.test +++ b/mysql-test/suite/period/t/alter.test @@ -153,6 +153,29 @@ alter table t1 add system versioning; drop table t1; --echo # +--echo # MDEV-18873 Server crashes in Compare_identifiers::operator or in +--echo # my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name +--echo # + +# When there is no table defined. +--error ER_WRONG_COLUMN_NAME +alter table t add period if not exists for `` (s,e); + +# When there is an actual table. +create table t(s DATE, e DATE); +--error ER_WRONG_COLUMN_NAME +alter table t add period if not exists for `` (s,e); + +# When the last character is space +--error ER_WRONG_COLUMN_NAME +alter table t add period if not exists for ` ` (s,e); + +# Create table with an empty period name +--error ER_WRONG_COLUMN_NAME +create table t2 (period for `` (s,e)) select * from t; +drop table t; + +--echo # --echo # MDEV-21941 RENAME doesn't work for system time or period fields --echo # create or replace table t1 ( diff --git a/mysql-test/suite/rpl/r/rpl_filter_set_var_missing_data.result b/mysql-test/suite/rpl/r/rpl_filter_set_var_missing_data.result new file mode 100644 index 00000000000..e232edae1ed --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_filter_set_var_missing_data.result @@ -0,0 +1,55 @@ +include/master-slave.inc +[connection master] +# +# Set replica to ignore system mysql tables +connection slave; +include/stop_slave.inc +SET @@GLOBAL.replicate_wild_ignore_table="mysql.%"; +include/start_slave.inc +# +# Execute grant-based commands on primary which modify mysql system +# tables +connection master; +CREATE ROLE journalist; +CREATE USER testuser@localhost IDENTIFIED by ''; +GRANT journalist to testuser@localhost; +# +# Execute SET commands which use the previous user/role data +SET DEFAULT ROLE journalist for testuser@localhost; +SET PASSWORD for testuser@localhost= PASSWORD('123'); +include/save_master_gtid.inc +# +# Verify primary's grant tables have the correct user/role data +select count(*)=1 from mysql.user where User='testuser'; +count(*)=1 +1 +select count(*)=1 from mysql.roles_mapping where User='testuser'; +count(*)=1 +1 +# +# Ensure that the replica receives all of the primary's events without +# error +connection slave; +include/sync_with_master_gtid.inc +Last_SQL_Error = +Last_SQL_Errno = 0 +# +# Verify that the replica did not execute the master's commands +select count(*)=0 from mysql.user where User='testuser'; +count(*)=0 +1 +select count(*)=0 from mysql.roles_mapping where User='testuser'; +count(*)=0 +1 +# +# Clean up +connection master; +DROP ROLE journalist; +DROP USER testuser@localhost; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @@GLOBAL.replicate_wild_ignore_table=""; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_filter_set_var_missing_data.test b/mysql-test/suite/rpl/t/rpl_filter_set_var_missing_data.test new file mode 100644 index 00000000000..25efb6ed662 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_filter_set_var_missing_data.test @@ -0,0 +1,83 @@ +# +# Purpose: +# This test ensures that the SET DEFAULT ROLE and SET PASSWORD commands can +# be ignored by replica filter rules. MDEV-28294 exposed a bug in which +# SET DEFAULT ROLE would check for the existence of the given roles/user even +# when the targeted tables are ignored, resulting in errors if the targeted +# data does not exist. More specifically, when previously issued +# CREATE USER/ROLE commands are ignored by the replica because of the +# replication filtering rules, SET DEFAULT ROLE would result in an error +# because the targeted data does not exist. +# +# Methodology: +# Using a replica configured with replicate_wild_ignore_table="mysql.%", +# execute SET DEFAULT ROLE and SET PASSWORD on the primary and ensure that the +# replica neither errors nor executes the commands which the primary sends. +# +# References: +# MDEV-28294: set default role bypasses Replicate_Wild_Ignore_Table: mysql.% +# + +source include/master-slave.inc; +source include/have_binlog_format_mixed.inc; + +--echo # +--echo # Set replica to ignore system mysql tables +connection slave; +let $old_filter= query_get_value(SHOW SLAVE STATUS, Replicate_Wild_Ignore_Table, 1); +source include/stop_slave.inc; +SET @@GLOBAL.replicate_wild_ignore_table="mysql.%"; +source include/start_slave.inc; + +--echo # +--echo # Execute grant-based commands on primary which modify mysql system +--echo # tables +connection master; +CREATE ROLE journalist; +CREATE USER testuser@localhost IDENTIFIED by ''; +GRANT journalist to testuser@localhost; + +--echo # +--echo # Execute SET commands which use the previous user/role data +SET DEFAULT ROLE journalist for testuser@localhost; +SET PASSWORD for testuser@localhost= PASSWORD('123'); +--source include/save_master_gtid.inc + +--echo # +--echo # Verify primary's grant tables have the correct user/role data +select count(*)=1 from mysql.user where User='testuser'; +select count(*)=1 from mysql.roles_mapping where User='testuser'; + +--echo # +--echo # Ensure that the replica receives all of the primary's events without +--echo # error +connection slave; +--source include/sync_with_master_gtid.inc +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Last_SQL_Errno = $errno + +--echo # +--echo # Verify that the replica did not execute the master's commands +select count(*)=0 from mysql.user where User='testuser'; +select count(*)=0 from mysql.roles_mapping where User='testuser'; + +--echo # +--echo # Clean up + +# The master has to drop the role/user combination while the slave still has +# its filters active; otherwise, the slave would try to drop users/roles that +# were never replicated. +--connection master +DROP ROLE journalist; +DROP USER testuser@localhost; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +source include/stop_slave.inc; +--eval SET @@GLOBAL.replicate_wild_ignore_table="$old_filter" +source include/start_slave.inc; + +--source include/rpl_end.inc |