test_pg_chaos: Treat ops lost in a crash or takeover as OPTIONAL #159
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:pg-chaos-submitted-delete"
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 write or delete still in flight when the primary crashed or was taken over never gets a reply: account() changed the state only of answered operations (
p->done), and forget_inflight() dropped the rest, so the version stayed V_SUBMITTED for good. Such an operation may have applied on any subset of the set, which is what V_OPTIONAL means and what the do_crash() and do_takeover() comments already assumed. account() is called on an unanswered op only from those two paths.The delete-pending branch of world_check() takes only V_OPTIONAL, so a delete lost this way that did apply was reported as a lost write ("shows a hole but the highest applicable version covering it is seq N"). How it is reached, with legacy (non-tombstone) deletes: a full-object write is acked, the client sends a delete, every live member applies it, including the primary's store, which persists it, and the primary crashes before replying. After the restart the read returns a hole, which is legal.
The first version of this PR widened world_check() to accept V_SUBMITTED; as suggested in review, the operations lost without a reply now become V_OPTIONAL instead, and world_check() is unchanged.
Found: by a chaos test (test_pg_chaos seed 381010807 on a tree from before tombstone deletion,
019d644a).Tested: seed 381010807 fails before and passes after on that tree. On master: the default run (100 seeds) with and without --legacy-peers, 1020 random seeds with --legacy-peers, and 381010807 with and without --legacy-peers pass. 1020 random seeds without --legacy-peers pass except 179088455, which deadlocks the same way on unmodified master ("operations did not complete in 1000000 steps").
Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
85a389acd9to75c9bae5aetest_pg_chaos: Accept a delete left in flight by a primary crash in world_checkto test_pg_chaos: Treat ops lost in a crash or takeover as OPTIONAL