Skip to content

MDEV-41014 START SLAVE zeroes Rpl_semi_sync_slave_send_ack - #5753

Open
FarihaIS wants to merge 1 commit into
MariaDB:11.4from
FarihaIS:mdev-41014
Open

FarihaIS wants to merge 1 commit into
MariaDB:11.4from
FarihaIS:mdev-41014

Conversation

@FarihaIS

Copy link
Copy Markdown
Contributor

Description

START SLAVE zeroed the global Rpl_semi_sync_slave_send_ack status variable even when another multi-source connection was already active and had accumulated ACKs.

Rpl_semi_sync_slave_send_ack is a single global counter, but slave_start() runs once per master connection and resets it to 0 unconditionally. With multi-source replication, starting one connection's I/O thread wiped the ACKs already counted by other still-running connections.

Remove the reset from slave_start(). Like every other semi-sync status counter, this variable is now cumulative and no longer cleared when an individual connection's I/O thread starts.

Add a test to suite/rpl.

Release Notes

N/A

How can this PR be tested?

Execute the rpl suite in mysql-test-run.

This commit adds rpl.rpl_semi_sync_slave_send_ack, which sets up a slave with two master connections ('' and other), lets the '' connection send semi-sync ACKs, then starts the other connection's I/O thread and checks that the counter is preserved.

Before the fix

Running rpl.rpl_semi_sync_slave_send_ack fails as below:

rpl.rpl_semi_sync_slave_send_ack         [ fail ]
        Test ended at 2026-09-23 23:14:18

CURRENT_TEST: rpl.rpl_semi_sync_slave_send_ack
--- /quick-rebuilds/mariadb-server/mysql-test/suite/rpl/r/rpl_semi_sync_slave_send_ack.result       2026-09-23 23:13:52.965758407 +0000
+++ /quick-rebuilds/mariadb-server/mysql-test/suite/rpl/r/rpl_semi_sync_slave_send_ack.reject       2026-09-23 23:14:18.766451533 +0000
@@ -30,7 +30,7 @@
 include/wait_for_slave_io_to_start.inc
 SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack';
 Variable_name  Value
-Rpl_semi_sync_slave_send_ack   2
+Rpl_semi_sync_slave_send_ack   0
 include/stop_slave_io.inc
 RESET SLAVE ALL;
 SET @@SESSION.default_master_connection= '';

Result content mismatch

After the fix

Running rpl.rpl_semi_sync_slave_send_ack succeeds:

rpl.rpl_semi_sync_slave_send_ack         [ pass ]    464
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.464 of 2 seconds executing testcases

Completed: All 1 tests were successful.

Basing the PR against the correct MariaDB version

  • This is a bug fix, and the PR is based against the earliest maintained branch on which the bug can be reproduced: 11.4.

Copyright

All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.

Rpl_semi_sync_slave_send_ack is a single global counter, but
slave_start() runs once per master connection and resets it to 0
unconditionally. With multi-source replication, starting one
connection's I/O thread wiped the ACKs already counted by other
still-running connections.

Remove the reset from slave_start(). Like every other semi-sync status
counter, this variable is now cumulative and no longer cleared when an
individual connection's I/O thread starts.

Add a test to suite/rpl.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Sep 24, 2026
@FarihaIS
FarihaIS marked this pull request as ready for review September 24, 2026 16:52
@gkodinov gkodinov self-assigned this Sep 25, 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 September 25, 2026 08:24
@gkodinov gkodinov assigned bnestere and unassigned gkodinov Sep 25, 2026

@bnestere bnestere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @FarihaIS !

Thank you for submitting this patch, though I'm not so sure we want to do this. Where the original report is a bug, this change makes it so the counter will never reset on a slave restart. I imagine the overall fix for this will be more akin to MDEV-40941, which will likely move many of these semi-sync counters/variables to be per-channel rather than global.

But with that said, semi-sync replication has much deeper & more important problems to fix (which are unfortunately not beginner friendly).

@ParadoxV5 do you have any thoughts here? I lean towards leaving this as-is in GA (I don't imagine many people encounter it, as no other users have reported this).

@ParadoxV5

Copy link
Copy Markdown
Contributor

Thank you for submitting this patch, though I'm not so sure we want to do this. Where the original report is a bug, this change makes it so the counter will never reset on a slave restart.

Yeah, if Rpl_semi_sync_slave_send_ack is defined to be a lifetime counter, then never resetting it makes sense; but it clearly was de facto defined to reset each START SLAVE.

I imagine the overall fix for this will be more akin to MDEV-40941, which will likely move many of these semi-sync counters/variables to be per-channel rather than global.

Yeah, this has the same situation as in #5615 (comment).

I wonder if there’s a creative compromise for maintenance versions.
What’s our clarification on “semi-sync status variables do not support multi-source”?

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.

4 participants