Skip to content

GitBlobstore: implement CheckAndPut CAS semantics + add tests#10419

Merged
coffeegoddd merged 1 commit intomainfrom
db/gitblobstore-next-2
Feb 5, 2026
Merged

GitBlobstore: implement CheckAndPut CAS semantics + add tests#10419
coffeegoddd merged 1 commit intomainfrom
db/gitblobstore-next-2

Conversation

@coffeegoddd
Copy link
Copy Markdown
Contributor

This PR adds the next write-path primitive to GitBlobstore: CheckAndPut with proper compare-and-swap behavior, and a focused test suite (including a concurrency/CAS-failure scenario).

Base automatically changed from db/gitblobstore-next to main February 5, 2026 00:10
@coffeegoddd coffeegoddd requested a review from Copilot February 5, 2026 00:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CheckAndPut with CAS semantics that validates version before consuming the reader and handles both create and update operations
  • Refactored buildPutCommit to extract buildCommitWithMessage for code reuse between Put and CheckAndPut
  • 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.

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
a93d875 ok 5937471
version total_tests
a93d875 5937471
correctness_percentage
100.0

Copy link
Copy Markdown
Contributor

@reltuk reltuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@coffeegoddd coffeegoddd merged commit 7dd425e into main Feb 5, 2026
23 of 24 checks passed
@coffeegoddd coffeegoddd deleted the db/gitblobstore-next-2 branch February 5, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants