summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/rpl')
-rw-r--r--mysql-test/suite/rpl/r/failed_create_view-6409.result15
-rw-r--r--mysql-test/suite/rpl/r/kill_hard-6290.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_debug.result25
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result61
-rw-r--r--mysql-test/suite/rpl/r/rpl_stop_slave.result7
-rw-r--r--mysql-test/suite/rpl/t/failed_create_view-6409.test24
-rw-r--r--mysql-test/suite/rpl/t/kill_hard-6290.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_debug.test52
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test130
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_slave.test27
12 files changed, 356 insertions, 16 deletions
diff --git a/mysql-test/suite/rpl/r/failed_create_view-6409.result b/mysql-test/suite/rpl/r/failed_create_view-6409.result
new file mode 100644
index 00000000000..6b04f2960d1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/failed_create_view-6409.result
@@ -0,0 +1,15 @@
+create table v1 (a int);
+include/master-slave.inc
+[connection master]
+create table t1 (a int);
+create view v1 as select * from t1;
+ERROR 42S01: Table 'v1' already exists
+show tables;
+Tables_in_test
+t1
+v1
+show tables;
+Tables_in_test
+t1
+drop table if exists t1, v1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/kill_hard-6290.result b/mysql-test/suite/rpl/r/kill_hard-6290.result
new file mode 100644
index 00000000000..27b62416368
--- /dev/null
+++ b/mysql-test/suite/rpl/r/kill_hard-6290.result
@@ -0,0 +1,4 @@
+include/master-slave.inc
+[connection master]
+kill user test2@nohost;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result b/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result
new file mode 100644
index 00000000000..b9dec686e4a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result
@@ -0,0 +1,25 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave.inc
+set @restore_slave_net_timeout= @@global.slave_net_timeout;
+set @@global.slave_net_timeout= 10;
+show status like 'Slave_heartbeat_period';;
+Variable_name Slave_heartbeat_period
+Value 60.000
+SET @save_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
+CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error');
+CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
+include/start_slave.inc
+drop table if exists t1;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+drop table t1;
+include/stop_slave.inc
+SET GLOBAL debug_dbug=@save_dbug;
+set @@global.slave_net_timeout= @restore_slave_net_timeout;
+include/start_slave.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index 51859b5b49b..196844255f6 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -386,6 +386,7 @@ Rpl_semi_sync_slave_status ON
include/stop_slave.inc
[ on master ]
set sql_log_bin=0;
+include/stop_dump_threads.inc
UNINSTALL PLUGIN rpl_semi_sync_master;
set sql_log_bin=1;
SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
@@ -439,9 +440,8 @@ Rpl_semi_sync_slave_status OFF
#
# Clean up
#
+include/uninstall_semisync.inc
include/stop_slave.inc
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-UNINSTALL PLUGIN rpl_semi_sync_master;
change master to master_user='root',master_password='';
include/start_slave.inc
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result b/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result
new file mode 100644
index 00000000000..c1d09e04cd0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result
@@ -0,0 +1,61 @@
+include/master-slave.inc
+[connection master]
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
+[connection slave]
+INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave';
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+[connection master]
+UNINSTALL PLUGIN rpl_semi_sync_master;
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (1);
+DROP TABLE t1;
+[connection slave]
+include/install_semisync.inc
+[connection slave]
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+plugin_name plugin_status
+rpl_semi_sync_slave DELETED
+[connection master]
+UNINSTALL PLUGIN rpl_semi_sync_master;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+plugin_name plugin_status
+rpl_semi_sync_master DELETED
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (2);
+DROP TABLE t1;
+[connection slave]
+show status like "Rpl_semi_sync_slave_status";
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+[connection master]
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
+show status like "Rpl_semi_sync_master_clients";
+Variable_name Value
+Rpl_semi_sync_master_clients 1
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+plugin_name plugin_status
+rpl_semi_sync_master DELETED
+[connection slave]
+include/stop_slave.inc
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+plugin_name plugin_status
+include/start_slave.inc
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+plugin_name plugin_status
+[connection master]
+show status like "Rpl_semi_sync_master_clients";
+Variable_name Value
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+plugin_name plugin_status
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (3);
+DROP TABLE t1;
+[connection slave]
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result
index 5959ee09993..b93ecce3597 100644
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result
@@ -94,10 +94,12 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
+include/stop_slave.inc
[connection master]
+include/stop_dump_threads.inc
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
[connection slave]
-include/restart_slave.inc
+include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
[connection master]
@@ -116,6 +118,9 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
[connection slave]
include/wait_for_slave_to_stop.inc
[connection slave1]
+[connection master]
+include/stop_dump_threads.inc
+[connection slave1]
include/start_slave.inc
[connection master]
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/rpl/t/failed_create_view-6409.test b/mysql-test/suite/rpl/t/failed_create_view-6409.test
new file mode 100644
index 00000000000..5d96e6f8a93
--- /dev/null
+++ b/mysql-test/suite/rpl/t/failed_create_view-6409.test
@@ -0,0 +1,24 @@
+#
+# MDEV-6409 CREATE VIEW replication problem if error occurs in mysql_register_view
+#
+
+#
+#
+# verify that failed CREATE VIEW is not replicated
+
+create table v1 (a int);
+
+source include/master-slave.inc;
+
+connection master;
+create table t1 (a int);
+--error ER_TABLE_EXISTS_ERROR
+create view v1 as select * from t1;
+show tables;
+sync_slave_with_master;
+show tables;
+
+connection master;
+drop table if exists t1, v1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/kill_hard-6290.test b/mysql-test/suite/rpl/t/kill_hard-6290.test
new file mode 100644
index 00000000000..7624235666a
--- /dev/null
+++ b/mysql-test/suite/rpl/t/kill_hard-6290.test
@@ -0,0 +1,11 @@
+#
+# MDEV-6290 Crash in KILL HARD QUERY USER x@y when slave threads are running
+#
+
+# this test doesn't depend on the binlog format, no need to run it three times
+--source include/have_binlog_format_mixed.inc
+
+--source include/master-slave.inc
+--connection server_2
+kill user test2@nohost;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test
new file mode 100644
index 00000000000..7cdf67d6532
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test
@@ -0,0 +1,52 @@
+# Testing master to slave heartbeat protocol, test cases that need debug build.
+
+--source include/master-slave.inc
+--source include/have_debug.inc
+
+connection slave;
+--source include/stop_slave.inc
+set @restore_slave_net_timeout= @@global.slave_net_timeout;
+--disable_warnings
+set @@global.slave_net_timeout= 10;
+--enable_warnings
+
+###
+### Checking the range
+###
+
+#
+# default period slave_net_timeout/2
+#
+--query_vertical show status like 'Slave_heartbeat_period';
+SET @save_dbug= @@GLOBAL.debug_dbug;
+SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
+CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error');
+CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
+--source include/start_slave.inc
+
+
+connection master;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+
+sync_slave_with_master;
+
+--connection slave
+SELECT * FROM t1;
+
+connection master;
+drop table t1;
+
+connection slave;
+--source include/stop_slave.inc
+--disable_warnings
+SET GLOBAL debug_dbug=@save_dbug;
+set @@global.slave_net_timeout= @restore_slave_net_timeout;
+--enable_warnings
+--source include/start_slave.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 664ea732cac..091bbc38a15 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -548,6 +548,7 @@ source include/stop_slave.inc;
connection master;
echo [ on master ];
set sql_log_bin=0;
+--source include/stop_dump_threads.inc
UNINSTALL PLUGIN rpl_semi_sync_master;
set sql_log_bin=1;
enable_query_log;
@@ -601,19 +602,10 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
--echo #
--echo # Clean up
--echo #
+--source include/uninstall_semisync.inc
connection slave;
source include/stop_slave.inc;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-
-connection master;
-# The dump thread may still be running on the master, and so the following
-# UNINSTALL could generate a warning about the plugin is busy.
-disable_warnings;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
-
-connection slave;
change master to master_user='root',master_password='';
source include/start_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test b/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test
new file mode 100644
index 00000000000..60636da35dd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test
@@ -0,0 +1,130 @@
+###############################################################################
+# Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK
+# Problem: Uninstallation of Semi sync plugin should be blocked when it is
+# in use.
+# Test case: Uninstallation of semi sync should be allowed
+# On Master:
+# 1) When there is no dump thread
+# 2) When there are no semi sync slaves (i.e., async replication).
+# On Slave:
+# 1) When there is no I/O thread
+# 2) When there are no semi sync enabled I/O thread (i.e.,async replication).
+###############################################################################
+
+--source include/have_semisync_plugin.inc
+--source include/not_embedded.inc
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+
+###############################################################################
+# Case 1: Uninstallation of semi sync plugins should be allowed when it is
+# not in use i.e., when asynchronous replication is active.
+###############################################################################
+# Step 1.1: Install semi sync master plugin on master
+INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
+
+# Step 1.2: Install semi sync slave plugin on slave
+--connection slave
+--echo [connection slave]
+INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave';
+
+# Step 1.3: Uninstallation of semisync plugin on master and slave should be
+# allowed at this state as there is no semi sync replication enabled between
+# master and slave.
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+--connection master
+--echo [connection master]
+UNINSTALL PLUGIN rpl_semi_sync_master;
+
+# Step 1.4: Check that replication is working fine at the end of the test case.
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (1);
+DROP TABLE t1;
+--sync_slave_with_master
+--echo [connection slave]
+
+###############################################################################
+# Case 2: Uninstallation of semi sync plugins should be disallowed
+# when it is in use i.e., when semi sync replication is active
+###############################################################################
+# Step 2.1: Install and enable semi sync replication between master and slave
+--source include/install_semisync.inc
+
+# Step 2.2: Check that rpl_semi_sync_slave uninstallation on Slave is not
+# possible at this state
+--connection slave
+--echo [connection slave]
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+
+# Step 2.3: Check that rpl_semi_sync_master uninstallation on Master is not
+# possible at this state
+--connection master
+--echo [connection master]
+UNINSTALL PLUGIN rpl_semi_sync_master;
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+
+# Step 2.4: Check that replication is working fine at the end of the test case.
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (2);
+DROP TABLE t1;
+--sync_slave_with_master
+--echo [connection slave]
+
+# Step 2.5: Make sure rpl_semi_sync_master_status on Master and
+# rpl_semi_sync_slave_staus on Slave are ON
+show status like "Rpl_semi_sync_slave_status";
+
+###############################################################################
+# Case 3: Uninstallation of semi sync plugin should be disallowed when there
+# are semi sync slaves even though rpl_semi_sync_master_enabled= OFF;.
+###############################################################################
+# Step 3.1: Disable semi sync on master
+--connection master
+--echo [connection master]
+show status like "Rpl_semi_sync_master_status";
+
+# Step 3.2: Check that still Rpl_semi_sync_master_clients is 1
+show status like "Rpl_semi_sync_master_clients";
+
+# Step 3.3: Since Rpl_semi_sync_master_clients is 1, uninstallation of
+# rpl_semi_sync_master should be disallowed.
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+
+###############################################################################
+# Case 4: Uninstallation of semi sync plugin should be allowed when it is not
+# in use. Same as Case 1 but this case is to check the case after enabling and
+# disabling semi sync replication.
+###############################################################################
+
+# Step 4.1: Stop IO thread on slave.
+--connection slave
+--echo [connection slave]
+--source include/stop_slave.inc
+
+# Step 4.2: Disable semi sync on slave.
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+
+# Step 4.3: Start IO thread on slave.
+--source include/start_slave.inc
+
+# Step 4.4: Uninstall semi sync plugin, it should be successful now.
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+
+# Step 4.5: On Master, check that semi sync slaves are now '0'.
+--connection master
+--echo [connection master]
+show status like "Rpl_semi_sync_master_clients";
+
+# Step 4.6: So uninstalling semi sync plugin should be allowed
+select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
+
+# Step 4.7: Check that replication is working fine at the end of the test case
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (3);
+DROP TABLE t1;
+--sync_slave_with_master
+--echo [connection slave]
+
+# Cleanup
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test
index d9d7f39c321..340738f8cb2 100644
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test
@@ -74,14 +74,17 @@ CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
sync_slave_with_master;
+--source include/stop_slave.inc
--source include/rpl_connection_master.inc
+# make sure that there are no zombie threads
+--source include/stop_dump_threads.inc
let $debug_save= `SELECT @@GLOBAL.debug`;
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
--source include/rpl_connection_slave.inc
-source include/restart_slave_sql.inc;
+--source include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
@@ -93,6 +96,10 @@ INSERT INTO t2 VALUES(1);
UPDATE t1 SET c2 = 3 WHERE c1 = 1;
COMMIT;
+# wait for the dump thread reach the sync point
+--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%debug sync point%' and command='Binlog Dump'
+--source include/wait_condition.inc
+
--source include/rpl_connection_slave1.inc
let $show_statement= SHOW PROCESSLIST;
let $field= Info;
@@ -105,6 +112,7 @@ send STOP SLAVE;
ROLLBACK;
--source include/rpl_connection_master.inc
+
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
@@ -113,12 +121,25 @@ source include/wait_for_slave_to_stop.inc;
--source include/rpl_connection_slave1.inc
reap;
-source include/start_slave.inc;
+# Slave has stopped, thence lets make sure that
+# we kill the zombie dump threads. Also, make
+# sure that we disable the DBUG_EXECUTE_IF
+# that would set the dump thread to wait
--source include/rpl_connection_master.inc
-DROP TABLE t1, t2;
--disable_query_log
eval SET GLOBAL debug_dbug= '$debug_save';
--enable_query_log
+# make sure that there are no zombie threads
+--source include/stop_dump_threads.inc
+
+--source include/rpl_connection_slave1.inc
+# now the dump thread on the master will start
+# from a clean slate, i.e. without the
+# DBUG_EXECUTE_IF set
+source include/start_slave.inc;
+
+--source include/rpl_connection_master.inc
+DROP TABLE t1, t2;
--source include/rpl_end.inc
SET DEBUG_SYNC= 'RESET';