1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK

Problem: Uninstallation of semi sync plugin causes replication to
break.

Analysis: A semisync enabled replication is mutual agreement between
Master and Slave when the connection (I/O thread) is established.
Once I/O thread is started and if semisync is enabled on both
master and slave, master appends special magic header to events
using semisync plugin functions and sends it to slave. And slave
expects that each event will have that special magic header format
and reads those bytes using semisync plugin functions.

When semi sync replication is in use if users execute
uninstallation of the plugin on master, slave gets confused while
interpreting that event's content because it expects special 
magic header at the beginning of the event. Slave SQL thread will
be stopped with "Missing magic number in the header" error.

Similar problem will happen if uninstallation of the plugin happens
on slave when semi sync replication is in in use. Master sends
the events with magic header and slave does not know about the
added magic header and thinks that it received a corrupted event.
Hence slave SQL thread stops with "Found  corrupted event" error.

Fix: Uninstallation of semisync plugin will be blocked when semisync
replication is in use and will throw 'ER_UNKNOWN_ERROR' error.
To detect that semisync replication is in use, this patch uses
semisync status variable values.
 > On Master, it checks for 'Rpl_semi_sync_master_status' to be OFF
    before allowing the uninstallation of rpl_semi_sync_master plugin.
    >> Rpl_semi_sync_master_status is OFF when
        >>> there is no dump thread running
        >>> there are no semisync slaves
 > On Slave, it checks for 'Rpl_semi_sync_slave_status' to be OFF
    before allowing the uninstallation of rpl_semi_sync_slave plugin.
    >> Rpl_semi_sync_slave_status is OFF when
       >>> there is no I/O thread running
       >>> replication is asynchronous replication.
This commit is contained in:
Venkatesh Duggirala
2014-05-05 22:22:15 +05:30
parent 16b81798aa
commit 66d624b7d6
11 changed files with 317 additions and 12 deletions

View File

@@ -439,9 +439,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;

View File

@@ -0,0 +1,36 @@
include/master-slave.inc
[connection master]
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
UNINSTALL PLUGIN rpl_semi_sync_slave;
UNINSTALL PLUGIN rpl_semi_sync_master;
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
DROP TABLE t1;
include/install_semisync.inc
call mtr.add_suppression("Plugin 'rpl_semi_sync_slave' cannot be uninstalled now");
UNINSTALL PLUGIN rpl_semi_sync_slave;
ERROR HY000: Unknown error
call mtr.add_suppression("Plugin 'rpl_semi_sync_master' cannot be uninstalled now");
UNINSTALL PLUGIN rpl_semi_sync_master;
ERROR HY000: Unknown error
CREATE TABLE t1(i int);
INSERT INTO t1 values (2);
DROP TABLE t1;
include/assert.inc [semi sync slave status should be ON.]
include/assert.inc [semi sync master status should be ON.]
include/assert.inc [semi sync master clients should be 1.]
SET GLOBAL rpl_semi_sync_master_enabled = OFF;
include/assert.inc [semi sync master clients should be 1.]
UNINSTALL PLUGIN rpl_semi_sync_master;
ERROR HY000: Unknown error
include/stop_slave.inc
SET GLOBAL rpl_semi_sync_slave_enabled = OFF;
include/start_slave.inc
UNINSTALL PLUGIN rpl_semi_sync_slave;
include/assert.inc [semi sync master clients should be 0.]
UNINSTALL PLUGIN rpl_semi_sync_master;
CREATE TABLE t1(i int);
INSERT INTO t1 values (3);
DROP TABLE t1;
include/rpl_end.inc