Peering left older pieces on their target OSDs out of the object state,
so an incomplete EC object with its newest version on one OSD only was
tracked with that piece alone. When vitastor-cli fix --check no removed
it, scrub found nothing and forgot the object: reads returned zeros in
place of the removed piece, and a write made them permanent, although
the previous version was still readable from the other OSDs.
List every OSD holding any version of the object in its state, once per
role. When scrub finds no piece of the target version but outdated
pieces are left, ask their OSDs for versions with SEC_READ_BMP and
recalculate the object state online: the newest version becomes the
target, older ones stay outdated, and pieces which are gone are dropped.
The object is forgotten only if nothing is left, and without the
unbalanced deref_object_state() it did before.
The first write to a PG which isn't clean adds the current OSD set to
pg.target_history before the new history is reported to etcd. An etcd
event handled in between made apply_pg_config() compare it with the old
history in pg_config and stop the PG, so the PG was re-peered for
nothing. It happened on the first recovery write right after a PG state
report. Update the pg_config history at the same time, like peering
does when it clears the history of an active PG.