Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
722 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| connect con1,localhost,root,,; | ||
| SET DEBUG_DBUG='+d,mark_busy_mdev_22370'; | ||
| FLUSH TABLES WITH READ LOCK; | ||
| connection default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # | ||
| # MDEV-22370 safe_mutex: Trying to lock uninitialized mutex at | ||
| # /data/src/10.4-bug/sql/rpl_parallel.cc, line 470 upon shutdown during FTWRL | ||
| # | ||
| # Purpose of this test case to test crash while FTWRL and shutdown is in race | ||
| # condition | ||
| # Shutdown can execute first and destroy the mutex making mutex_lock in pool_mark_busy | ||
| # to crash | ||
|
|
||
| --source include/have_debug.inc | ||
| --connect (con1,localhost,root,,) | ||
| SET DEBUG_DBUG='+d,mark_busy_mdev_22370'; | ||
| --send | ||
| FLUSH TABLES WITH READ LOCK; | ||
|
|
||
| --connection default | ||
| --source include/restart_mysqld.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # | ||
| # Kill OPTIMIZE command prior to table modification | ||
| # | ||
| RESET MASTER; | ||
| CREATE TABLE t1 (f INT) ENGINE=INNODB; | ||
| CREATE TABLE t2 (f INT) ENGINE=INNODB; | ||
| connect con1,127.0.0.1,root,,test,$MASTER_MYPORT,; | ||
| connection con1; | ||
| SET debug_sync='admin_command_kill_before_modify SIGNAL ready_to_be_killed WAIT_FOR master_cont'; | ||
| OPTIMIZE TABLE t1,t2; | ||
| connection default; | ||
| SET debug_sync='now WAIT_FOR ready_to_be_killed'; | ||
| KILL THD_ID; | ||
| SET debug_sync = 'reset'; | ||
| disconnect con1; | ||
| include/show_binlog_events.inc | ||
| Log_name Pos Event_type Server_id End_log_pos Info | ||
| master-bin.000001 # Gtid # # GTID #-#-# | ||
| master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (f INT) ENGINE=INNODB | ||
| master-bin.000001 # Gtid # # GTID #-#-# | ||
| master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (f INT) ENGINE=INNODB | ||
| DROP TABLE t1,t2; | ||
| FLUSH LOGS; | ||
| # | ||
| # Kill OPTIMIZE command after table modification | ||
| # | ||
| CREATE TABLE t1 (f INT) ENGINE=INNODB; | ||
| CREATE TABLE t2 (f INT) ENGINE=INNODB; | ||
| connect con1,127.0.0.1,root,,test,$MASTER_MYPORT,; | ||
| connection con1; | ||
| SET debug_sync='admin_command_kill_after_modify SIGNAL ready_to_be_killed WAIT_FOR master_cont'; | ||
| OPTIMIZE TABLE t1,t2; | ||
| connection default; | ||
| SET debug_sync='now WAIT_FOR ready_to_be_killed'; | ||
| KILL THD_ID; | ||
| SET debug_sync = 'reset'; | ||
| disconnect con1; | ||
| DROP TABLE t1,t2; | ||
| FLUSH LOGS; | ||
| FOUND 1 /OPTIMIZE TABLE t1,t2/ in mysqlbinlog.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # ==== Purpose ==== | ||
| # | ||
| # Test verifies that when an admin command execution is interrupted by KILL | ||
| # command it should stop its execution. The admin command in binary log should | ||
| # contain only the list of tables which have successfully executed admin | ||
| # command prior to kill. | ||
| # | ||
| # ==== Implementation ==== | ||
| # | ||
| # Steps: | ||
| # 0 - Create two table t1,t2. | ||
| # 1 - Execute OPTIMIZE TABLE t1,t2 command. | ||
| # 2 - Using debug sync mechanism kill OPTIMIZE TABLE command at a stage | ||
| # where it has not optimized any table. | ||
| # 3 - Check that OPTIMIZE TABLE command is not written to binary log. | ||
| # 4 - Using debug sync mechanism hold the execution of OPTIMIZE TABLE after | ||
| # t1 table optimization. Now kill the OPTIMIZE TABLE command. | ||
| # 5 - Observe the binlog output, the OPTIMIZE TABLE command should display `t1,t2`. | ||
| # 6 - Please note that, we binlog the entire query even if at least one | ||
| # table is modified as admin commands are safe to replicate and they will | ||
| # not make the slave to diverge. | ||
| # | ||
| # ==== References ==== | ||
| # | ||
| # MDEV-22530: Aborting OPTIMIZE TABLE still logs in binary log and replicates to the Slave server. | ||
| # | ||
| --source include/have_log_bin.inc | ||
| --source include/have_debug.inc | ||
| --source include/have_debug_sync.inc | ||
| --source include/have_innodb.inc | ||
|
|
||
| --echo # | ||
| --echo # Kill OPTIMIZE command prior to table modification | ||
| --echo # | ||
| RESET MASTER; | ||
|
|
||
| CREATE TABLE t1 (f INT) ENGINE=INNODB; | ||
| CREATE TABLE t2 (f INT) ENGINE=INNODB; | ||
|
|
||
| --connect(con1,127.0.0.1,root,,test,$MASTER_MYPORT,) | ||
| --connection con1 | ||
| SET debug_sync='admin_command_kill_before_modify SIGNAL ready_to_be_killed WAIT_FOR master_cont'; | ||
| --send OPTIMIZE TABLE t1,t2 | ||
|
|
||
| --connection default | ||
| SET debug_sync='now WAIT_FOR ready_to_be_killed'; | ||
| --let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%OPTIMIZE TABLE %'` | ||
|
|
||
| # Now kill. | ||
| --replace_result $thd_id THD_ID | ||
| eval KILL $thd_id; | ||
|
|
||
| SET debug_sync = 'reset'; | ||
| --disconnect con1 | ||
|
|
||
| --source include/show_binlog_events.inc | ||
| DROP TABLE t1,t2; | ||
|
|
||
| FLUSH LOGS; | ||
|
|
||
| --echo # | ||
| --echo # Kill OPTIMIZE command after table modification | ||
| --echo # | ||
|
|
||
| CREATE TABLE t1 (f INT) ENGINE=INNODB; | ||
| CREATE TABLE t2 (f INT) ENGINE=INNODB; | ||
|
|
||
| --connect(con1,127.0.0.1,root,,test,$MASTER_MYPORT,) | ||
| --connection con1 | ||
| SET debug_sync='admin_command_kill_after_modify SIGNAL ready_to_be_killed WAIT_FOR master_cont'; | ||
| --send OPTIMIZE TABLE t1,t2 | ||
|
|
||
| --connection default | ||
| SET debug_sync='now WAIT_FOR ready_to_be_killed'; | ||
| --let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%OPTIMIZE TABLE %'` | ||
|
|
||
| # Now kill. | ||
| --replace_result $thd_id THD_ID | ||
| eval KILL $thd_id; | ||
|
|
||
| SET debug_sync = 'reset'; | ||
| --disconnect con1 | ||
|
|
||
| DROP TABLE t1,t2; | ||
| let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); | ||
| FLUSH LOGS; | ||
|
|
||
| --let $MYSQLD_DATADIR= `select @@datadir` | ||
| --exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.out | ||
|
|
||
| --let SEARCH_PATTERN= OPTIMIZE TABLE t1,t2 | ||
| --let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.out | ||
| --source include/search_pattern_in_file.inc | ||
|
|
||
| --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| include/rpl_init.inc [topology=1->2] | ||
| connection server_1; | ||
| FLUSH TABLES; | ||
| ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; | ||
| connection server_2; | ||
| SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads; | ||
| SET @save_slave_parallel_mode= @@GLOBAL.slave_parallel_mode; | ||
| include/stop_slave.inc | ||
| SET GLOBAL slave_parallel_threads=2; | ||
| SET GLOBAL slave_parallel_mode=optimistic; | ||
| include/start_slave.inc | ||
| connection server_1; | ||
| CREATE TABLE t1(a INT) ENGINE=INNODB; | ||
| OPTIMIZE TABLE t1; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 optimize note Table does not support optimize, doing recreate + analyze instead | ||
| test.t1 optimize status OK | ||
| INSERT INTO t1 VALUES(1); | ||
| INSERT INTO t1 SELECT 1+a FROM t1; | ||
| INSERT INTO t1 SELECT 2+a FROM t1; | ||
| connection server_2; | ||
| # | ||
| # Verify that following admin commands are marked as ddl | ||
| # 'OPTIMIZE TABLE', 'REPAIR TABLE' and 'ANALYZE TABLE' | ||
| # | ||
| connection server_1; | ||
| OPTIMIZE TABLE t1; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 optimize note Table does not support optimize, doing recreate + analyze instead | ||
| test.t1 optimize status OK | ||
| REPAIR TABLE t1; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 repair note The storage engine for the table doesn't support repair | ||
| ANALYZE TABLE t1; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 analyze status OK | ||
| FLUSH LOGS; | ||
| FOUND 1 /GTID 0-1-8 ddl/ in mysqlbinlog.out | ||
| FOUND 1 /GTID 0-1-9 ddl/ in mysqlbinlog.out | ||
| FOUND 1 /GTID 0-1-10 ddl/ in mysqlbinlog.out | ||
| # | ||
| # Clean up | ||
| # | ||
| DROP TABLE t1; | ||
| connection server_2; | ||
| FLUSH LOGS; | ||
| # | ||
| # Check that ALTER TABLE commands with ANALYZE, OPTIMIZE and REPAIR on | ||
| # partitions will be marked as DDL in binary log. | ||
| # | ||
| connection server_1; | ||
| CREATE TABLE t1(id INT) PARTITION BY RANGE (id) (PARTITION p0 VALUES LESS THAN (100), | ||
| PARTITION pmax VALUES LESS THAN (MAXVALUE)); | ||
| INSERT INTO t1 VALUES (1), (10), (100), (1000); | ||
| ALTER TABLE t1 ANALYZE PARTITION p0; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 analyze status OK | ||
| ALTER TABLE t1 OPTIMIZE PARTITION p0; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 optimize status OK | ||
| ALTER TABLE t1 REPAIR PARTITION p0; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 repair status OK | ||
| FLUSH LOGS; | ||
| FOUND 1 /GTID 0-1-14 ddl/ in mysqlbinlog.out | ||
| FOUND 1 /GTID 0-1-15 ddl/ in mysqlbinlog.out | ||
| FOUND 1 /GTID 0-1-16 ddl/ in mysqlbinlog.out | ||
| # | ||
| # Clean up | ||
| # | ||
| DROP TABLE t1; | ||
| connection server_2; | ||
| include/stop_slave.inc | ||
| SET GLOBAL slave_parallel_threads= @save_slave_parallel_threads; | ||
| SET GLOBAL slave_parallel_mode= @save_slave_parallel_mode; | ||
| include/start_slave.inc | ||
| include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| include/rpl_init.inc [topology=1->3] | ||
| connection server_3; | ||
| set default_master_connection = ''; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| set default_master_connection = 'm2'; | ||
| change master to master_host='127.0.0.1', master_port=SERVER_MYPORT_2, master_user='root', master_use_gtid=slave_pos; | ||
| include/start_slave.inc | ||
| select @@global.slave_parallel_workers as two; | ||
| two | ||
| 2 | ||
| connection server_3; | ||
| SHUTDOWN; | ||
| connection server_3; | ||
| connection server_3; | ||
| connection server_1; | ||
| create table t1 (i int primary key) engine=Innodb; | ||
| connection server_2; | ||
| create table t2 (i int primary key) engine=Innodb; | ||
| connection server_3; | ||
| set default_master_connection = ''; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| set default_master_connection = 'm2'; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| connection server_2; | ||
| insert into t2 values (1); | ||
| connection server_3; | ||
| connection server_1; | ||
| insert into t1 values (1); | ||
| connection server_3; | ||
| connection server_3; | ||
| SHUTDOWN; | ||
| connection server_3; | ||
| connection server_3; | ||
| connection server_3; | ||
| set default_master_connection = ''; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| set default_master_connection = 'm2'; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| connect conn_block_server3, 127.0.0.1, root,, test, $SERVER_MYPORT_3,; | ||
| begin; | ||
| insert into t1 values (2); | ||
| insert into t2 values (2); | ||
| connection server_1; | ||
| insert into t1 values (2); | ||
| connection server_2; | ||
| insert into t2 values (2); | ||
| connection server_3; | ||
| SHUTDOWN; | ||
| connection server_3; | ||
| connection server_3; | ||
| connection server_3; | ||
| set default_master_connection = ''; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| set default_master_connection = 'm2'; | ||
| include/start_slave.inc | ||
| Warnings: | ||
| Note 1254 Slave is already running | ||
| connection server_1; | ||
| drop table t1; | ||
| connection server_2; | ||
| drop table t2; | ||
| connection server_3; | ||
| set default_master_connection = 'm2'; | ||
| include/stop_slave.inc | ||
| RESET SLAVE ALL; | ||
| set default_master_connection = ''; | ||
| include/rpl_end.inc |
Oops, something went wrong.