Bug #47298 Semisync: always wait until timeout if no semi-sync slave available
Submitted: 14 Sep 2009 3:29 Modified: 12 Nov 2009 12:37
Reporter: Zhenxing He Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.4 OS:Any
Assigned to: Zhenxing He CPU Architecture:Any
Tags: replication, semisync
Triage: Triaged: D2 (Serious) / R2 (Low) / E2 (Low)

[14 Sep 2009 3:29] Zhenxing He
Description:
On semi-sync master, transactions will wait until it get reply from one
of the semi-sync slave or timeout. But if the master detected semi-sync
slave problem and there is no other semi-sync slave left, it will abort
waiting immediately:

<pstoev> A) on detectable problems, such as STOP SLAVE IO_THREAD, no
timeout applies and we immediately revert to normal replication
<pstoev> B) on non-detectable problems, such as network disruption, the
timeout applies, and then we revert to normal replication

Philip thinks that this feature would make semi-sync too weak to test.

 <pstoev> jasonh: ok this means that I can not really test any further.
This feature provies provides the weakest possible guarantee about
things, so weak that it is not very possible to test it.

How to repeat:
Setup semi-sync, and then stop slave, semi-sync status on master sometimes 
will turn off before timeout have reached.

Suggested fix:
Here is the decision after discussed this issue within the replication team:

   DECISION:
   - Default should be that semi-sync is strict, i.e. it will wait for
     slaves
   - For any non-strict behaviour, this needs to be an option.
