Skip to content

Pin that the SSD store and the disk index still agree across recoveries - #458

Merged
matrixarkai merged 1 commit into
mainfrom
test/the-ssd-store-and-its-index-agree-after-a-recovery
Nov 14, 2026
Merged

matrixarkai merged 1 commit into
mainfrom
test/the-ssd-store-and-its-index-agree-after-a-recovery

Conversation

@matrixarkai

Copy link
Copy Markdown
Owner

Follow-up to #457. That test pins that the SSD store and the disk index hold the same keys after every operation in a running cache. Skipping the SSD store delete for a key the index does not hold (about 8.7K instructions per invalidation, 4.7% of a shared-store harness run) is only correct if recovery cannot change that either: recovery rebuilds the index from the store, so a block that sat in the store with no index entry would come back as an indexed, servable key.

The new test runs 1,500 deterministic puts and single and batch invalidations over 200 keys, in a tier of about forty blocks with durable SSD blocks, and recovers the persistent tiers every 97 steps. Before and after each recovery it compares the keys whose blocks are in the store with the keys the index holds, in both directions, and it checks that a key invalidated since its last write has not come back. It passes on main. It is a test only and changes no behaviour.

It can fail. With invalidation's delete_ssd_blocks call removed, it fails at step 27 with "a block is in the SSD store with no index entry"; restored, it passes (about 3 s).

What it still does not cover: a process that dies between the store write and the index update. That is an error path (a failed write, or a crash mid-batch), not a normal one, and covering it needs fault injection. So together with #457 this shows the necessary condition for the skip holds in normal operation and across recovery; it does not by itself show the skip is safe, and that remains a durability decision for the owners of this crate.

Checks: cargo fmt --all --check is clean; both invariant tests pass.

🤖 Generated with Claude Code

The invariant test covers a running cache. Skipping the SSD store delete for a key the index does not
hold is only correct if recovery cannot change that: recovery rebuilds the index from the store, so a
block that sat in the store with no index entry would come back as an indexed, servable key.

The new test runs 1,500 deterministic puts, single and batch invalidations over 200 keys in a tier of
about forty blocks, with durable SSD blocks, and recovers the persistent tiers every 97 steps. Before
and after each recovery it compares the keys whose blocks are in the store with the keys the index
holds, both ways, and it checks that a key invalidated since its last write has not come back. It
passes on main. Test only; no behaviour changes.

It still does not cover a process that dies between the store write and the index update, which is
an error path, not a normal one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@matrixarkai
matrixarkai merged commit 24088da into main Nov 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants