Skip to content

Commit 8be70ca

Browse files
author
Venkatesh Duggirala
committed
Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK
Merging fix from mysql-5.5
2 parents 4944f01 + 66d624b commit 8be70ca

13 files changed

+292
-17
lines changed

mysql-test/include/install_semisync.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
--source include/begin_include_file.inc
66

77
--source include/not_embedded.inc
8-
--source include/not_gtid_enabled.inc
98
--source include/have_semisync_plugin.inc
109

1110
--connection master

mysql-test/include/stop_dump_threads.inc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
--disable_query_log
1616
--disable_result_log
1717

18-
--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'`
18+
--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump' OR COMMAND = 'Binlog Dump GTID'`
1919

2020
while ($_sdt_dump_thread_id != '')
2121
{
2222
eval KILL $_sdt_dump_thread_id;
2323
--let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = $_sdt_dump_thread_id
2424
--source include/wait_condition.inc
2525

26-
--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'`
26+
--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump' OR COMMAND = 'Binlog Dump GTID'`
2727
}
2828

29-
3029
--let $show_rpl_debug_info= $_sdt_show_rpl_debug_info_old
3130

3231
--let $include_filename= stop_dump_threads.inc

mysql-test/include/uninstall_semisync.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
UNINSTALL PLUGIN rpl_semi_sync_slave;
1414

1515
--connection master
16+
# After BUG#17638477 fix, uninstallation of rpl_semi_sync_master
17+
# is not allowed when there are semi sync slaves. Hence kill
18+
# all dump threads before uninstalling it.
19+
SET GLOBAL rpl_semi_sync_master_enabled = OFF;
20+
--source include/stop_dump_threads.inc
1621
UNINSTALL PLUGIN rpl_semi_sync_master;
1722
--enable_warnings
1823

mysql-test/suite/rpl/r/rpl_semi_sync.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ Variable_name Value
403403
Rpl_semi_sync_slave_status ON
404404
include/stop_slave.inc
405405
[ on master ]
406+
include/stop_dump_threads.inc
406407
UNINSTALL PLUGIN rpl_semi_sync_master;
407408
SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
408409
Variable_name Value
@@ -454,9 +455,8 @@ Rpl_semi_sync_slave_status OFF
454455
#
455456
# Clean up
456457
#
458+
include/uninstall_semisync.inc
457459
include/stop_slave.inc
458-
UNINSTALL PLUGIN rpl_semi_sync_slave;
459-
UNINSTALL PLUGIN rpl_semi_sync_master;
460460
change master to master_user='root',master_password='';
461461
Warnings:
462462
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
7+
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
8+
UNINSTALL PLUGIN rpl_semi_sync_slave;
9+
UNINSTALL PLUGIN rpl_semi_sync_master;
10+
CREATE TABLE t1(i int);
11+
INSERT INTO t1 values (1);
12+
DROP TABLE t1;
13+
include/install_semisync.inc
14+
call mtr.add_suppression("Plugin 'rpl_semi_sync_slave' cannot be uninstalled now");
15+
UNINSTALL PLUGIN rpl_semi_sync_slave;
16+
ERROR HY000: Plugin 'rpl_semi_sync_slave' cannot be uninstalled now. Stop any active semisynchronous I/O threads on this slave first.
17+
call mtr.add_suppression("Plugin 'rpl_semi_sync_master' cannot be uninstalled now");
18+
UNINSTALL PLUGIN rpl_semi_sync_master;
19+
ERROR HY000: Plugin 'rpl_semi_sync_master' cannot be uninstalled now. Stop any active semisynchronous slaves of this master first.
20+
CREATE TABLE t1(i int);
21+
INSERT INTO t1 values (2);
22+
DROP TABLE t1;
23+
include/assert.inc [semi sync slave status should be ON.]
24+
include/assert.inc [semi sync master status should be ON.]
25+
include/assert.inc [semi sync master clients should be 1.]
26+
SET GLOBAL rpl_semi_sync_master_enabled = OFF;
27+
include/assert.inc [semi sync master clients should be 1.]
28+
UNINSTALL PLUGIN rpl_semi_sync_master;
29+
ERROR HY000: Plugin 'rpl_semi_sync_master' cannot be uninstalled now. Stop any active semisynchronous slaves of this master first.
30+
include/stop_slave.inc
31+
SET GLOBAL rpl_semi_sync_slave_enabled = OFF;
32+
include/start_slave.inc
33+
UNINSTALL PLUGIN rpl_semi_sync_slave;
34+
include/assert.inc [semi sync master clients should be 0.]
35+
UNINSTALL PLUGIN rpl_semi_sync_master;
36+
CREATE TABLE t1(i int);
37+
INSERT INTO t1 values (3);
38+
DROP TABLE t1;
39+
include/rpl_end.inc

