FAILURE MAP
← Case archive

FA-676 / Replication / Open access

Delete a write-ahead log segment: Deletion removes the next segment needed by a lagging replica · case 01

The wal retention operation is admitted even though deletion removes the next segment needed by a lagging replica.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The admission path omits the slowest replica invariant while validating the other operation preconditions.

VERIFIED REPAIR

Require r['slowest_replica'][0] < min(r['slowest_replica'][1]) together with every other stated precondition before accepting the operation.

Unsuccessful approach: Adding the slowest replica check repairs the reported defect, but replacing the adjacent backup pin check loses that independent invariant.

Case contract

Return a Boolean admission decision for delete a write-ahead log segment. The record r must satisfy all of: r['slowest_replica'][0] < min(r['slowest_replica'][1]); r['backup_pin'][0] not in r['backup_pin'][1]; r['archive_confirmed'] is True; r['segment_sealed'] is True; r['recovery_floor'][0] < r['recovery_floor'][1]. Extra tracing fields are ignored; validation does not mutate the record.

Why this case matters

A deterministic local contract for replication. Each negative fixture violates exactly one invariant. No transport timing, persistence, cryptographic verification, or full protocol implementation is claimed.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['backup_pin'][0] not in r['backup_pin'][1]) and (r['archive_confirmed'] is True) and (r['segment_sealed'] is True) and (r['recovery_floor'][0] < r['recovery_floor'][1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'slowest_replica': [9, [10, 12]], 'backup_pin': [9, [10, 11]], 'archive_confirmed': True, 'segment_sealed': True, 'recovery_floor': [7, 8]}
check('valid operation', solve(r), True)
check('Deletion removes the next segment needed by a lagging replica', solve(dict(r, **{'slowest_replica': [10, [10, 12]]})), False)
check('A backup still needs the selected log segment', solve(dict(r, **{'backup_pin': [10, [10, 11]]})), False)
check('The only recoverable copy is deleted before archival', solve(dict(r, **{'archive_confirmed': False})), False)
check('Garbage collection deletes a segment still accepting writes', solve(dict(r, **{'segment_sealed': False})), False)
check('Deletion crosses the crash recovery replay floor', solve(dict(r, **{'recovery_floor': [8, 8]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'slowest_replica': [10, [10, 12]], 'backup_pin': [10, [10, 11]], 'archive_confirmed': False, 'segment_sealed': False, 'recovery_floor': [8, 8]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
valid operationTrueTruePassed
Deletion removes the next segment needed by a lagging replicaTrueFalseFailed
A backup still needs the selected log segmentFalseFalsePassed
The only recoverable copy is deleted before archivalFalseFalsePassed
Garbage collection deletes a segment still accepting writesFalseFalsePassed
Deletion crosses the crash recovery replay floorFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 4f5cb25986767d079d8117e527c64b3eb0491f05cb0fca1e2b446002257778c5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['slowest_replica'][0] < min(r['slowest_replica'][1])) and (r['archive_confirmed'] is True) and (r['segment_sealed'] is True) and (r['recovery_floor'][0] < r['recovery_floor'][1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'slowest_replica': [9, [10, 12]], 'backup_pin': [9, [10, 11]], 'archive_confirmed': True, 'segment_sealed': True, 'recovery_floor': [7, 8]}
check('valid operation', solve(r), True)
check('Deletion removes the next segment needed by a lagging replica', solve(dict(r, **{'slowest_replica': [10, [10, 12]]})), False)
check('A backup still needs the selected log segment', solve(dict(r, **{'backup_pin': [10, [10, 11]]})), False)
check('The only recoverable copy is deleted before archival', solve(dict(r, **{'archive_confirmed': False})), False)
check('Garbage collection deletes a segment still accepting writes', solve(dict(r, **{'segment_sealed': False})), False)
check('Deletion crosses the crash recovery replay floor', solve(dict(r, **{'recovery_floor': [8, 8]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'slowest_replica': [10, [10, 12]], 'backup_pin': [10, [10, 11]], 'archive_confirmed': False, 'segment_sealed': False, 'recovery_floor': [8, 8]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
valid operationTrueTruePassed
Deletion removes the next segment needed by a lagging replicaFalseFalsePassed
A backup still needs the selected log segmentTrueFalseFailed
The only recoverable copy is deleted before archivalFalseFalsePassed
Garbage collection deletes a segment still accepting writesFalseFalsePassed
Deletion crosses the crash recovery replay floorFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 53f4332c0cab2742a123530c0d142b30199474997791b697c56cf7e014ce92b9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['slowest_replica'][0] < min(r['slowest_replica'][1])) and (r['backup_pin'][0] not in r['backup_pin'][1]) and (r['archive_confirmed'] is True) and (r['segment_sealed'] is True) and (r['recovery_floor'][0] < r['recovery_floor'][1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'slowest_replica': [9, [10, 12]], 'backup_pin': [9, [10, 11]], 'archive_confirmed': True, 'segment_sealed': True, 'recovery_floor': [7, 8]}
check('valid operation', solve(r), True)
check('Deletion removes the next segment needed by a lagging replica', solve(dict(r, **{'slowest_replica': [10, [10, 12]]})), False)
check('A backup still needs the selected log segment', solve(dict(r, **{'backup_pin': [10, [10, 11]]})), False)
check('The only recoverable copy is deleted before archival', solve(dict(r, **{'archive_confirmed': False})), False)
check('Garbage collection deletes a segment still accepting writes', solve(dict(r, **{'segment_sealed': False})), False)
check('Deletion crosses the crash recovery replay floor', solve(dict(r, **{'recovery_floor': [8, 8]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'slowest_replica': [10, [10, 12]], 'backup_pin': [10, [10, 11]], 'archive_confirmed': False, 'segment_sealed': False, 'recovery_floor': [8, 8]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
valid operationTrueTruePassed
Deletion removes the next segment needed by a lagging replicaFalseFalsePassed
A backup still needs the selected log segmentFalseFalsePassed
The only recoverable copy is deleted before archivalFalseFalsePassed
Garbage collection deletes a segment still accepting writesFalseFalsePassed
Deletion crosses the crash recovery replay floorFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 6409c47c634524496e8ce5493b9f7e6ad33bed4115ca9dc79df7814cd574c6dc

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:36:54.965105+00:00.

Case digest / b4064625aea2bc6a325c48e08b4de395d8b966d5975f61266f863a202135f5e2