Repository navigation
fix: prevent delayed CAS deletes from lowering fences - #284
Open
perfloop[bot] wants to merge 2 commits into
Open
perfloop[bot] wants to merge 2 commits into
perfloop[bot] wants to merge 2 commits into
Conversation
[Medium impact] The PR appears safe to merge within its stated single-instance, retained-fence guarantee. SummaryPrevents a delayed CAS delete from replacing a newer retained fence.
Reviews (3) · Last reviewed commit: "fix: prevent delayed CAS deletes from lo..." · Reviewed by Greptile |
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
perfloop
Bot
force-pushed
the
perfloop-pr-open-hf3wbwd89k
branch
from
November 16, 2026 13:25
dc31114 to
8364183
Compare
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.
A delayed CAS delete could replace a newer absent-key fence when its merge arrived later than its stamp. The merge operator now keeps the newer tombstone, so an ordered refill based on the earlier absence token is rejected.
The repair covers CAS-only operations on one Storage instance while the tombstone remains retained. Plain/CAS mixing, owner changes, restarts, and the existing fence-retention sweep remain outside this guarantee. The API and stored schema are unchanged.
The storage test sets a one-hour fence retention in
StorageConfigbefore construction starts the cleaner, pauses the earlier delete before its merge, completes the later invalidation, and attempts an inline refill with the intervening token. Merge tests compare all-at-once and successive-base folding; existing tests retain fresh-token, unordered-refill, and advancing-delete behavior. A package-only metadata hook coordinates the pause; it adds no public surface.Go tests passed for CAS storage and merge behavior, metadata-commit hooks, the race-checked delayed-delete test, and CAS integration including the embedded client. The CAS E2E script passed; lint and license checks passed. The full CI workflow was not run here.
Generated by Perfloop.
Note
High Risk
Changes CAS tombstone fence semantics in the merge operator; incorrect logic could let stale populates win over newer invalidations on absent keys.
Overview
Fixes a CAS ordering bug where a delete that received its version stamp early but merged late could replace a newer absent-key tombstone fence, wrongly admitting a
PutIfVersionthat used an observation token from between the two deletes.The merge operator now only advances the fence on a repeat delete over a tombstone when
op.Version >= base.Version, in addition to the existingfenceAdmitscheck. Older delayed operands keep the newer tombstone so read-back reports a mismatch instead of lowering the fence.Test support:
beforeMetaCommitalso runs immediately beforeDeleteIfVersion's metadata merge (same test hook asputLow). Helpers accept optionalStorageConfigcallbacks. New merge and storage fence tests cover delayed-delete ordering and split-merge determinism.Reviewed by Cursor Bugbot for commit 8364183. Bugbot is set up for automated code reviews on this repo. Configure here.