[14 Sep 2009 5:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83135

3599 He Zhenxing	2009-09-14
      BUG#47298 Semisync: always wait until timeout if no semi-sync slave available
      
      Add an option to control whether the master should keep waiting
      until timeout when it detected that there is no semi-sync slave
      available.
      
      The bool option 'rpl_semi_sync_master_wait_no_slave' is 1 by
      defalt, and will keep waiting until timeout. When set to 0, the
      master will switch to asynchronous replication immediately when
      no semi-sync slave is available.
     @ plugin/semisync/semisync_master.cc
        Turn off semi-sync immediately on master if no semi-sync slave available
     @ plugin/semisync/semisync_master.h
        Add variable to control if should keep waiting when no semisync slave is available
     @ plugin/semisync/semisync_master_plugin.cc
        Add option to control if should keep waiting when no semisync slave is available
[18 Sep 2009 7:52] Lars Thalmann
Even though this is a bit of "feature-creep", it seems necessary to
include it to make semisync really usable.

Let's include this in the first release of semisync.
[26 Sep 2009 10:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/84712

3599 He Zhenxing	2009-09-26
      BUG#47298 Semisync: always wait until timeout if no semi-sync slave available
      
      Add an option to control whether the master should keep waiting
      until timeout when it detected that there is no semi-sync slave
      available.
      
      The bool option 'rpl_semi_sync_master_wait_no_slave' is 1 by
      defalt, and will keep waiting until timeout. When set to 0, the
      master will switch to asynchronous replication immediately when
      no semi-sync slave is available.
     @ mysql-test/suite/rpl/r/rpl_semi_sync.result
        Update test result after fix of bug#47298
     @ mysql-test/suite/rpl/t/rpl_semi_sync.test
        Fix test case after fix of bug#47298
     @ plugin/semisync/semisync_master.cc
        Turn off semi-sync immediately on master if no semi-sync slave available
     @ plugin/semisync/semisync_master.h
        Add variable to control if should keep waiting when no semisync slave is available
     @ plugin/semisync/semisync_master_plugin.cc
        Add option to control if should keep waiting when no semisync slave is available
        Assume the semi-sync slave has already received all binlog events before the filename and position it requests to dump
     @ plugin/semisync/semisync_slave_plugin.cc
        Revert the behavior change made by the patch for bug#45672. Allow semi-sync slave to connect when semi-sync is disabled on master, so that the slave can start semi-sync replication once the master enables semi-sync later.
[26 Sep 2009 10:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/84718

2839 He Zhenxing	2009-09-26 [merge]
      Merge BUG#47298 to 6.0-codebase-bugfixing
[26 Sep 2009 13:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/84721

2839 He Zhenxing	2009-09-26 [merge]
      Merge BUG#47298 to 6.0-codebase-bugfixing
[30 Sep 2009 4:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/85122

3629 He Zhenxing	2009-09-30
      BUG#47298 Semisync: always wait until timeout if no semi-sync slave available
      
      Add an option to control whether the master should keep waiting
      until timeout when it detected that there is no semi-sync slave
      available.
      
      The bool option 'rpl_semi_sync_master_wait_no_slave' is 1 by
      defalt, and will keep waiting until timeout. When set to 0, the
      master will switch to asynchronous replication immediately when
      no semi-sync slave is available.
     @ mysql-test/suite/rpl/r/rpl_semi_sync.result
        Update test result after fix of bug#47298
     @ mysql-test/suite/rpl/t/rpl_semi_sync.test
        Fix test case after fix of bug#47298
     @ plugin/semisync/semisync_master.cc
        Turn off semi-sync immediately on master if no semi-sync slave available
     @ plugin/semisync/semisync_master.h
        Add variable to control if should keep waiting when no semisync slave is available
     @ plugin/semisync/semisync_master_plugin.cc
        Add option to control if should keep waiting when no semisync slave is available
        Assume the semi-sync slave has already received all binlog events before the filename and position it requests to dump
     @ plugin/semisync/semisync_slave_plugin.cc
        Revert the behavior change made by the patch for bug#45672. Allow semi-sync slave to connect when semi-sync is disabled on master, so that the slave can start semi-sync replication once the master enables semi-sync later.
[9 Oct 2009 8:48] Bugs System
Pushed into 6.0.14-alpha (revid:alik@ibmvm-20091009083208-0o0f0i9w1sq3c1kn) (version source revid:zhenxing.he@sun.com-20090930040622-uuq84ezbsavqd0g5) (merge vers: 6.0.14-alpha) (pib:12)
[10 Oct 2009 9:43] Jon Stephens
Discussed with Paul in email; he'll handle documenting this fix.
[12 Oct 2009 13:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/86576

3117 He Zhenxing	2009-10-12
      Backport BUG#47298 Semisync: always wait until timeout if no semi-sync slave available
      
      Add an option to control whether the master should keep waiting
      until timeout when it detected that there is no semi-sync slave
      available.
      
      The bool option 'rpl_semi_sync_master_wait_no_slave' is 1 by
      defalt, and will keep waiting until timeout. When set to 0, the
      master will switch to asynchronous replication immediately when
      no semi-sync slave is available.
[21 Oct 2009 17:00] Paul Dubois
Noted in 6.0.14 changelog.

With semisynchronous replication, for each transaction, the master
waits until timeout for acknowledgement of receipt from some slave.
If no response occurs during this period, the master reverts to
normal replication. A new system variable,
rpl_semi_sync_master_wait_no_slave, controls whether the master waits
for the timeout to expire before reverting to normal replication even
if the slave count drops to zero during the timeout period.
          
If the value is ON (the default), it is allowable for the slave count
to drop to zero during the timeout period (for example, if slaves
disconnect). The master still waits for the timeout, so as long as
some slave reconnects and acknowledges the transaction within the
timeout interval, semisynchronous replication continues.
          
If the value is OFF, the master reverts to normal replication if the
slave count drops to zero during the timeout period.

Setting report to NDI pending push into 5.5.x.
[27 Oct 2009 9:50] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091027094604-9p7kplu1vd2cvcju) (version source revid:zhenxing.he@sun.com-20091026140226-uhnqejkyqx1aeilc) (merge vers: 6.0.14-alpha) (pib:13)
[27 Oct 2009 14:03] Paul Dubois
Setting report to NDI pending push into 5.5.x.
[12 Nov 2009 8:22] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version source revid:alik@sun.com-20091027095744-rf45u3x3q5d1f5y0) (merge vers: 5.5.0-beta) (pib:13)
[12 Nov 2009 12:37] Jon Stephens
Bugfix also documented in the 5.5.0 changelog; closed.
[18 Dec 2009 15:14] Paul Dubois
Removed 5.5.0 changelog entry. In 5.5, semisync replication first appears in 5.5.0, so this bug affects no 5.5.x releases.