MariaDB: use SHOW ALL REPLICAS STATUS for multi-channel replication#24178
MariaDB: use SHOW ALL REPLICAS STATUS for multi-channel replication#24178pierreln-dd wants to merge 3 commits into
Conversation
…plication Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 4825cb9 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb83b05b02
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elif is_mariadb and not channel: | ||
| # Without a specific channel, use ALL to return every replication channel. | ||
| # MariaDB uses Connection_name (not Channel_Name) to identify channels. | ||
| return ("SHOW ALL {0}S STATUS".format(base_query.split()[1]), ()) |
There was a problem hiding this comment.
Don't mark replicas OK when only one channel is healthy
When this SHOW ALL ... STATUS query returns multiple MariaDB replication channels, _get_replica_stats stores each channel's Slave_IO_Running/Slave_SQL_Running values under channel:* tags, but _check_replication_status reduces each field with any(...). In a multi-channel setup where one channel is healthy and another is stopped, or IO is healthy on one channel while SQL is healthy on another, the host-level mysql.replication.replica_running service check is reported as OK, hiding the failed channel unless users configure each replication_channel separately.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch on the aggregation behavior. The any() reduction in _check_replication_status (mysql.py:876-878) predates this PR — MySQL's SHOW REPLICA STATUS already returns all channels for multi-source setups and any() was the intentional choice there. This PR makes MariaDB behave the same way MySQL already did.
Changing to all() would be a behavior change for existing MySQL multi-source users who have channels intentionally paused, so I'm leaving the semantics unchanged here. The right long-term fix is per-channel service checks rather than a host-level aggregation — worth a follow-up issue.
…gging test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Validation ReportAll 21 validations passed. Show details
|
What does this PR do?
When
replication_channelis not set on a MariaDB instance, useSHOW ALL REPLICAS STATUS(≥10.5.1) orSHOW ALL SLAVES STATUS(<10.5.1) instead ofSHOW REPLICA STATUS. This returns all channels in a multi-source setup rather than just the default connection.Also handle MariaDB's
Connection_namefield alongside MySQL'sChannel_Namewhen tagging channel metrics.Motivation
MariaDB multi-channel replication was reporting 0 channels. The root cause was that
SHOW REPLICA STATUSon MariaDB only returns the default connection —SHOW ALL REPLICAS STATUSis required to list all channels. Reported in #16766.MariaDB docs: https://mariadb.com/kb/en/show-replica-status/
Existing behavior (unchanged): when
replication_channelis explicitly configured, the check still usesSET @@default_master_connection+SHOW REPLICA STATUSto monitor that specific channel.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged