[KV Offload] Fix failed-load livelock by marking the lookup verdict as a miss (#49328)

Signed-off-by: Robbie J <RobbieJ@users.noreply.github.com>
This commit is contained in:
Robbie J
2026-08-09 10:25:36 +03:00
committed by GitHub
parent f8d03e7741
commit 1b0ce31f32
9 changed files with 490 additions and 47 deletions
@@ -334,6 +334,32 @@ class TestMockObjTierBasic:
assert len(results) == 1
assert not results[0].success
def test_failed_load_marks_verdict_negative(self):
"""Regression for the failed-load livelock on the obj tier: a
cached HIT must not survive a failed load of the same key. On the
failed promotion the tier marks the verdict False from
get_finished_jobs() (drained here) on the scheduler thread; otherwise
the scheduler would re-issue the same doomed promotion every step for
the life of the request. The mark is served from cache with no
re-probe, so even though the mock object is still 'present' the SAME
request now resolves to MISS."""
ctx = ReqContext(req_id="obj-livelock")
self.tier.submit_store(make_job(1, [key(1)], [0]))
assert all(r.success for r in drain(self.tier))
# Cache a positive verdict: the object is present, so lookup is a HIT.
assert lookup_and_wait(self.tier, [key(1)], ctx=ctx) == [LookupResult.HIT]
# The promotion the HIT triggered fails.
self.agent.check_xfer_state = lambda h: "ERR"
self.tier.submit_load(make_job(2, [key(1)], [0]))
results = drain(self.tier)
assert len(results) == 1 and not results[0].success
# After the failed promotion the SAME request's lookup must resolve to
# MISS (verdict marked False) instead of serving the stale HIT — even
# though the object itself is still present in the mock store.
assert lookup_and_wait(self.tier, [key(1)], ctx=ctx) == [LookupResult.MISS]
def test_pending_transfer_not_returned_until_done(self):
# First poll returns PROC; second poll returns DONE.
call_count = [0]