Skip to content

fix(namespace): allow create_branch bootstrap on managed tables#7415

Merged
jackye1995 merged 4 commits into
lance-format:mainfrom
geruh:branching
Jun 23, 2026
Merged

fix(namespace): allow create_branch bootstrap on managed tables#7415
jackye1995 merged 4 commits into
lance-format:mainfrom
geruh:branching

Conversation

@geruh

@geruh geruh commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This PR picks up on the work in #7403 by @dantasse.

create_branch on managed tables calls create_table_version before _refs/branches/<branch>.json exists, and resolve_branch_location requires that ref. Bootstrap commit fails.

create_table_version now goes through resolve_branch_for_commit instead check the ref first, and if it's missing only allow the commit when the branch chain has no versions yet. Versions without a ref still get rejected (zombie).

create_branch("exp") used to fail on the first commit because create_table_version looked for _refs/branches/exp.json before phase 2 wrote it.

# branching isn't atomic so:
phase 1: manifest → create_table_version (ref doesn't exist yet ← was failing here)
phase 2: write _refs/branches/exp.json

Testing

  • Added test_create_branch_on_managed_dataset_succeeds.
  • Zombie case is already in test_branch_ops_reject_zombie_branch.

create_table_version resolves a branch via resolve_branch_for_commit: a
branch chain accepts a commit when the BranchContents ref already exists or
when the chain has no committed versions yet (the create_branch bootstrap,
whose first commit precedes its ref). A chain with versions but no ref is a
zombie and stays rejected.

Adds test_create_branch_on_managed_dataset_succeeds; managed zombie
rejection through create_table_version is already covered by
test_branch_ops_reject_zombie_branch.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions github-actions Bot added A-namespace Namespace impls bug Something isn't working labels Jun 23, 2026
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-namespace-impls/src/dir.rs 85.52% 7 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@dantasse dantasse left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cool, looks like a good solution to me!

@jackye1995 jackye1995 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good to me!

geruh and others added 2 commits June 23, 2026 10:55
…Windows

create_table_version now writes and zombie-checks a branch at the same
object-store Path from find_branch(), instead of round-tripping the branch
URI through object_store_path_from_uri. On Windows that round-trip resolves
elsewhere, so the version listing came back empty, zombies looked like
bootstraps, and test_branch_ops_reject_zombie_branch failed on windows-build.

resolve_branch_for_commit returns (uri, path) so the commit write and the
branch_has_committed_versions check share one basis. The shared listing logic
is extracted into list_versions_under, which takes a Path directly.

Co-authored-by: Cursor <[email protected]>
On Windows, Path::from(format!(branch_location.path, ...)) diverges from
find_branch().path.join(VERSIONS_DIR), so zombie detection missed the staged
manifest and create_table_version accepted the commit. Stage with
find_branch().path.join(VERSIONS_DIR).

Co-authored-by: Cursor <[email protected]>
@jackye1995
jackye1995 merged commit 715047e into lance-format:main Jun 23, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-namespace Namespace impls bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants