Bug #70360 an independent instance with semisync enabled still need ack from slave
Submitted: 17 Sep 2013 6:38 Modified: 15 Jan 2014 9:46
Reporter: zhai weixiang (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6.13, 5.6.14 OS:Any
Assigned to: CPU Architecture:Any

[17 Sep 2013 6:38] zhai weixiang
Description:

related link :

http://dev.mysql.com/doc/refman/5.6/en/replication-semisync.html

quoted description:

Semisynchronous replication must be enabled on both the master and slave sides. If semisynchronous replication is disabled on the master, or enabled on the master but on no slaves, the master uses asynchronous replication

But In my test , I configured  an independent instance without any slave instance:

root@(none) 02:35:32>show variables like '%semi%';
+------------------------------------+----------+
| Variable_name                      | Value    |
+------------------------------------+----------+
| rpl_semi_sync_master_enabled       | ON       |
| rpl_semi_sync_master_timeout       | 10000000 |
| rpl_semi_sync_master_trace_level   | 32       |
| rpl_semi_sync_master_wait_no_slave | ON       |
| rpl_semi_sync_slave_enabled        | OFF      |
| rpl_semi_sync_slave_trace_level    | 32       |
+------------------------------------+----------+
6 rows in set (0.00 sec)

and then execute any statement , The client was blocked waiting for ack from slave/

root@(none) 02:22:41>show processlist;
+----+------+-----------+------+---------+------+--------------------------------------+-----------------------------------+
| Id | User | Host      | db   | Command | Time | State                                | Info                              |
+----+------+-----------+------+---------+------+--------------------------------------+-----------------------------------+
|  1 | root | localhost | NULL | Query   |    0 | init                                 | show processlist                  |
|  2 | root | localhost | NULL | Query   |    6 | Waiting for semi-sync ACK from slave | DROP SCHEMA IF EXISTS `mysqlslap` |
+----+------+-----------+------+---------+------+--------------------------------------+-----------------------------------+
2 rows in set (0.00 sec)

How to repeat:
above.

Suggested fix:
I don't know. I am a beginner of  semi-sync plugin
[25 Sep 2013 17:50] MySQL Verification Team
Hello Zhai,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[25 Sep 2013 17:56] MySQL Verification Team
This can be easily reproduced on a standalone instance with master semi sync plugin enabled + with a high rpl_semi_sync_master_timeout..

// Session 1

mysql> select version();
+-------------------------------------------+
| version()                                 |
+-------------------------------------------+
| 5.6.14-enterprise-commercial-advanced-log |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> show variables like '%semi%';
Empty set (0.01 sec)

mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL rpl_semi_sync_master_enabled = ON;
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL rpl_semi_sync_master_timeout = 10000000 ;
Query OK, 0 rows affected (0.00 sec)

mysql> INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%semi%';
+------------------------------------+----------+
| Variable_name                      | Value    |
+------------------------------------+----------+
| rpl_semi_sync_master_enabled       | ON       |
| rpl_semi_sync_master_timeout       | 10000000 |
| rpl_semi_sync_master_trace_level   | 32       |
| rpl_semi_sync_master_wait_no_slave | ON       |
| rpl_semi_sync_slave_enabled        | OFF      |
| rpl_semi_sync_slave_trace_level    | 32       |
+------------------------------------+----------+
6 rows in set (0.00 sec)

mysql> use test
Database changed
mysql> create table t1(id int not null);

^^ above ddl just hangs...

// Session 2 - check processlist to confirm 

mysql> show processlist;
+----+------+-----------+------+---------+------+--------------------------------------+----------------------------------+
| Id | User | Host      | db   | Command | Time | State                                | Info                             |
+----+------+-----------+------+---------+------+--------------------------------------+----------------------------------+
|  1 | root | localhost | test | Query   |    4 | Waiting for semi-sync ACK from slave | create table t1(id int not null) |
|  2 | root | localhost | NULL | Query   |    0 | init                                 | show processlist                 |
+----+------+-----------+------+---------+------+--------------------------------------+----------------------------------+
2 rows in set (0.00 sec)

^^ See "Waiting for semi-sync ACK from slave"...
[15 Jan 2014 9:46] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented fix in the 5.7.4 changelog as follows:

        When semi-synchronous replication is configured on an
        independent server with no slaves and
        rpl_semi_sync_master_wait_no_slave is set to OFF, the master
        still waited for an ACK from the slave. If
        rpl_semi_sync_master_wait_no_slave is set to OFF, the master
        should revert to normal replication when the number of slaves
        reaches zero during the specified timeout period. Now in such
        cases the server checks whether semi-synchronous replication is
        switched on, and, if so, goes on to check whether any slaves are
        connected. If none are connected, semi-synchronous replication
        is disabled until such time that the user sets the value of
        rpl_semi_sync_master_wait_no_slave to ON.

Closed.