Skip to content

chore(mariadb): consolidate replication cmpds into single canonical cmpd#2933

Merged
leon-ape merged 4 commits into
mainfrom
refactor/mariadb-cmpd-consolidation
Jul 1, 2026
Merged

chore(mariadb): consolidate replication cmpds into single canonical cmpd#2933
leon-ape merged 4 commits into
mainfrom
refactor/mariadb-cmpd-consolidation

Conversation

@weicao

@weicao weicao commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

MariaDB previously shipped three separate replication ComponentDefinitions:

  • cmpd-replication.yaml - async-only (legacy, ~1029 lines)
  • cmpd-semisync.yaml - semisync-only (~2634 lines)
  • cmpd-replication-merged.yaml - unified async+semisync (~3097 lines)

The merged CMPD already supersedes the other two, supporting both async and semisync modes in a single definition. Keeping all three causes:

  1. Near-complete code duplication - semisync and merged share ~95% identical inline scripts
  2. Orphaned ParametersDefinitions - old PDs bind to CmpDs no longer referenced by ClusterDefinition
  3. Maintenance burden - every script fix must be applied in 3 places

This PR consolidates to a single canonical replication CmpD and bumps the chart version to 1.2.0-alpha.26 so existing 1.2.0-alpha.25 ComponentDefinitions are not mutated in place during addon upgrade.

Changes

File Change
cmpd-replication.yaml Replaced: old async-only -> renamed from merged (unified async+semisync)
cmpd-replication-merged.yaml Deleted (content moved to cmpd-replication.yaml)
cmpd-semisync.yaml Deleted
_helpers.tpl Removed semisync.cmpdName, replication.merged.cmpdName; widened replication regex
paramsdef.yaml Removed old PDs; renamed merged PD to mariadb-replication-pd
cmpv.yaml Removed semisync and merged ComponentVersion entries
clusterdefinition.yaml Changed compDef reference to mariadb.replication.cmpdName
backuppolicytemplate.yaml Simplified topology list
Chart.yaml Bumped chart version to 1.2.0-alpha.26 for versioned CmpD names

Validation status

  • shellspec-test is green on head bfc2aa23.
  • Addon upgrade gate: baseline main 513066bb / chart 1.2.0-alpha.25 fresh install upgraded to this PR's 1.2.0-alpha.26 chart without mutating old *-1.2.0-alpha.25 CmpDs.
  • New 1.2.0-alpha.26 CmpDs became Available for standalone, galera, and replication-merged.
  • New async replication topology points to mariadb-replication-merged-1.2.0-alpha.26; old async topology still points to the old alpha.25 CmpD.
  • Async runtime regression T1-T7 passed on this head. T8 was interrupted by a 30-minute tool timeout and is not counted as product PASS.
  • Semisync provision and service connectivity on this exact head: fresh semisync cluster reached Running, semisync status converged to master=ON/slave=ON, write succeeded, and secondary read verified the row.
  • Scale-out/scale-in on this exact head: 2->3 OpsRequest Succeed with copied existing data; 3->2 OpsRequest Succeed with remaining nodes preserving the 2-row dataset.
  • Switchover on this exact head: OpsRequest Succeed and primary moved from pod-0 to pod-1.
  • Reconfigure on this exact head: max_connections=300 OpsRequest Succeed and both pods reported 300 after bounded polling.

Evidence:

  • Upgrade / CmpD immutability gate: /tmp/mariadb-2933-v26-upgrade-evidence.tar.gz, sha256 57d41a6884692a9fa3dab54fd262aad61a75640111a79c18904928fe92bff195.
  • Runtime gap closure fresh run PID 36170: /tmp/mariadb-2933-gaps-v2-36170.tar.gz, sha256 7378afec9d89458741d7b9be80ca93023203cfe4ea87a0036551d3f1e7f48d0a.
  • First semisync snapshot follow-up evidence: /tmp/mariadb-2933-gaps-61289.tar.gz, sha256 0f0bdd9e50129e50841f027f184cab13faee327953994cf46916caeffab3e330. This bounded observation showed the secondary semisync status converged to ON within the first 30-second poll and stayed ON for 20 samples; the initial failure was a test-helper expectation issue, not counted as product failure.

Conclusion boundary: this is PR/head scoped validation for the listed completed items only. It is not release-ready evidence.

@leon-ape leon-ape 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.

