Skip to content

Preserve appended collision replacements during eviction - #444

Open
zhechen-cs wants to merge 1 commit into
allegro:mainfrom
zhechen-cs:codex/preserve-appended-collision-entry
Open

zhechen-cs wants to merge 1 commit into
allegro:mainfrom
zhechen-cs:codex/preserve-appended-collision-entry

Conversation

@zhechen-cs

Copy link
Copy Markdown

When Append replaces a different key with the same hash, the old queue entry keeps its hash. Evicting that entry later deletes the replacement's map index, even if the replacement has not expired. It also reports a removal callback for the overwritten key.

Invalidate the previous queue entry before inserting the replacement, as Set already does. The regression uses a constant hasher and a controlled clock: the replacement remains readable when the old entry expires, then expires at its own deadline. It also checks the removal callback and cache length.

Validation on macOS arm64 with Go 1.27.2:

  • The new regression fails on unchanged main; the existing full suite passes there.
  • go test -race -count=1 ./... passes.
  • The final regression with callback assertions passes with the race detector.
  • go vet ./..., golangci-lint for new issues, and git diff --check pass.

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.

1 participant