Skip to content

GitBlobstore: remote-managed fetch/merge/push sync#10458

Merged
coffeegoddd merged 11 commits intomainfrom
db/two-phase
Feb 10, 2026
Merged

GitBlobstore: remote-managed fetch/merge/push sync#10458
coffeegoddd merged 11 commits intomainfrom
db/two-phase

Conversation

@coffeegoddd
Copy link
Copy Markdown
Contributor

No description provided.

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

Adds a “remote-managed” synchronization mode to GitBlobstore so local reads/writes automatically fetch from a configured remote, merge remote-tracking state into the local ref, and push updates back using --force-with-lease. This is supported by new git plumbing APIs and a new gitrebase helper that performs key/path-granularity merges with atomic handling for chunked trees.

Changes:

  • Introduce remote-managed fetch/merge/push workflows in GitBlobstore (including lease-based push retries).
  • Add new git plumbing methods (FetchRef, PushRefWithLease, MergeBase, ListTreeRecursive, CommitTreeWithParents) and associated tests.
  • Add gitrebase merge helper + tests, and switch chunked-part naming to 4 digits (0001, 0002, …).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
go/store/blobstore/internal/gitrebase/temp_index.go Adds temp index helper for merge operations.
go/store/blobstore/internal/gitrebase/merge.go Implements merge logic for remote-tracking -> local ref with conflict hooks and chunked-tree atomicity.
go/store/blobstore/internal/gitrebase/merge_test.go Adds test coverage for fast-forward, merge commits, and conflict policies.
go/store/blobstore/internal/git/api.go Extends GitAPI with fetch/push-with-lease and merge/list/commit helpers.
go/store/blobstore/internal/git/impl.go Implements new GitAPI methods via git CLI plumbing commands.
go/store/blobstore/internal/git/errors.go Adds MergeConflictError type and helpers.
go/store/blobstore/internal/git/impl_test.go Refactors test setup and adds tests for new git API methods.
go/store/blobstore/git_blobstore.go Adds remote-managed mode + integrates fetch/merge/push sync; switches chunk part width to 4 digits.
go/store/blobstore/git_blobstore_test.go Adds integration tests for remote-managed behavior and retries.
go/store/blobstore/git_blobstore_helpers_test.go Updates test fake to satisfy extended GitAPI interface.
go/store/blobstore/git_blobstore_chunked_put_test.go Updates expectations to 4-digit chunk part names.

💡 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
3bc5c6d ok 5937471
version total_tests
3bc5c6d 5937471
correctness_percentage
100.0

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
0b9a547 ok 5937471
version total_tests
0b9a547 5937471
correctness_percentage
100.0

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +490 to +492
if err := gbs.syncForRead(ctx); err != nil {
return false, err
}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Exists now always calls syncForRead(), which will run a git fetch and mutate local refs even for callers that only expect local reads. Consider gating syncForRead() behind an explicit remote-managed option (or a no-op when no remote is configured) to avoid unexpected network/IO and side effects on read-only use cases.

Copilot uses AI. Check for mistakes.
Comment on lines +307 to +311
remoteName := opts.RemoteName
if remoteName == "" {
remoteName = "origin"
}
remoteTrackingRef := DoltRemoteTrackingDataRef(remoteName)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

RemoteName defaults to "origin" here, which effectively makes remote-managed behavior the default for all GitBlobstores. If local-only operation should still be supported, consider leaving remoteName empty by default and only enabling remote fetch/push when the caller explicitly opts in (or provide a separate flag/enum to control sync behavior).

Copilot uses AI. Check for mistakes.
return err
}
if !okRemote {
return &git.RefNotFoundError{Ref: gbs.remoteTrackingRef}
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Returning RefNotFoundError when the remote-tracking ref doesn't exist makes an uninitialized remote (no refs/dolt/data yet) fail hard, instead of behaving like an empty store (e.g., manifest missing). If empty remotes are valid, consider treating !okRemote as an empty state (no-op sync) and letting the existing NotFound / missing-ref logic handle it.

Suggested change
return &git.RefNotFoundError{Ref: gbs.remoteTrackingRef}
// Treat an uninitialized remote (no remote-tracking ref yet) as an empty store.
// This makes syncForRead a no-op in that case, allowing existing NotFound logic
// elsewhere to handle the absence of data.
return nil

Copilot uses AI. Check for mistakes.
@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
dc5cea6 ok 5937471
version total_tests
dc5cea6 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, one comment about separating local vs. remote ref name and making a unique local ref for this blobstore instance.

@coffeegoddd
Copy link
Copy Markdown
Contributor Author

@coffeegoddd DOLT

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

@coffeegoddd coffeegoddd merged commit 22d0c7d into main Feb 10, 2026
23 of 24 checks passed
@coffeegoddd coffeegoddd deleted the db/two-phase branch February 10, 2026 20:05
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