Repository navigation
memdb: count a key put again in a time block once - #50
Merged
Merged
Conversation
block.put counted every put that wasn't a delete, though a key put again in the same block replaces its record. So Size, which sums the counts, grew with every rewrite of a record (a security state, a session), and stayed too high after a delete: a store looked bigger than it was, and a copy of it, which puts each key once, smaller than its source. Recovery replays puts through block.put, and counts once too now. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
memdb:block.putcounted every put that wasn't a delete, but a key put again in the same time block replaces its record.Effect:
Sizegrew with every rewrite of a record, such as a security state or a session, and stayed too high after a delete. A store looked bigger than it was, and a copy of it, which puts each key once, looked smaller than its source. Recovery replays puts throughblock.put, so it now counts each key once too.Test:
TestSizeCountsAKeyOnce. Without the fix,Sizeis 3 after putting one key three times and deleting it, where 1 is expected. Thememdband root package tests pass.Independent of the backup PRs, which count memdb records as they copy them, so they don't depend on
Size.🤖 Generated with Claude Code