Repository navigation
osd/PeeringState: don't clear PG rebuild latch on same-primary interval restart - #70835
Conversation
|
@rzarzynski @ronen-fr Could you please review this bug fix related to PG rebuild stats? Thanks! |
|
@sseshasa - I assume that the fact that clear_primary_state() is called unconditionally is not a problem? |
ronen-fr
left a comment
There was a problem hiding this comment.
LGTM with one minor nit
@ronen-fr The reset of the rebuild start time was earlier being done unconditionally in |
What I meant was: are you losing, when clear_primary_state() is called, any information (not the latch) that is important for determining/calculating the counter times? |
Yes, information related to the number of degraded objects/acting_recovery_backfill/missing_loc is wiped and this was caught during testing. This lead to the logic prematurely concluding that the rebuild is done. This narrow window is now fixed by an additional check to confirm that the PG is in PG_STATE_ACTIVE before considering that the rebuild is complete. The commit description outlines this scenario. Forgot to mention that peering repopulates the wiped information eventually. |
…al restart clear_primary_state() unconditionally reset the rebuild-time latch (rebuild_start_time, rebuild_base_recovered, rebuild_had_redundancy_loss), and it runs on every start_peering_interval() call, including routine acting-set churn (e.g. a backfill peer joining or leaving) that leaves the primary OSD unchanged. On a PG that stays degraded/recovering across several such interval restarts under the same primary, the latch was wiped before prepare_stats_for_publish() ever reached the "recovered" branch, so pg_rebuild_duration/max_secs/min_secs stayed at 0 despite a real, ongoing rebuild. Also, a publish landing in a narrow window involving a peering-interval restart, where clear_primary_state() wipes acting_recovery_backfill/missing_loc before peering repopulates them, sees num_objects_degraded == 0 and no DEGRADED/UNDERSIZED bit set. Publish stats can in this situation prematurely conclude that a recovery is complete. This can truncate the PG rebuild duration incorrectly. This is fixed by requiring the PG state to be PG_STATE_ACTIVE to filter out that transient situation. Only clear the latch in start_peering_interval() when the primary role actually changes across the transition (!(was_old_primary && is_primary())). A genuine primary -> replica handover (or vice versa) still discards the latch, since a stale start time must not be reused across a role change. Tests: - Add a new unit test that reproduces the latch already set + interval restart + primary unchanged condition and confirms that the in-progress latch time is not cleared. - Harden an existing standalone test to deterministically reproduce the exact bug sequence instead of leaving it to timing. The previous version only asserted pg_rebuild_duration.avgcount>=1 and sum>0 after a full recovery cycle. Those checks pass even under the clear_primary_state() latch bug Fixes: https://tracker.ceph.com/issues/79028 Signed-off-by: Sridhar Seshasayee <[email protected]>
ad4e7ea to
6dcdaa0
Compare
|
jenkins test make check |
|
jenkins test make check arm64 |
…rebuild-stats solution pg_rebuild_duration's avgtime (sum/avgcount) is sufficient on its own for the durability-score use case these counters were added for; the max/min-seconds counters are just supplementary statistics, not required for that calculation. Since recoverystate_perf is a single OSD-wide PerfCounters object shared by every PG shard, and the max/min update logic used a caller-side get()+compare+set() sequence that is not atomic as a whole (unlike tinc()'s true atomic accumulation for sum/avgcount), so concurrently recording PGs could race and silently lose an update to these min/max counters. These can be fixed, but is deferred until the full solution. Remove rs_pg_rebuild_max_secs/rs_pg_rebuild_min_secs (enum entries and registration), the counter updates in prepare_stats_for_publish(), and the corresponding assertions in TestPeeringState.cc. Only rs_pg_rebuild_duration remains. Fixes: https://tracker.ceph.com/issues/79028 Signed-off-by: Sridhar Seshasayee <[email protected]>
|
LGTM (even after the last commit was added) |
|
jenkins test api |
|
jenkins test windows |
|
jenkins test make check arm64 |
|
This PR has been added to wip-bharath7-testing-20260807.105153-main. |
Teuthology Test Resultshttps://pulpito.ceph.com/sseshasa-2026-08-07_09:41:41-rados-wip-sseshasa-pg-rebuild-stats-testing-2026-08-06-distro-default-trial/ Failures, unrelated:
Additional Tests - Recovery/Backfill to Validate PerfcountersRecovery/backfill tests were performed on a node with 8 OSDs and with EC4+2 profile and the results of that test is discussed here: https://tracker.ceph.com/issues/79028#note-3 |
|
jenkins test API |
|
jenkins test windows |
|
jenkins test make check |
|
jenkins test make check arm64 |
|
@sseshasa feel free to merge if this is QA approved (scrub note) |
|
Merging based on the tests performed on a single node(see https://tracker.ceph.com/issues/79028#note-3) with 8 OSDs and the teuthology results mentioned in my previous comment. |
clear_primary_state()unconditionally reset the rebuild-time latch (rebuild_start_time, rebuild_base_recovered, rebuild_had_redundancy_loss), and it runs on everystart_peering_interval()call, including routine acting-set churn (e.g. a backfill peer joining or leaving) that leaves the primary OSD unchanged. On a PG that stays degraded/recovering across several such interval restarts under the same primary, the latch was wiped beforeprepare_stats_for_publish()ever reached the "recovered" branch, so pg_rebuild_duration/max_secs/min_secs stayed at 0 despite a real, ongoing rebuild.Also, a publish landing in a narrow window involving a peering-interval restart, where
clear_primary_state()wipes acting_recovery_backfill/missing_loc before peering repopulates them, seesnum_objects_degraded == 0and no DEGRADED/UNDERSIZED bit set. Publish stats can in this situation prematurely conclude that a recovery is complete. This can truncate the PG rebuild duration incorrectly. This is fixed by requiring the PG state to bePG_STATE_ACTIVEto filter out that transient situation.Only clear the latch in
start_peering_interval()when the primary role actually changes across the transition(!(was_old_primary && is_primary())). A genuine primary -> replica handover (or vice versa) still discards the latch, since a stale start time must not be reused across a role change.Also, drop pg_rebuild_max_secs/min_secs from the interim rebuild-stats solution. See commits for more detail. pg_rebuild_duration's avgtime (sum/avgcount) is sufficient on its own to calculate the durability scores.
Tests:
Fixes: https://tracker.ceph.com/issues/79028
Signed-off-by: Sridhar Seshasayee [email protected]
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.