fix(mariadb): make Galera preStop ordered and DNS-safe#3217
Draft
weicao wants to merge 2 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## helen/mariadb-r18-secondary-marker-stability #3217 +/- ##
============================================================================
Coverage 0.00% 0.00%
============================================================================
Files 154 154
Lines 24331 24409 +78
============================================================================
- Misses 24331 24409 +78 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
leon-ape
marked this pull request as draft
July 20, 2026 02:53
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.
Problems observed
This PR closes two evidence-backed failures in the same Galera native
preStoppath.Succeed, but the data plane stayed failed. Every PVC recordedmysqladmin_shutdown_failed; pod-0 and pod-1 also exhausted the higher-ordinal wait. The hook had consumed the Pod grace budget with SQL andmysqladmin shutdownbefore kubelet could signal mariadbd PID 1.FailedPreStopHookat 11:20:07Z, and pod-0's PVC persistedreason=order_wait_timeoutwith both deleted higher peers markedbudget-exhausted. The hook treated their post-deletion DNS name absence as indefinite uncertainty.The second result means r22 is runtime FAIL/N=1 for preStop validation, despite successful data-plane recovery.
Root cause
galera-prestop.shis a Kubernetes native containerpreStop, not a kbagent lifecycle action. Kubernetes starts the Pod termination grace countdown before the hook and sends TERM to container PID 1 only after the hook returns.The old code had two separate contract violations:
mysqladmin shutdowninside the hook and swallowed failures, delaying kubelet's real TERM;Connection refusedas stopped. Once a deleted higher Pod disappeared from headless-Service DNS,Name or service not known/No address associatedcould never close that peer, so the lower ordinal exhausted the 60-second wait.Primary contracts:
Behavior fix
preStopresponsible only for bounded high-to-low ordering and publishing.galera-shutting-downfor the watcher guard.exec-owned mariadbd PID 1; do not run SQL ormysqladminin the hook.Connection refusedas an immediate closed observation.Name or service not known/No address associated) asabsent, and require the same peer to be absent in two consecutive polls before confirming it stopped.open, transient DNS failure, timeout, generic unreachable, or unknown) and continue fail-closed.1.2.0-alpha.34because the ComponentDefinition runtime contract changed.The Chinese design document was published in the MariaDB team thread before this second code change. It covers the problem, alternatives, core flow, compatibility, and split Dev/Test plan.
TDD and local source validation
First fix:
22 examples / 6 failures.22 / 0.DNS/deleted-peer fix on exact
90434973494b6b8207b287e7ea5bbd2cc3292307:28 examples / 6 failures; failures covered authoritative absence classification, transient classification, two-poll confirmation, uncertain-state reset, and independent peer state.29 / 0.250 / 0 / 6 documented pending.777 / 0 / 9 documented pending.bash -n, ShellCheck error gate, andgit diff --check: PASS.mariadb-1.2.0-alpha.34.tgzSHA25651af67d5c73bf32a8e2957f1faabc4b881d10a45a8a5d62f7b35d7e9a6e2dbac; default render SHA25695890869b273f7d8eba1e29813028a426596f02b3c374971643ea4112246e447.Current boundary
c509f506861d21e88ce16f4498ac08ae3fce7e46.c509f5068runtime result. The r22 scene remains frozen read-only and is not evidence for the new source.FailedPreStopHook, no new persisted degraded record, and the exact Primary/size3/Synced/rows oracle before any runtime-fixed claim.