96 lines
3.4 KiB
Plaintext
96 lines
3.4 KiB
Plaintext
--source include/not_group_replication_plugin.inc
|
|
--source include/have_debug.inc
|
|
--source include/master-slave.inc
|
|
################################################################################
|
|
# Bug#18363515 MULTIPLE THREADED SLAVE MAY BE CRASHED BY STOP SLAVE SQL
|
|
#
|
|
# Worker error will crash MTS if coordinator is waiting for a free worker to
|
|
# dispatch next event. The crash happens because the caller of
|
|
# Mts_submode_logical_clock::get_least_occupied_worker() supposes it always
|
|
# return a valid worker. But that is not true. It may turn NULL when
|
|
# coordinator is aborted at the same time seeing a Worker has failed.
|
|
################################################################################
|
|
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE = InnoDB;
|
|
CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE = InnoDB;
|
|
--source include/sync_slave_sql_with_master.inc
|
|
--source include/stop_slave_sql.inc
|
|
|
|
--source include/rpl_connection_master.inc
|
|
SET @save_debug = @@GLOBAL.debug;
|
|
|
|
# make the following transactions to have a common commit parent
|
|
# so be parallelizable on slave.
|
|
SET GLOBAL debug = "d,set_commit_parent_100";
|
|
|
|
INSERT INTO t2 VALUES(99); # just a warmup load
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES(1);
|
|
INSERT INTO t1 VALUES(2);
|
|
COMMIT;
|
|
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES(3);
|
|
INSERT INTO t1 VALUES(4);
|
|
COMMIT;
|
|
# This one will force coordinator to wait for a free worker.
|
|
INSERT INTO t1 VALUES(5);
|
|
|
|
SET GLOBAL debug = @save_debug;
|
|
--source include/save_master_pos.inc
|
|
|
|
--source include/rpl_connection_slave.inc
|
|
SET @save_slave_parallel_type = @@GLOBAL.slave_parallel_type;
|
|
SET @save_slave_parallel_workers = @@GLOBAL.slave_parallel_workers;
|
|
SET @save_slave_transaction_retries = @@GLOBAL.slave_transaction_retries;
|
|
|
|
SET GLOBAL slave_parallel_type = LOGICAL_CLOCK;
|
|
SET GLOBAL slave_parallel_workers = 2;
|
|
SET GLOBAL slave_transaction_retries = 0;
|
|
|
|
# Inserts an offending row into slave's db. A worker will fail with
|
|
# the duplicate key error when applying master's transaction.
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
CALL mtr.add_suppression("Worker . Failed executing transaction.*");
|
|
CALL mtr.add_suppression(".*coordinator and worker threads are stopped.*");
|
|
|
|
# Block workers and make coordinator to wait for a free worker
|
|
LOCK TABLE t1 WRITE;
|
|
|
|
--let $rpl_connection_name= server_2
|
|
--source include/rpl_connection.inc
|
|
--source include/sync_slave_io.inc
|
|
--source include/start_slave_sql.inc
|
|
|
|
# Wait until coordinator already dispatches events to both workers.
|
|
--let $show_statement= SHOW PROCESSLIST
|
|
--let $field= State
|
|
--let $condition= = 'Waiting for table metadata lock'
|
|
--source include/wait_show_condition.inc
|
|
|
|
# Wait unti coordinator enters the wait status.
|
|
--let $show_statement= SHOW PROCESSLIST
|
|
--let $field= State
|
|
--let $condition= = 'Waiting for slave workers to process their queues'
|
|
--source include/wait_show_condition.inc
|
|
|
|
# Release metadata lock on t1, so workers can go ahead.
|
|
--source include/rpl_connection_slave.inc
|
|
UNLOCK TABLES;
|
|
|
|
# Workers encounter duplicate error and abort coordinator
|
|
--let $slave_sql_errno= convert_error(ER_DUP_ENTRY)
|
|
--source include/wait_for_slave_sql_to_stop.inc
|
|
|
|
SET GLOBAL slave_parallel_workers = @save_slave_parallel_workers;
|
|
SET GLOBAL slave_parallel_type = @save_slave_parallel_type;
|
|
SET GLOBAL slave_transaction_retries = @save_slave_transaction_retries;
|
|
# Remove the duplicate key from slave's db.
|
|
TRUNCATE t1;
|
|
--source include/start_slave_sql.inc
|
|
|
|
--source include/rpl_connection_master.inc
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
--source include/rpl_end.inc
|