GitBlobstore: implement CheckAndPut CAS semantics + add tests#10419
Merged
coffeegoddd merged 1 commit intomainfrom Feb 5, 2026
Merged
GitBlobstore: implement CheckAndPut CAS semantics + add tests#10419coffeegoddd merged 1 commit intomainfrom
CheckAndPut CAS semantics + add tests#10419coffeegoddd merged 1 commit intomainfrom
Conversation
1c1b342 to
a93d875
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements the CheckAndPut method for GitBlobstore with proper compare-and-swap (CAS) semantics. The implementation validates the expected version before consuming the reader, creates a commit with the new blob, and uses git's UpdateRefCAS to atomically update the reference. The PR includes comprehensive test coverage for create-only operations, version mismatches, successful updates, and concurrent update scenarios.
Changes:
- Implemented
CheckAndPutwith CAS semantics that validates version before consuming the reader and handles both create and update operations - Refactored
buildPutCommitto extractbuildCommitWithMessagefor code reuse betweenPutandCheckAndPut - Added comprehensive test suite including tests for create-only, version mismatch, successful update, and concurrent update scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/store/blobstore/git_blobstore.go | Implements CheckAndPut method with CAS semantics and refactors commit building logic into buildCommitWithMessage for reuse |
| go/store/blobstore/git_blobstore_test.go | Adds failReader helper and four comprehensive tests covering create-only, version mismatch, successful update, and concurrent update scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@coffeegoddd DOLT
|
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.
This PR adds the next write-path primitive to GitBlobstore:
CheckAndPutwith proper compare-and-swap behavior, and a focused test suite (including a concurrency/CAS-failure scenario).