Description:
According to the documentation, semi-sync should is only active if it has been enabled on both the master and the slaves. "The plugins must be enabled both on the master side and the slave side to enable semisynchronous replication. If only one side is enabled, replication will be asynchronous."
However, I have the following:
MASTER:
mysql> show global status like '%semi%status';
mysql> show global status like '%semi%';
+--------------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------------+-------+
| Rpl_semi_sync_master_clients | 2 |
| Rpl_semi_sync_master_net_avg_wait_time | 0 |
| Rpl_semi_sync_master_net_wait_time | 0 |
| Rpl_semi_sync_master_net_waits | 0 |
| Rpl_semi_sync_master_no_times | 0 |
| Rpl_semi_sync_master_no_tx | 0 |
| Rpl_semi_sync_master_status | OFF |
| Rpl_semi_sync_master_timefunc_failures | 0 |
| Rpl_semi_sync_master_tx_avg_wait_time | 0 |
| Rpl_semi_sync_master_tx_wait_time | 0 |
| Rpl_semi_sync_master_tx_waits | 0 |
| Rpl_semi_sync_master_wait_pos_backtraverse | 0 |
| Rpl_semi_sync_master_wait_sessions | 0 |
| Rpl_semi_sync_master_yes_tx | 0 |
| Rpl_semi_sync_slave_status | OFF |
+--------------------------------------------+-------+
mysql> show global variables like '%semi%';
+------------------------------------+-------+
| Variable_name | Value |
+------------------------------------+-------+
| rpl_semi_sync_master_enabled | OFF |
| rpl_semi_sync_master_timeout | 2500 |
| rpl_semi_sync_master_trace_level | 32 |
| rpl_semi_sync_master_wait_no_slave | ON |
| rpl_semi_sync_slave_enabled | ON |
| rpl_semi_sync_slave_trace_level | 32 |
+------------------------------------+-------+
SLAVES (identical):
mysql> show global status like '%semi%status';
+-----------------------------+-------+
| Variable_name | Value |
+-----------------------------+-------+
| Rpl_semi_sync_master_status | OFF |
| Rpl_semi_sync_slave_status | ON |
+-----------------------------+-------+
mysql> show global variables like '%semi%';
+------------------------------------+-------+
| Variable_name | Value |
+------------------------------------+-------+
| rpl_semi_sync_master_enabled | OFF |
| rpl_semi_sync_master_timeout | 2500 |
| rpl_semi_sync_master_trace_level | 32 |
| rpl_semi_sync_master_wait_no_slave | ON |
| rpl_semi_sync_slave_enabled | ON |
| rpl_semi_sync_slave_trace_level | 32 |
+------------------------------------+-------+
And in the error log on the master, I see entries like this:
2016-01-12 00:10:02 110998 [Note] Stop semi-sync binlog_dump to slave (server_id: 167891604)
2016-01-12 00:10:04 110998 [Note] Start semi-sync binlog_dump to slave (server_id: 167891604), pos(nameofmyserver-6-9-bin.001824, 4474187)
This probably would not have even shown up on my radar except that we hit a period of heavy write activity and started getting alerts about IO thread lag - roughly 1GB of binlogs had not even been transferred from master to either slave. The network was not saturated, and as soon as I disabled semi-sync on one of the slaves and restarted the it, the rate of binlog transfer went up immensely and the IO lag disappeared.
How to repeat:
Configure a master and two slaves (it probably works with just one).
For the slave, set rpl_semi_sync_slave_enabled=ON. It does not matter if this is also set on the master.
On the master, set rpl_semi_sync_master_enabled=OFF.
Watch the error log on the master as you stop / start replication:
SLAVE> stop slave;
master log: 2016-01-22 22:30:02 110998 [Note] Stop semi-sync binlog_dump to slave (server_id: 167878471)
SLAVE> start slave;
master log: 2016-01-22 22:30:05 110998 [Note] Start semi-sync binlog_dump to slave (server_id: 167878471), pos(nameofmyserver-6-9-bin.002191, 11656050)
Suggested fix:
Make semi-sync replication work the same way it's described in the manual.