Repository navigation
mds: introduce standby anti-affinity scoring matrix - #69801
Conversation
22383d5 to
a656a0b
Compare
|
110/344 Test #177: unittest_mds_standby_affinity ............. Passed 0.50 sec |
anthonyeleven
left a comment
There was a problem hiding this comment.
Love the new functionality. I left a few doc nit comments.
89c15c3 to
ef82056
Compare
vshankar
left a comment
There was a problem hiding this comment.
Left some comments, but nothing critical. Nice enhancement to have 👍
| }; | ||
|
|
||
| /* Scenario A: Cross-Tier Prioritization (Same-Host Match vs. Different-Host Other FS). | ||
| * Even though Standby 1 perfectly matches the fscid, it shares a host. |
There was a problem hiding this comment.
I think mds_join_fs should stand higher in terms of standby MDS even if it's in the same host.
There was a problem hiding this comment.
I completely understand that mds_join_fs affinity is critical, and the new Score Matrix actually uses it as the primary guide across separate hosts. We intentionally put host isolation as the highest priority to prevent losing both the active and standby daemons at the exact same time.
If we prioritize mds_join_fs on the same host over a remote vanilla standby, a single hardware failure or an administrative reboot will kill both the active MDS and the standby. This completely defeats the purpose of having a standby and leaves us with a total outage. By keeping physical anti-affinity as the highest priority, we guarantee the standby is actually safe on a separate host. If same-host matching is needed, it still works perfectly as our fallback tier.
Let me know if that makes sense!
| * 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 | ||
| node anti-affinity constraints. An isolated, generic standby daemon (Score 5) will |
There was a problem hiding this comment.
As I commented in the commit that introduces test for this, mds_join_fs should still be chosen over a generic standby in a different host.
There was a problem hiding this comment.
As I've mentioned in the above reply, prioritizing mds_join_fs on the same host over a remote vanilla standby creates a single point of failure during hardware failures or node reboots.
ef82056 to
69e2834
Compare
| class TestStandbyAffinity(CephFSTestCase): | ||
| MDSS_REQUIRED = 3 | ||
|
|
||
| def test_standby_affinity_promotion(self): |
There was a problem hiding this comment.
This test doesn't really test that the chosen standby is from a different host. Isn't that already done in test_failover.py?
There was a problem hiding this comment.
You're right. test_standby_affinity_promotion doesn't check for different hosts. As mentioned in the commit message's "Note on Scope Limitation", simulating distinct physical hosts reliably in teuthology can be tricky. Teuthology environments often spin up on single test nodes and don't guarantee isolated multi-host topologies (correct me if I'm wrong). I've realized this after several failed attempts. Because of that limitation, I've decoupled the host anti-affinity matrix validation and validated it in the unit tests instead. See src/test/mds/TestStandbyAffinity.cc.
You could see ScenarioA_Cross_Tier_Prioritization and ScenarioF_Excluded_Host_Standby_Avoidance in the unit tests specifically validate that a standby on a different host outscores and overrides a same-host standby.
test_standby_affinity.py test is kept there to act as a basic integration smoke test to verify mds_join_fs triggers the correct standby promotion in a live cluster failover.
|
@joscollin - this change is mostly fine apart from the comment that I just posted. I also wanted to propose that we provide an option to disable this functionality (for convenience sake to folks who would rather choose to prefer mds_join_fs above everything else). WDYT? |
That makes sense. Providing an opt-out toggle is a great safeguard for users who want strict |
69e2834 to
53dd062
Compare
c73f38c to
9fae797
Compare
@vshankar |
3d24306 to
27e20f1
Compare
|
jenkins retest this please |
|
jenkins test dashboard |
|
jenkins test dashboard cephadm e2e |
|
jenkins test dashboard |
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]>
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]>
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]>
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]>
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]>
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]>
27e20f1 to
b219b2b
Compare
|
@vshankar rebased. |
|
jenkins test dashboard cephadm e2e |
|
jenkins test dashboard cephadm |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
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.
Fixes: https://tracker.ceph.com/issues/75892
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.