This PR reuses the existing mariadb-replication-* ComponentDefinition name for the merged replication spec. The previous chart kept the merged spec under mariadb-replication-merged-* specifically because changing the existing CmpD spec under the same name is an immutable ComponentDefinition mutation during addon upgrade.\n\nThe ShellSpec suite still references the deleted cmpd-semisync.yaml and cmpd-replication-merged.yaml templates, so the PR currently removes the files while leaving their contract tests pointing at missing paths.

…l CmpD

Delete the old async-only cmpd-replication.yaml and semisync-only
cmpd-semisync.yaml, then rename the merged CmpD
(cmpd-replication-merged.yaml) to cmpd-replication.yaml. This makes
`mariadb-replication-{ChartVersion}` the single canonical replication
CmpD name supporting both async and semisync modes via the
replicationMode parameter.

Updates across all referencing files:
- _helpers.tpl: remove semisync/merged CmpD name helpers and regex
  patterns; simplify replication regex from `^mariadb-replication-[0-9]`
  to `^mariadb-replication-`
- paramsdef.yaml: collapse three PDs (replication, semisync, merged)
  into one `mariadb-replication-pd`
- cmpv.yaml: remove semisync and merged compDef patterns from
  compatibility rules
- clusterdefinition.yaml: point replication topology at
  `mariadb.replication.cmpdName` helper
- backuppolicytemplate.yaml: update topology list comment
@weicao weicao force-pushed the refactor/mariadb-cmpd-consolidation branch from 5f3ae5c to e0c9a88 Compare June 25, 2026 07:59
Update test file references from deleted cmpd-semisync.yaml and
cmpd-replication-merged.yaml to consolidated cmpd-replication.yaml.
Remove obsolete structural tests for old 3-CMPD architecture.
Restore memberJoin/memberLeave lifecycle actions dropped during
consolidation rewrite.
@codecov-commenter

codecov-commenter commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (d93ad4d) to head (bfc2aa2).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...adb/scripts-ut-spec/replication_switchover_spec.sh 0.00% 43 Missing ⚠️
...ripts-ut-spec/replication_user_convergence_spec.sh 0.00% 13 Missing ⚠️
...ts-ut-spec/seed_replication_mode_overrides_spec.sh 0.00% 5 Missing ⚠️
...cripts-ut-spec/reconcile_runtime_overrides_spec.sh 0.00% 4 Missing ⚠️
...ipts-ut-spec/reconfigure_persisted_alpha86_spec.sh 0.00% 4 Missing ⚠️
...plication_merged_replication_mode_env_wire_spec.sh 0.00% 3 Missing ⚠️
...s/mariadb/scripts-ut-spec/backup_actionset_spec.sh 0.00% 2 Missing ⚠️
.../replication_merged_configspec_consistency_spec.sh 0.00% 2 Missing ⚠️
...plication_merged_semisync_startup_recovery_spec.sh 0.00% 2 Missing ⚠️
...pts-ut-spec/semisync_rejoin_fence_template_spec.sh 0.00% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #2933    +/-   ##
======================================
  Coverage   0.00%   0.00%            
======================================
  Files        139     138     -1     
  Lines      22538   22413   -125     
======================================
+ Misses     22538   22413   -125     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@weicao weicao added the nopick Not auto cherry-pick when PR merged label Jun 25, 2026
@leon-ape

Copy link
Copy Markdown
Contributor

Current head still folds the merged replication spec into mariadb-replication-{{ .Chart.Version }} while keeping chart version 1.2.0-alpha.25. That reuses the existing ComponentDefinition name for a different spec, so addon upgrade would mutate an existing CmpD spec under the same name.

@weicao weicao force-pushed the refactor/mariadb-cmpd-consolidation branch from d9603d0 to 7803afb Compare June 29, 2026 15:00

@leon-ape leon-ape 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.

This PR changes the canonical replication CmpD runtime surface by adding memberJoin/memberLeave and deleting the old replication/semisync CmpDs, but the PR only has static Helm/ShellSpec/CI evidence; the provision, service connectivity, scale-out, switchover, and reconfigure validation items in the PR body are still unchecked.

@leon-ape leon-ape 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.

LGTM

@leon-ape leon-ape changed the title refactor(mariadb): consolidate replication CMPDs into single canonical CmpD chore(mariadb): consolidate replication cmpds into single canonical cmpd Jul 1, 2026
@leon-ape leon-ape merged commit 9943142 into main Jul 1, 2026
18 checks passed
@leon-ape leon-ape deleted the refactor/mariadb-cmpd-consolidation branch July 1, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nopick Not auto cherry-pick when PR merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants