mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge from 5.5 main
This commit is contained in:
@ -85,4 +85,5 @@ INSERT INTO t1 VALUES (1),(1);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
# End of 4.1 tests
|
||||
|
@ -35,10 +35,23 @@ connection master1;
|
||||
send CALL test.p1();
|
||||
|
||||
connection master;
|
||||
# To make sure tha the call on master1 arrived at the get_lock
|
||||
sleep 1;
|
||||
# Make sure that the call on master1 arrived at the get_lock.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = 'User lock' and
|
||||
info = 'SELECT get_lock("test", 100)';
|
||||
--source include/wait_condition.inc
|
||||
CALL test.p2();
|
||||
SELECT release_lock("test");
|
||||
|
||||
connection master1;
|
||||
# Reap CALL test.p1() to ensure that it has fully completed
|
||||
# before doing any selects on test.t1.
|
||||
--reap
|
||||
# Release lock acquired by it.
|
||||
SELECT release_lock("test");
|
||||
|
||||
connection master;
|
||||
SELECT * FROM test.t1;
|
||||
#show binlog events;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
@ -51,6 +64,7 @@ DROP TABLE IF EXISTS test.t1;
|
||||
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
CALL test.p2();
|
||||
CALL test.p1();
|
||||
SELECT release_lock("test");
|
||||
SELECT * FROM test.t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
@ -122,4 +122,60 @@ drop table t1i, t2m;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#56096 STOP SLAVE hangs if executed in parallel with user sleep
|
||||
--echo #
|
||||
|
||||
--connection master
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT );
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--connection slave1
|
||||
--echo # Slave1: lock table for synchronization
|
||||
LOCK TABLES t1 WRITE;
|
||||
|
||||
--connection master
|
||||
--echo # Master: insert into the table
|
||||
INSERT INTO t1 SELECT SLEEP(4);
|
||||
|
||||
--connection slave
|
||||
--echo # Slave: wait for the insert
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE STATE = "Waiting for table metadata lock"
|
||||
AND INFO = "INSERT INTO t1 SELECT SLEEP(4)";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo # Slave: send slave stop
|
||||
--send STOP SLAVE
|
||||
|
||||
--connection slave1
|
||||
--echo # Slave1: wait for stop slave
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE INFO = "STOP SLAVE";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo # Slave1: unlock the table
|
||||
UNLOCK TABLES;
|
||||
|
||||
--connection slave
|
||||
--echo # Slave: wait for the slave to stop
|
||||
--reap
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
|
||||
--echo # Start slave again
|
||||
--source include/start_slave.inc
|
||||
|
||||
--echo # Clean up
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of tests
|
||||
|
61
mysql-test/extra/rpl_tests/rpl_stop_slave.test
Normal file
61
mysql-test/extra/rpl_tests/rpl_stop_slave.test
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# Auxiliary file which is used to test BUG#56118
|
||||
#
|
||||
# Slave should apply all statements in the transaction before stop if any
|
||||
# temporary table is created or dropped.
|
||||
#
|
||||
# USEAGE:
|
||||
# --let $tmp_table_stm= a SQL statement
|
||||
# --source extra/rpl_tests/rpl_stop_slave.test
|
||||
#
|
||||
|
||||
if (`SELECT "$tmp_table_stm" = ''`)
|
||||
{
|
||||
--echo \$tmp_table_stm is NULL
|
||||
--die $tmp_table_stm is NULL
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo [ On Master ]
|
||||
connection master;
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
eval $tmp_table_stm;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TEMPORARY TABLE tt1;
|
||||
COMMIT;
|
||||
|
||||
--echo
|
||||
--echo [ On Slave ]
|
||||
connection slave;
|
||||
|
||||
# To check if slave SQL thread is applying INSERT statement
|
||||
let $show_statement= SHOW PROCESSLIST;
|
||||
let $field= Info;
|
||||
let $condition= LIKE 'INSERT%';
|
||||
source include/wait_show_condition.inc;
|
||||
|
||||
send STOP SLAVE SQL_THREAD;
|
||||
|
||||
--echo
|
||||
--echo [ On Slave1 ]
|
||||
connection slave1;
|
||||
--echo # To resume slave SQL thread
|
||||
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
||||
--echo
|
||||
--echo [ On Slave ]
|
||||
connection slave;
|
||||
reap;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
--echo # Slave should stop after the transaction has committed.
|
||||
--echo # So t1 on master is same to t1 on slave.
|
||||
let diff_table_1=master:test.t1;
|
||||
let diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection slave;
|
||||
START SLAVE SQL_THREAD;
|
||||
source include/wait_for_slave_sql_to_start.inc;
|
Reference in New Issue
Block a user