MDEV-35397: Fix semisync assertion on slave disconnect/reconnect race - #5578
Open
nadaelsayed11 wants to merge 1 commit into
Open
MDEV-35397: Fix semisync assertion on slave disconnect/reconnect race#5578nadaelsayed11 wants to merge 1 commit into
nadaelsayed11 wants to merge 1 commit into
Conversation
Repl_semi_sync_master::remove_slave() clears the entire active-transaction list when the last semisync client disconnects (with rpl_semi_sync_master_wait_no_slave=0), but unlike switch_off() it never bumped rpl_semi_sync_master_off_times. A transaction parked in commit_trx()'s wait loop tolerates a lone disconnect fine, since its own 'no clients left' guard matches remove_slave()'s. But if a slave reconnects before the waiter re-checks, that guard no longer fires, and the waiter finds its entry missing with off_times unchanged, tripping the DBUG_ASSERT that assumes only switch_off() can cause a missing entry. Bump rpl_semi_sync_master_off_times in remove_slave() too, mirroring switch_off(), so the invariant holds and the waiter takes the intended 'skip the wait' exit instead of asserting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repl_semi_sync_master::remove_slave() clears the entire active-transaction list when the last semisync client disconnects (with rpl_semi_sync_master_wait_no_slave=0), but unlike switch_off() it never bumped rpl_semi_sync_master_off_times. A transaction parked in commit_trx()'s wait loop tolerates a lone disconnect fine, since its own 'no clients left' guard matches remove_slave()'s. But if a slave reconnects before the waiter re-checks, that guard no longer fires, and the waiter finds its entry missing with off_times unchanged, tripping the DBUG_ASSERT that assumes only switch_off() can cause a missing entry. Bump rpl_semi_sync_master_off_times in remove_slave() too, mirroring switch_off(), so the invariant holds and the waiter takes the intended 'skip the wait' exit instead of asserting.