Fix handler VV bump ordering for PR #66 - #68
Closed
benitogf wants to merge 1 commit into
Closed
Conversation
Owner
Author
CBosch101
approved these changes
Jun 8, 2026
CBosch101
left a comment
Contributor
There was a problem hiding this comment.
Moves the handler VV bump into the attached-storage AfterWriteOp path so a caller waiting on AfterWrite observes the post-bump VV, keeping a handler fallback bump for unattached storages. Verdict: APPROVE.
Verified
go test -race ./...passes locally (the run the PR notes couldn't complete on the Windows host for lack of gcc);TestClockDriftScenario -count=300and the targeted regression set (-count=20) clean.TestAttachedHandlerAfterWriteObservesSynchronousVVBumpis a real guard, not theater — it fails on the pre-fix code (the observer sees an empty VV) and passes after.- The
ConsumeBumpSkip→ConsumeBumpFallbackrename is complete; no stale references;go vetclean.
Non-blocking
- Fallback marker consumed before the skip-returns —
instance.go:277. The marker is drained unconditionally, but the hook can still return without bumping at the!foundcheck (instance.go:289) and the pull-driven skip (instance.go:310); a handler-marked write that reaches either return then bumps nowhere, because the handler fallback (handlers.go:174) finds the marker already consumed. Pre-fix this couldn't happen — the handler path returned before the key-match/pull-skip logic. Safe only while handler writes always match a configured key and never coincide with a pull-driven skip; worth confirming that invariant holds. No repro constructed; race suite is green.
🤖 Generated with Claude Code
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.
Summary
AfterWriteOppath for attached storagesgithub.com/benitogf/oooto latest main (44aea235) and add regression coverage for attached handlerAfterWriteobserversRoot cause
TestClockDriftScenariowaited for the pivot storageAfterWritecallback and then asserted the pivot VV. The handler path previously bumped VV only afterdb.SetWithMetareturned, while attached storage callbacks can run inside that write. Under scheduling pressure the test could observe the committed pivot write before the handler reached its post-write VV bump, producing the CI failure:The fix makes attached handler writes bump in
AfterWriteOp, before callerAfterWriteobservers can see the write. The handler consumes the same fallback marker after the write; if the hook already ran it skips the fallback bump, otherwise it bumps for unattached storages.Base / review note
This is a stacked PR on top of #66. Please compare against
fix/cluster-sync-vv-divergence; the incremental diff is 8 files, +108/-56.Fixes #67.
Verification
go test ./...go test -race ./...go test -run TestClockDriftScenario -count=2000 ./...go test -run TestAttachedHandlerAfterWriteObservesSynchronousVVBump|TestSetVVIncrementsExactlyOnce|TestHandlerIncrementMatchesActivityScope -count=500 ./...