osd: Put the current OSD set into the PG history when a peering flush reports the epoch #217
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:flush-history-cur-set"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Since #131 the peering flush reports a new epoch itself, so that the holders of the versions it stabilizes are in the PG history first. The write path adds the current OSD set of a degraded PG to the history only when it reports the epoch (
report_epoch(),if (pg.epoch > pg.reporting_epoch)). After a flush has reported it, the first degraded write of the same peering finds the epoch reported and skips that, so the degraded set never reaches the history.Sequence, EC 2+1 with pg_minsize 2, immediate_commit=all: OSD 3 is down, the PG peers on {1,2} and rolls back a leftover unstable version (the flush reports epoch E). A client write goes to OSDs 1 and 2, OSD 1 stabilizes its own part and is lost before OSD 2 stabilizes. The PG peers on {2,3}: the history has {1,2,3} but not {1,2}, so it activates and rolls OSD 2's part back. OSD 1 returns with a lone stable version and the object stays incomplete. Before #131 the write's own epoch report put {1,2} into the history and the PG waited for OSD 1.
The fix reports the epoch from the flush with
report_epoch(), so the current OSD set goes into the history together with the holders, as it would on the first write. The cost: a degraded PG that flushed something but got no write in that peering now also waits for its last OSD set at the next peering, the same as after any single write.Reachable in EC pools whose pg_minsize equals the number of data chunks (N+1 at the default pg_minsize, or N+K with pg_minsize lowered); with K >= 3 at the default pg_minsize only if one more OSD of the write set is down too. Replicated pools write stable versions with immediate_commit=all and are not affected.
Not changed: with auto_scrub on, the state report at the end of peering can carry a new scrub plan and set
reporting_epochbefore the flush or the first write runs; then neither adds the current set. That was already so for writes before #131.Found: by reading the code while checking #131's epoch report against the write path, then reproduced in osd_test; not seen in a run.
Tested: osd_test:
test_degraded_write_primary_lostgets a variant where the peering first rolls back an object on the primary (EC 2+1/pg_minsize 2 and 3+1/pg_minsize 3); without the fix it fails atassert(has_history_set(etcd_pg_history(f), cur_set)), and with the check skipped the PG activates without OSD 1 and the object ends incomplete.test_peering_flush_waiting_batch_repeernow expects the current set in the history. Whole osd_test passes; test_pg_chaos--seeds 1-200with and without--ecpasses before and after.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
koolkhel referenced this pull request2026-12-01 22:33:25 +03:00