test_pg_chaos: Treat ops lost in a crash or takeover as OPTIONAL #159

Merged
vitalif merged 1 commits from koolkhel/vitastor:pg-chaos-submitted-delete into master 2026-11-26 16:07:55 +03:00
Contributor

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

### 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 - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
koolkhel added 1 commit 2026-11-23 12:58:54 +03:00
A delete that was in flight when the primary crashed stays V_SUBMITTED
in the model, because account() only moves operations that got a reply.
It may still have applied on every member, so the object may come back
deleted. redel_pending() and observe() already allow that, but the
delete-pending branch of world_check() only took V_OPTIONAL: it kept the
delete floor below the last acked write and reported the legal hole as
a lost write.
koolkhel force-pushed pg-chaos-submitted-delete from 85a389acd9 to 75c9bae5ae 2026-11-26 15:00:53 +03:00 Compare
koolkhel changed title from test_pg_chaos: Accept a delete left in flight by a primary crash in world_check to test_pg_chaos: Treat ops lost in a crash or takeover as OPTIONAL 2026-11-26 15:00:55 +03:00
vitalif merged commit 5d9d404c8b into master 2026-11-26 16:07:55 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#159
No description provided.