mysql-test/suite/rpl/t/rpl_semi_sync.test

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ connection slave;
577577
source include/stop_slave.inc;
578578
connection master;
579579
echo [ on master ];
580+
--source include/stop_dump_threads.inc
580581
UNINSTALL PLUGIN rpl_semi_sync_master;
581582
enable_query_log;
582583
SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
@@ -627,19 +628,10 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
627628
--echo #
628629
--echo # Clean up
629630
--echo #
631+
--source include/uninstall_semisync.inc
630632

631633
connection slave;
632-
source include/stop_slave.inc;
633-
UNINSTALL PLUGIN rpl_semi_sync_slave;
634-
635-
connection master;
636-
# The dump thread may still be running on the master, and so the following
637-
# UNINSTALL could generate a warning about the plugin is busy.
638-
disable_warnings;
639-
UNINSTALL PLUGIN rpl_semi_sync_master;
640-
enable_warnings;
641-
642-
connection slave;
634+
--source include/stop_slave.inc
643635
--replace_column 2 ####
644636
change master to master_user='root',master_password='';
645637
source include/start_slave.inc;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$SEMISYNC_PLUGIN_OPT
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$SEMISYNC_PLUGIN_OPT
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
###############################################################################
2+
# Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK
3+
# Problem: Uninstallation of Semi sync plugin should be blocked when it is
4+
# in use.
5+
# Test case: Uninstallation of semi sync should be allowed
6+
# On Master:
7+
# 1) When there is no dump thread
8+
# 2) When there are no semi sync slaves (i.e., async replication).
9+
# On Slave:
10+
# 1) When there is no I/O thread
11+
# 2) When there are no semi sync enabled I/O thread (i.e.,async replication).
12+
###############################################################################
13+
14+
--source include/have_semisync_plugin.inc
15+
--source include/not_embedded.inc
16+
--source include/have_binlog_format_statement.inc
17+
--source include/master-slave.inc
18+
19+
###############################################################################
20+
# Case 1: Uninstallation of semi sync plugins should be allowed when it is
21+
# not in use i.e., when asynchronous replication is active.
22+
###############################################################################
23+
# Step 1.1: Install semi sync master plugin on master
24+
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
25+
26+
# Step 1.2: Install semi sync slave plugin on slave
27+
--connection slave
28+
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
29+
30+
# Step 1.3: Uninstallation of semisync plugin on master and slave should be
31+
# allowed at this state as there is no semi sync replication enabled between
32+
# master and slave.
33+
UNINSTALL PLUGIN rpl_semi_sync_slave;
34+
--connection master
35+
UNINSTALL PLUGIN rpl_semi_sync_master;
36+
37+
# Step 1.4: Check that replication is working fine at the end of the test case.
38+
CREATE TABLE t1(i int);
39+
INSERT INTO t1 values (1);
40+
DROP TABLE t1;
41+
--sync_slave_with_master
42+
43+
###############################################################################
44+
# Case 2: Uninstallation of semi sync plugins should be disallowed
45+
# when it is in use i.e., when semi sync replication is active
46+
###############################################################################
47+
# Step 2.1: Install and enable semi sync replication between master and slave
48+
--source include/install_semisync.inc
49+
50+
# Step 2.2: Check that rpl_semi_sync_slave uninstallation on Slave is not
51+
# possible at this state
52+
--connection slave
53+
call mtr.add_suppression("Plugin 'rpl_semi_sync_slave' cannot be uninstalled now");
54+
--error ER_PLUGIN_CANNOT_BE_UNINSTALLED
55+
UNINSTALL PLUGIN rpl_semi_sync_slave;
56+
57+
# Step 2.3: Check that rpl_semi_sync_master uninstallation on Master is not
58+
# possible at this state
59+
--connection master
60+
call mtr.add_suppression("Plugin 'rpl_semi_sync_master' cannot be uninstalled now");
61+
--error ER_PLUGIN_CANNOT_BE_UNINSTALLED
62+
UNINSTALL PLUGIN rpl_semi_sync_master;
63+
64+
# Step 2.4: Check that replication is working fine at the end of the test case.
65+
CREATE TABLE t1(i int);
66+
INSERT INTO t1 values (2);
67+
DROP TABLE t1;
68+
--sync_slave_with_master
69+
70+
# Step 2.5: Make sure rpl_semi_sync_master_status on Master and
71+
# rpl_semi_sync_slave_staus on Slave are ON
72+
--let $slave_status=[show status like "Rpl_semi_sync_slave_status", Value, 1]
73+
--let assert_cond= "$slave_status" = "ON"
74+
--let assert_text= semi sync slave status should be ON.
75+
--source include/assert.inc
76+
77+
--connection master
78+
--let $master_status=[show status like "Rpl_semi_sync_master_status", Value, 1]
79+
--let assert_cond= "$master_status" = "ON"
80+
--let assert_text= semi sync master status should be ON.
81+
--source include/assert.inc
82+
83+
--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
84+
--let assert_cond= $master_clients = 1
85+
--let assert_text= semi sync master clients should be 1.
86+
--source include/assert.inc
87+
88+
###############################################################################
89+
# Case 3: Uninstallation of semi sync plugin should be disallowed when there
90+
# are semi sync slaves even though rpl_semi_sync_master_enabled= OFF;.
91+
###############################################################################
92+
# Step 3.1: Disable semi sync on master
93+
--connection master
94+
SET GLOBAL rpl_semi_sync_master_enabled = OFF;
95+
96+
# Step 3.2: Check that still Rpl_semi_sync_master_clients is 1
97+
--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
98+
--let assert_cond= $master_clients = 1
99+
--let assert_text= semi sync master clients should be 1.
100+
--source include/assert.inc
101+
102+
# Step 3.3: Since Rpl_semi_sync_master_clients is 1, uninstallation of
103+
# rpl_semi_sync_master should be disallowed.
104+
--error ER_PLUGIN_CANNOT_BE_UNINSTALLED
105+
UNINSTALL PLUGIN rpl_semi_sync_master;
106+
107+
###############################################################################
108+
# Case 4: Uninstallation of semi sync plugin should be allowed when it is not
109+
# in use. Same as Case 1 but this case is to check the case after enabling and
110+
# disabling semi sync replication.
111+
###############################################################################
112+
113+
# Step 4.1: Stop IO thread on slave.
114+
--connection slave
115+
--source include/stop_slave.inc
116+
117+
# Step 4.2: Disable semi sync on slave.
118+
SET GLOBAL rpl_semi_sync_slave_enabled = OFF;
119+
120+
# Step 4.3: Start IO thread on slave.
121+
--source include/start_slave.inc
122+
123+
# Step 4.4: Uninstall semi sync plugin, it should be successful now.
124+
UNINSTALL PLUGIN rpl_semi_sync_slave;
125+
126+
# Step 4.5: On Master, check that semi sync slaves are now '0'.
127+
--connection master
128+
--let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
129+
--let assert_cond= $master_clients = 0
130+
--let assert_text= semi sync master clients should be 0.
131+
--source include/assert.inc
132+
133+
# Step 4.6: So uninstalling semi sync plugin should be allowed
134+
UNINSTALL PLUGIN rpl_semi_sync_master;
135+
136+
# Step 4.7: Check that replication is working fine at the end of the test case
137+
CREATE TABLE t1(i int);
138+
INSERT INTO t1 values (3);
139+
DROP TABLE t1;
140+
--sync_slave_with_master
141+
142+
# Cleanup
143+
source include/rpl_end.inc;

sql/share/errmsg-utf8.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7100,6 +7100,9 @@ ER_INNODB_FORCED_RECOVERY
71007100
ER_AES_INVALID_IV
71017101
eng "The initialization vector supplied to %s is too short. Must be at least %d bytes long"
71027102
bg "Инициализационния вектор подаден на %s е прекалено къс. Трябва да е поне %d байта"
7103+
7104+
ER_PLUGIN_CANNOT_BE_UNINSTALLED
7105+
eng "Plugin '%s' cannot be uninstalled now. %s"
71037106
#
71047107
# End of 5.6 error messages.
71057108
#

0 commit comments

Comments
 (0)