Skip to content

Pin that the SSD store and the disk index hold the same keys after every operation - #457

Merged
matrixarkai merged 1 commit into
mainfrom
test/the-ssd-store-and-its-index-hold-the-same-keys
Nov 14, 2026
Merged

matrixarkai merged 1 commit into
mainfrom
test/the-ssd-store-and-its-index-hold-the-same-keys

Conversation

@matrixarkai

Copy link
Copy Markdown
Owner

Invalidation sends a delete to the SSD store for every key it names, including keys the disk index does not hold, and in a TemporalStore shared-store profile that call is about 8.7K instructions per invalidation (4.7% of the run). Skipping it for keys absent from the index would be a real saving, but it is only correct if no block can sit in the store without an index entry. Nothing asserted that. This pins it; it is a test only and changes no behaviour.

The test runs 2,000 deterministic pseudo-random puts, rewrites, batch puts, single invalidations and batch invalidations over 200 keys, in a tier that holds about 40 blocks so evictions are constant, and after every operation compares the keys whose blocks are in the store (ssd_block_exists) with the keys the index holds, in both directions. It passes on main: the two never drift.

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

What it does not cover: a restart. Recovery rebuilds the index from the store, so whether a block can survive a crash with no index entry is the other half of the question, and it needs a recovery test. So this alone does not make skipping the delete safe; it shows the necessary condition holds within a running cache.

Checks: cargo fmt --all --check is clean; the new test passes.

🤖 Generated with Claude Code

…ery operation

Invalidation sends a delete to the SSD store for every key it names, including keys the index does
not hold, and that costs about 8.7K instructions per call in a shared-store profile. Skipping the
delete for keys absent from the index is only correct if no block can sit in the store without an
index entry. Nothing asserted that.

The test runs two thousand deterministic pseudo-random puts, rewrites, batch puts, single and batch
invalidations over two hundred keys, in a tier that holds about forty blocks so evictions are
constant, and after every operation compares the keys whose blocks are in the store with the keys the
index holds, both ways. It passes on main: the two do not drift. It is a test only; no behaviour
changes.

It does not cover a restart. Whether a block can survive in the store across one with no index
entry is the other half of the question and needs a recovery test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@matrixarkai
matrixarkai merged commit 8a2b376 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