Commit 391f1aa6 authored by Sujatha's avatar Sujatha

MDEV-24773: slave_compressed_protocol doesn't work properly with semi-sync replication

Back port upstream fix

commit 1800b015a1d487330f7b15f2020b887be348a66b
Author: Venkatesh Duggirala <venkatesh.duggirala@oracle.com>
Date:   Fri Sep 8 20:29:22 2017 +0530

Bug#26027024    SLAVE_COMPRESSED_PROTOCOL DOESN'T WORK WITH
SEMI-SYNC REPLICATION IN MYSQL-5.7

Analysis: In mysql-5.6, dump thread (the thread that is created
on Master after Slave requested for a binlog dump) is also used
to receive acknowledgements from the Slave and act on them accordingly.
For performance reasons, a special thread called Ack Receiver thread
is added in mysql-5.7 Semi synchronous replication plugin.
This thread does not have special handling to receive acknowledgements
if Slave has enabled compression in the protocol. Hence Master is
unable to handle any slave if Slave_compressed_protocol is enabled
on it.

Fix: Enable compress flag on the communication channels if the Slave
has Slave_compressed_protocol ON.
parent 42aad65b
include/master-slave.inc
[connection master]
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
connection slave;
include/stop_slave.inc
SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc
connection master;
CREATE TABLE t1 (i INT);
DROP TABLE t1;
include/rpl_sync.inc
include/assert_grep.inc [Check that there is no 'Read semi-sync reply magic number error' in error log.]
connection master;
SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master;
connection slave;
include/stop_slave.inc
SET @@GLOBAL. rpl_semi_sync_slave_enabled = $sav_enabled_slave;
include/start_slave.inc
include/rpl_end.inc
################################################################################
# Bug#26027024 SLAVE_COMPRESSED_PROTOCOL DOESN'T WORK WITH SEMI-SYNC
# REPLICATION IN MYSQL-5.7
#
# Steps to reproduce:
# 1) Set slave_compressed_protocol ON on Slave.
# 2) Do some sample work on Master
# 3) After the work is synced on Slave, check that there is no error
# (Read semi-sync reply magic number error) on Slave.
# 4) Cleanup
################################################################################
# Test is independent of Binlog format. One of the three formats is enough
# for testing. Choosing 'Row' format.
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled `
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
--connection slave
source include/stop_slave.inc;
--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled `
SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
source include/start_slave.inc;
--connection master
# Do some sample work on Master with slave_compressed_protocol ON.
# (slave_compressed_protocol is set to ON in -slave.opt file of this test.)
CREATE TABLE t1 (i INT);
DROP TABLE t1;
# Make sure sync is done, so that next 'assert' step can be executed without
# any issues.
--source include/rpl_sync.inc
# Without the fix, the test would have generated few
# errors in the error log. With the fix, test will
# pass without any errors in the error log.
--let $assert_text= Check that there is no 'Read semi-sync reply magic number error' in error log.
--let $assert_select=Read semi-sync reply magic number error
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count= 0
--let $assert_only_after = CURRENT_TEST:rpl.rpl_semi_sync_slave_compressed_protocol.test
--source include/assert_grep.inc
--connection master
--evalp SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master
--connection slave
source include/stop_slave.inc;
--evalp SET @@GLOBAL. rpl_semi_sync_slave_enabled = $sav_enabled_slave
source include/start_slave.inc;
# Cleanup
--source include/rpl_end.inc
......@@ -268,6 +268,11 @@ void Ack_receiver::run()
net_clear(&net, 0);
net.vio= &slave->vio;
/*
Set compress flag. This is needed to support
Slave_compress_protocol flag enabled Slaves
*/
net.compress= slave->thd->net.compress;
len= my_net_read(&net);
if (likely(len != packet_error))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment