Skip to content

MDEV-35397: Fix semisync assertion on slave disconnect/reconnect race - #5578

Open
nadaelsayed11 wants to merge 1 commit into
MariaDB:10.11from
nadaelsayed11:MDEV-35397-remove-slave-reconnect-race-10.11
Open

MDEV-35397: Fix semisync assertion on slave disconnect/reconnect race#5578
nadaelsayed11 wants to merge 1 commit into
MariaDB:10.11from
nadaelsayed11:MDEV-35397-remove-slave-reconnect-race-10.11

Conversation

@nadaelsayed11

Copy link
Copy Markdown
Contributor

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.

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.
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Aug 24, 2026
@gkodinov gkodinov self-assigned this Aug 24, 2026

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! This is a preliminary review.

LGTM. Please stand by for the final review.

@gkodinov
gkodinov requested a review from bnestere August 24, 2026 07:38
@gkodinov gkodinov assigned bnestere and unassigned gkodinov Aug 24, 2026
@gkodinov

Copy link
Copy Markdown
Member

FYI: According to our development cycle we work on bugs In the following periods 15 Mar-30 Apr, 15 Jun-30 Jul, 15 Sep-30 Oct and 15 Dec-31 Jan. So, please, expect to get a review somewhere between these two dates and the goal is to have your PR merged before the second date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants