Repository navigation
tentacle: mds: introduce standby anti-affinity scoring matrix - #73569
anthonyeleven wants to merge 8 commits into
Conversation
Signed-off-by: Ville Ojamo <[email protected]> (cherry picked from commit 4766f3b) Conflicts: doc/cephfs/standby.rst - took only this file, the one the next commits change, so that it matches main's wording; the rest of this commit is not part of this backport
In the past, standby selection did not account for failure domains, allowing a standby daemon to be assigned or promoted on the exact same physical host as the active daemon it was intended to back up. This commit introduces a score-based anti-affinity matrix to FSMap and updates MDSMonitor allocation loops to pass target addresses. This strictly prioritizes remote standbys (different host) over same-host standbys for both active replacements and standby-replay assignments to maximize failure domain isolation. The logic handles hot updates and cold crash recoveries by enforcing anti-affinity. Additionally, this introduces the `standby_enable_host_anti_affinity` per-filesystem setting (managed via `ceph fs set`, default: true) to allow users to explicitly toggle this behavior. When set to `false`, the selection algorithm bypasses the host isolation checks, scoring all standbys in the `SCORE_PREF_*` tier. This effectively restores the legacy behavior where strict `mds_join_fs` preferences win unconditionally, regardless of physical placement. Fixes: https://tracker.ceph.com/issues/75892 Signed-off-by: Jos Collin <[email protected]> (cherry picked from commit 7d937a7)
Introduce a dedicated test in src/test/mds/TestStandbyAffinity.cc to directly validate the score-based selection matrix inside FSMap. The test case evaluates three core topology distribution scenarios: 1. Cross-tier prioritization: Ensuring a remote vanilla standby outscores an explicit FSCID match residing on the same host. 2. Short-circuit optimization: Confirming immediate selection when a perfect candidate (matching FSCID + different host) is found. 3. Fallback graceful degradation: Verifying that standard affinity preferences are preserved if all available standbys share the active daemon's host. 4. Multi-active avoidance: Proving the matrix correctly avoids an array of multiple hosts when a filesystem has multiple active ranks. 5. Deterministic tie-breaking: Ensuring the algorithm safely and predictably selects a winner when multiple remote candidates share the exact same maximum score. 6. Excluded host standby avoidance: Verifying that the host penalty is correctly applied to override a filesystem match when a standby resides on an excluded host, safely promoting a clean vanilla candidate. 7. Feature flag disabled: Validating that disabling the filesystem's 'standby_enable_host_anti_affinity' MDSMap flag successfully bypasses host penalties and restores legacy scoring logic. Fixes: https://tracker.ceph.com/issues/75892 Signed-off-by: Jos Collin <[email protected]> (cherry picked from commit e9f5cd4)
Introduce a functional integration test to validate the end-to-end configuration and wire communication pipeline for MDS standby affinity during a live failover. test_standby_affinity_promotion: Forces a failover scenario to ensure that an operator's 'mds_join_fs' configuration safely propagates from a live daemon's beacon to the MDSMonitor, correctly resulting in the priority promotion of a preferred standby over a generic vanilla option. Additionally, this updates the CephFS QA framework (filesystem.py) to explicitly disable `standby_enable_host_anti_affinity` by default when creating test filesystems. Because Teuthology densely packs MDS daemons onto limited nodes, legacy failover tests will timeout if hardware anti-affinity is strictly enforced. However, the feature is now safely opted-into for this specific test suite via a YAML override in `tasks/standby-affinity.yaml`. Scope Limitation: This QA test is intentionally scoped as a basic integration smoke test to verify the configuration plumbing and daemon-to-monitor protocol. Because teuthology environments typically spin up on single test nodes or do not guarantee isolated multi-host topologies, fine-grained scoring matrix scenarios (such as the host anti-affinity subtraction loops where active_addrs is evaluated) are decoupled and validated via unit test cases in src/test/mds/TestStandbyAffinity.cc instead. Fixes: https://tracker.ceph.com/issues/75892 Signed-off-by: Jos Collin <[email protected]> (cherry picked from commit 1720ae0)
Update the file system affinity documentation to accurately detail the multi-tiered scoring engine used by the Monitors during failover. Explicitly documents the priority scoring matrix (Scores 1 through 6) and clarifies how the selection engine balances software-defined 'mds_join_fs' configurations against physical host anti-affinity rules. This includes the 'standby_enable_host_anti_affinity' per-filesystem toggle (configured via 'ceph fs set') that allows operators to opt-out of host penalties. Additionally, define the behavioral distinctions across the three core anti-affinity rules: Hot Takeovers, Stale/Purged Topology Recovery, and Cross-FS Failover Restrictions. Updated the PendingReleaseNotes highlighting the new tiered scoring matrix and the per-filesystem configuration toggle used during standby promotion cycles. Fixes: https://tracker.ceph.com/issues/75892 Signed-off-by: Jos Collin <[email protected]> (cherry picked from commit 6762adc) Conflicts: PendingReleaseNotes - the pick also brought in entries that are only on main; kept only this one
The recent introduction of the 'standby_enable_host_anti_affinity' per-filesystem setting added a new boolean field to the MDSMap JSON dump. This commit updates the __mdsmap_schema in test_health.py to expect this new 'standby_enable_host_anti_affinity' key, resolving the dashboard API validation failure in the CI. Fixes: https://tracker.ceph.com/issues/75892 Signed-off-by: Jos Collin <[email protected]> (cherry picked from commit 8ba34b8)
This commit fixes a long-standing race condition in test_failover.py. Previously, the test would update the mds_join_fs configuration for a standby daemon and immediately force an MDS rank failure. This created a timing window where the MDSMonitor could evaluate standby candidates using stale configuration data. Historically, this race was masked by the legacy fallback tie-breaker logic, which often coincidentally promoted the correct daemon. However, with stricter, deterministic tie-breaking, this missing synchronization barrier caused unexpected promotion failures. By adding `self._reach_target(target)` before `self.fs.rank_fail()`, we establish a proper synchronization barrier. This guarantees that the Monitor has fully processed the configuration update before the failover event is triggered, ensuring test determinism and eliminating flakiness. Signed-off-by: Jos Collin <[email protected]> (cherry picked from commit b219b2b)
|
/audit override |
|
✅ Audit Override Applied by @anthonyeleven. |
The standby host anti-affinity backported from main changes how the monitors pick a standby, so on this release it is off by default and a cluster opts in per file system with: ceph fs set <fs_name> standby_enable_host_anti_affinity true A cluster upgrading from a release without the flag decodes it as false and keeps its existing standby selection. The unit test fixture now enables the flag, since every scenario except the flag-disabled one tests the enabled behavior. The release note and the standby docs now describe the flag as off by default. This commit is specific to the backport: on main the flag defaults to true. Agreed on https://tracker.ceph.com/issues/75892. Fixes: https://tracker.ceph.com/issues/82050 Signed-off-by: Anthony D'Atri <[email protected]> Assisted-by: Claude Opus 5.5
|
@joscollin As agreed on https://tracker.ceph.com/issues/75892, 899f9b5 makes |
|
New commits were pushed to this PR, so the previous override has been removed. |
There was a problem hiding this comment.
Ceph Release Engineering Audit Report
Automated Redmine Linkage Audit
The following tracking irregularities were found:
- Orphaned Main PR: Could not find a Redmine tracker for
mainPR #67853. Please create a ticket, set its 'Pull Request ID', populate the 'Backport' field, and ensure it is in the 'Pending Backport' state.
Automated Backport Parity Review - Invalid Commit Format
The following commits have an invalid format. Backport commits must either include a standard (cherry picked from commit ...) line or start with the target branch name (e.g., tentacle:).
899f9b51mds: disable standby host anti-affinity by default on tentacle
Be familiar with the rules and guidelines for writing backports.
Automated Backport Parity Review
Discrepancies detected between the backport PR and the original source PR(s). Please see the Commit Parity Visualizer below.
Commit Parity Visualizer
| BACKPORT PR #73569 | SOURCE PR |
SOURCE STATUS |
|---|---|---|
| e2b1fae doc/cephfs: Fix spelling etc errors | PR #67853 | 4766f3b doc/cephfs: Fix spelling etc errors |
| fd8682d mds: introduce host anti-affinity for standby selection | PR #69801 | 7d937a7 mds: introduce host anti-affinity for standby selection |
| 576be05 src/test: add unit tests for standby anti-affinity selection | e9f5cd4 src/test: add unit tests for standby anti-affinity selection | |
| 9961c44 qa: add teuthology suite for mds standby affinity | 1720ae0 qa: add teuthology suite for mds standby affinity | |
| 52ff09f doc: document MDS standby promotion scoring matrix and anti-affinity | 6762adc doc: document MDS standby promotion scoring matrix and anti-affinity | |
| 4a75130 qa/dashboard: update mdsmap schema for standby anti-affinity | 8ba34b8 qa/dashboard: update mdsmap schema for standby anti-affinity | |
| 1fc8451 qa/tasks/cephfs: fix race condition in TestClusterAffinity | b219b2b qa/tasks/cephfs: fix race condition in TestClusterAffinity | |
| 899f9b5 mds: disable standby host anti-affinity by default on tentacle | <<<< EXTRA IN BACKPORT >>>> |
Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations
A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
This does not necessarily indicate an issue but a maintainer should review.
**Click to expand conflict summaries.**
Deviation in Backport e2b1fae (cherry-pick of 4766f3b)
Affected File(s)
doc/cephfs/cephfs-mirroring.rstdoc/cephfs/charmap.rstdoc/cephfs/disaster-recovery-experts.rstdoc/cephfs/fs-volumes.rstdoc/cephfs/fscrypt.rstdoc/cephfs/scrub.rst
Range Diff
Click to expand
--- Original (4766f3b3)
+++ Backport (e2b1fae2)
@@ -1,3 +1,10 @@
doc/cephfs: Fix spelling etc errors
Signed-off-by: Ville Ojamo <[email protected]>
+(cherry picked from commit 4766f3b331e64935994042b64b414f52665a6b62)
+
+Conflicts:
+ doc/cephfs/standby.rst
+ - took only this file, the one the next commits change, so that it
+ matches main's wording; the rest of this commit is not part of
+ this backport
================================================================================
RANGE DIFF
================================================================================
1: 4766f3b331e < -: ----------- doc/cephfs: Fix spelling etc errors
-: ----------- > 1: e2b1fae2f80 doc/cephfs: Fix spelling etc errorsDeviation in Backport 52ff09f (cherry-pick of 6762adc)
Affected File(s)
PendingReleaseNotes
Range Diff
Click to expand
--- Original (6762adce)
+++ Backport (52ff09f8)
@@ -20,3 +20,9 @@
Fixes: https://tracker.ceph.com/issues/75892
Signed-off-by: Jos Collin <[email protected]>
+(cherry picked from commit 6762adce863196cdbcd24ea0b8f4055e8947db83)
+
+Conflicts:
+ PendingReleaseNotes
+ - the pick also brought in entries that are only on main; kept only
+ this one
================================================================================
RANGE DIFF
================================================================================
1: 6762adce863 ! 1: 52ff09f81de doc: document MDS standby promotion scoring matrix and anti-affinity
@@ Commit message
Fixes: https://tracker.ceph.com/issues/75892
Signed-off-by: Jos Collin <[email protected]>
+ (cherry picked from commit 6762adce863196cdbcd24ea0b8f4055e8947db83)
+
+ Conflicts:
+ PendingReleaseNotes
+ - the pick also brought in entries that are only on main; kept only
+ this one
## PendingReleaseNotes ##
@@
- re-execs under GNU bash >= 4 when the system bash is too old, and honors a
- ``$GETOPT`` environment override so GNU getopt can be selected
- (``brew install bash gnu-getopt``).
+ ``cpu_isa_level`` host fact (e.g. ``x86-64-v2``). The check can be disabled
+ with ``ceph config set mgr mgr/cephadm/upgrade_cpu_isa_check false``, e.g.
+ when running custom-built images targeting an older CPU generation.
+* CephFS: Added a multi-tiered scoring matrix to the MDS Monitor to dynamically
+ prioritize standby promotion during failover events. The `mds_join_fs` configuration
+ variable is now checked in combination with infrastructure topology rules to enforce
@@ PendingReleaseNotes
+ `ceph fs set <fs_name> standby_enable_host_anti_affinity false` (default: true)
+ to restore legacy strict 'mds_join_fs' prioritization.
- * CephFS: New MDS configuration options for non-blocking dirfrag prefetch have
- been added. ``mds_dir_prefetch_backend``, when enabled with
+ * RADOS: PG autoscaler allows overlapping roots. Each root receives a PG target based
+ on its OSDs, with OSDs shared across multiple roots contributing proportionally
## doc/cephfs/standby.rst ##
@@ doc/cephfs/standby.rst: standby on modest or over-provisioned systems. To configure this preference,How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
|
/audit override |
|
✅ Audit Override Applied by @anthonyeleven. |
joscollin
left a comment
There was a problem hiding this comment.
The changes looks good. Please take it through QA and merge. Thanks @anthonyeleven
|
This PR has been added to wip-bharath31-testing-20261114.234838-tentacle. |
|
Thank you. Tracker had been idle for 7 months. The community benefits from these backports. |
|
jenkins test dashboard cephadm |
1 similar comment
|
jenkins test dashboard cephadm |
|
jenkins test dashboard cephadm |
backport tracker: https://tracker.ceph.com/issues/82050
backport of #69801
parent tracker: https://tracker.ceph.com/issues/75892
also includes the commit from #67853 (doc/cephfs: Fix spelling etc errors), which has no tracker. The doc commit from #69801 conflicts in doc/cephfs/standby.rst without it. The #67853 cherry-pick needed conflict resolution in 6 doc/cephfs files where tentacle's text differs from main, and the #69801 doc commit needed it in PendingReleaseNotes.
This PR introduces a multi-tiered standby selection scoring matrix to the MDS Monitor to dynamically prioritise anti-affinity over software rules, protecting the cluster's failure domains.
Score-Based Selection Matrix: Implements a graded scoring matrix (Scores 1 to 6) across FSMap and MDSMonitor, that ensures both primary replacements and standby-replay followers are strictly barred from co-locating on the same physical host as an active or failing rank. This ensures different-host standbys strictly outrank same-host candidates.
Testing Coverage: Adds a dedicated unit tests verifying 6 distinct cases alongside a python functional QA task verifying live orchestration (with a scope limitation).
Documentation: Updates PendingReleaseNotes and standby.rst to accurately map out the new selection grid, score tiers, and state recovery behaviours.
Cherry-pick of the 6 commits, with the same line changes as on main, after one more pick:
doc/cephfs/standby.rstchanges, which capitalize "Monitors" as main does. With it, the doc commit picks cleanly, andstandby.rstends up identical to main's after this PR. The rest of doc/cephfs: Fix spelling etc errors #67853, which was never backported, is not included. Its Conflicts block says so, and the Backport Audit will need an override for it.Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.