osd: Move the PG epoch only when reporting it for the first modification #219
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:peering-flush-stale-release"
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
A history report that only changes next_scrub or clears the history (plan_scrub, the end of a scrub, the cleanup of a clean or left_on_dead PG) also wrote pg.epoch and set reporting_epoch to it. If the PG re-peered before that report landed, the new peering took the same epoch (it starts from reported_epoch), report_epoch() saw it as already being reported, and the old report, without the new peering's OSD sets, released its flush. The flush then stabilized versions whose holders were not in the history. If the stabilized OSD is then lost, the next peering can activate without it and roll the other parts back, leaving a lone stable part.
As discussed: a new epoch is needed only for the first modification. Only report_epoch(), which runs before the first write or flush of an epoch, now writes the new epoch and moves reporting_epoch. Other history updates write the epoch etcd already has, or the one report_epoch() has in flight, so they can't release a flush of a newer peering.
The OSD sets and all_peers are written as the PG has them. For the two cleanups that is their purpose. For a next_scrub update they may already include the sets of a newer peering whose epoch is not reported yet: that only adds possible holders under the old epoch and releases nothing. Keeping them exactly as in etcd would need a per-PG copy of the last written history; I can add it if you prefer.
The two-primary case from the first version of this PR is dropped: that one is for PG locks.
Found: by reading the code, then reproduced in osd_test; not seen in a run. It needs a history-only report still in flight when the PG re-peers, i.e. etcd slower than a peer reconnect.
Tested:
test_peering_flush_same_epoch_repeer(EC 2+2, auto_scrub). Without the fix the scrub report releases the flush before OSDs 3 and 4 are in the history, and the PG then activates without OSD 3 (osd_test.cpp:Assertion '!early && !active_without && r.active && !r.incomplete'). Whole osd_test passes with the fix.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
c6f3c72aa3toe30b0dafd5osd: Resume ops waiting for the PG epoch only if etcd has our OSD setsto osd: Move the PG epoch only when reporting it for the first modification