Run the lost primary scenario for a version written to all OSDs of a
degraded PG, EC 2+2 with one OSD down and EC 3+2 with pg_minsize 4 and
one OSD down, both over an older stable version and as a new object
with no pieces on the missing OSD. The object must end complete or
absent, never incomplete with a lone stable part.
Also run it for a misplaced object: the PG has moved from OSDs 1, 2, 3
to 1, 2, 4 and the unstable version has a piece on OSD 3, outside the
current set. Its holders, OSD 3 included, must go to the history, and
the object must be complete when the primary returns.
Let the EC test helpers take an OSD set and a piece role per OSD.
Since 368daa4b, peering targets an unstable EC version only if it is on
all pg_size roles, while the history check lets a PG activate with
pg_data_size OSDs of a history set. With a higher commit threshold than
that, a peering without some holders of a version rolls it back even if
it is already stabilized on them, and the stable part they bring back
leaves the object incomplete. A primary that stabilizes its own part of
a version written to all OSDs and dies is enough for that.
Target an unstable version from pg_data_size roles again, so the commit
threshold equals the history check. The holders of unstable target
versions are in the PG history now, so instead of committing a version
with no redundancy left after losing a holder, the PG stays inactive
until enough of them are back.
Update the 368daa4b test: a partial chain on pg_data_size roles is now
committed and stabilized, and its holders are in the history.
A flush stabilizes the pieces of an unstable target version one OSD at
a time. If the primary stabilizes its own piece and dies, the others see
the version on fewer roles and may roll it back, leaving a lone stable
piece on the primary.
When the flush is going to stabilize the target version of an object,
add the set of OSDs holding it to the PG history, and make every flush
batch wait until the history is reported with the epoch, like writes
do. A later peering then refuses to activate the PG while fewer than
pg_data_size of them are up, so the version is never decided on without
enough of its holders.
A batch waiting for the report holds a repeer or a stop of the PG like
a write does, and is dropped if the PG is no longer active by then.
A primary stabilizes an EC object version by sending STABILIZE to each
OSD separately, both in a peering flush and after a write with
immediate_commit=all. If it completes its own part and loses its peers
before theirs arrive, the next peering, without it, decides on the
remaining unstable parts alone. If it rolls the version back, the stable
part brought back by the primary is a lone stable part, and the object
stays incomplete.
Run this for a peering flush of a version written to some or all OSDs
of EC 2+1 with pg_minsize 2 and EC 3+2 with pg_minsize 4, and for a
write to a degraded PG of pg_minsize OSDs. The object must be complete
when the primary returns, and the PG must stay active while the primary
is away unless the version reached exactly pg_data_size OSDs. Also lose
one holder after a completed flush, before recovery: the PG must not
activate with the object incomplete, and must activate while the others
hold pg_data_size parts of the version.
The current rule (n_roles >= pg_size) fails EC 2+1 with the version on
all 3 OSDs, EC 3+2 with the version on all 5, and the degraded write to
4 OSDs of EC 3+2.