From 75c9bae5ae3af2a37fd8853f6a23f304271be406 Mon Sep 17 00:00:00 2001 From: Yury Luneff Date: Thu, 26 Nov 2026 15:00:50 +0300 Subject: [PATCH] test_pg_chaos: Treat ops lost in a crash or takeover as OPTIONAL 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 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. The delete-pending branch of world_check() takes only V_OPTIONAL, so a lost delete that did apply was reported as a lost write. --- src/test/test_pg_chaos.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/test_pg_chaos.cpp b/src/test/test_pg_chaos.cpp index ae429929..d0c448cc 100644 --- a/src/test/test_pg_chaos.cpp +++ b/src/test/test_pg_chaos.cpp @@ -2867,6 +2867,9 @@ void chaos_t::account(pending_t *p) check_read_result(p); return; } + // No reply will ever come (crash, takeover): the op may have applied anywhere + if (!p->done && objs[p->obj].vers[p->version].state == V_SUBMITTED) + objs[p->obj].vers[p->version].state = V_OPTIONAL; int64_t want = p->op->req.hdr.opcode == OSD_OP_WRITE ? (int64_t)p->op->req.rw.len : 0; bool ok = p->done && p->op->reply.hdr.retval == want; if (p->done && !ok) -- 2.47.3