fix(mariadb): galera OrderedReady stop ordering — preserve a safe bootstrap point across Stop/Start#3105
fix(mariadb): galera OrderedReady stop ordering — preserve a safe bootstrap point across Stop/Start#3105weicao wants to merge 1 commit into
Conversation
…bootstrap point KubeBlocks Stop routes through the same instance-alignment deletion loop as scale-in. With podManagementPolicy: Parallel (and the default 100% concurrency) all Galera members are deleted at once: the cluster never shrinks to a last Primary Component member, so no node is granted grastate safe_to_bootstrap=1, and on Start the (correct) fail-closed should_bootstrap refusal leaves the cluster in permanent manual recovery. Observed live: Stop/Start ended with all three PVs at seqno=44 safe_to_bootstrap=0 (a follow-up diagnostic run showed the outcome is timing-variable — sometimes one safe node survives — which makes Parallel strictly worse than deterministic ordering). Switch the Galera component to podManagementPolicy: OrderedReady, the same policy the replication topology already uses: Stop and scale-in delete instances one at a time, highest ordinal first, waiting for each pod to fully terminate; pod-0 shuts down last as the final PC member and records safe_to_bootstrap=1, so the next Start bootstraps automatically. Creation becomes sequential as well, which matches Galera joiner behavior (SST from a donor is effectively serial). Single-variable change for attribution: the existing preStop hook and terminationGracePeriodSeconds are intentionally untouched (tracked separately in #3104 as follow-up). Chart bumped to 1.2.0-alpha.29 for CMPD immutability (versioned CMPD names); alpha.27/28 are skipped because the validation environment already consumed those names on a test lineage. Version-pin contract specs updated accordingly; full mariadb spec suite 663/0/9-pending. Fixes #3104
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3105 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 144 144
Lines 23013 23013
=====================================
Misses 23013 23013 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Runtime validation 完成 — draft 转 readyPR-v1 focused validation 已由 mariadb team(Jack 执行 / Helen 验收)按 exact head Phase A — fresh 3-node Galera create: PASS
Phase B — focused T6 Stop/Start: PASS
Evidence archive sha256 结论边界(验收口径原文): CI 全绿(shellspec-test SUCCESS)。head 无新增代码改动,按验收指示转 ready-for-review(nopick 保持,不自行合并)。 |
Known limitation(Galera remainder run C2 实测,2026-07-08)范围声明不变:本 PR 修复并验证的是正常 Stop/Start 保留安全引导点(focused T6 + full-run T6 双 PASS)。full force-delete 全崩恢复(C2 场景)不属于本 PR 已解决范围,且本轮实测暴露了 OrderedReady 在该场景下的一个重要 caveat: 实测事实(run
诚实的 trade-off 记录:Parallel(改前)下同场景三 pod 并发重建,pod-2 会读到本地 safe=1 直接 bootstrap,大概率自动恢复。即本 PR 用「常规 Stop/Start 的确定性安全」换掉了「全崩恢复时 safe 节点恰在高 ordinal 的自愈能力」(后者在改前也无保证——safe 位置随机)。C2 为首次覆盖,无历史基线。 解决方向(follow-up,见 #3104):
Classification(addon owner 验收口径):Layer 3 known bootstrap boundary with PR #3105 caveat;非 T6 修复回退,PR-v1 focused validation 结论不变。 |
There was a problem hiding this comment.
Finding: The OrderedReady change introduces a user-visible recovery regression for full all-pod force-delete/crash recovery. The PR run galera-remainder-prv1-20260708T0341Z shows safe_to_bootstrap=1 on pod-2, but OrderedReady keeps pod-2 from being recreated while pod-0 CrashLoops with safe_to_bootstrap=0, so the cluster cannot auto recover in that scenario.
|
Thanks, this finding is correct. The C2/full all-pod force-delete behavior is the documented caveat for this PR, not a hidden pass condition. Current owner boundary:
So I agree with the finding. The proposed handling is: keep this PR limited to the Stop/Start determinism fix, carry the C2 limitation explicitly, and close the full-crash recovery gap in #3106 instead of claiming this PR solves it. |
|
Owner direction changed after review discussion: do not merge the current OrderedReady-only version as the final Galera fix. New direction is to keep Galera startup as The existing evidence on this PR remains useful as analysis of the OrderedReady trade-off, but it is no longer the route selected for merge. Follow-up code should preserve |
leon-ape
left a comment
There was a problem hiding this comment.
Finding: Current head still changes Galera podManagementPolicy to OrderedReady, but comment 4911126473 says the OrderedReady-only version is no longer the selected merge route and should not be merged as the final Galera fix.
|
Acknowledged. Current head is intentionally no longer considered mergeable because it still contains the OrderedReady-only change. I am marking the PR back to draft to reflect that state and to prevent accidental merge. We are waiting for the follow-up code direction: keep Galera |
|
Superseded by #3108. Owner direction changed to keep Galera startup as |
|
Closing as superseded by #3108, which is the selected Parallel startup + bounded shutdown route. |
Fixes #3104(根因分析、实测证据 sha、方案 A/B 划分见 issue 及其把关评论)
Scope(单变量)
仅两处行为相关变更:
addons/mariadb/templates/cmpd-galera.yaml:galera 组件podManagementPolicy: Parallel → OrderedReady(replication 拓扑本就是 OrderedReady)。addons/mariadb/Chart.yaml:1.2.0-alpha.26 → 1.2.0-alpha.29(CMPD 名含 chart version,spec 字段变更需新 CMPD;跳过 27/28 因验证环境的测试分支谱系已占用这两个 CMPD 名,避免 immutability 冲突)。随附:4 个版本 pin 契约测试同步到 alpha.29(纯测试维护)。明确不含:preStop 重写、TGP 调整、B 方案(恢复侧 seqno 选举)——均为 #3104 follow-up,避免混变量导致 runtime 结果无法归因。已知遗留:galera-roleprobe 脚本内一处注释仍引用旧 Parallel 语境,行为无关,v2 一并清理。
控制器合同依据(影响面声明)
KubeBlocks Stop 复用 scale-in 的实例对齐删除循环(
pkg/controller/instanceset/reconciler_instance_alignment.go:185-225):Spec.Stop=true→ 期望实例集为空 → 全部现存实例进入删除循环。排序instance_util.go:83-126按序号降序:safe_to_bootstrap=1。实测证据
seqno=44 safe_to_bootstrap=0,wsrep_cluster_size180s 不恢复,pod-0 拒绝 crash-recovery bootstrap。packet sha80f3ab5d...937,pod-0 readOnly 补证 sha9ef59701...af0。9fd0f1b2...584。验证状态
podManagementPolicy: OrderedReady+ CMPD 名mariadb-galera-1.2.0-alpha.29;mariadb 全量 ShellSpec 663 examples / 0 failures / 9 pending(已知)。safe_to_bootstrap=1+ Start 后 3-member Primary 自动恢复;附 cleanup proof。Draft 保持到上述两项 runtime 验证通过。