You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c3af674
Browse filesBrowse the repository at this point in the historyBrowse files
feat(catalog): support writing and committing to a branch
A commit was hard-wired to the main branch: `FileStoreCommit::Create()`
built its schema and snapshot managers without a branch, so a commit
configured with `branch=dev` read the main schema and published its
snapshot under the main branch's directory. A write through a catalog
refused a branch outright.
Resolve the branch an operation is aimed at from every source that may
name it - the table identifier, the `branch` option and, where a builder
has one, `WithBranch()` - and refuse names that disagree rather than
choosing between them. A read resolves it the same way, so the `branch`
option now names a read's branch as `WithBranch()` already did.
A catalog is told which branch to answer for by the
`<table>$branch_<branch>` object name that `Identifier(db, table,
branch)` builds and `CatalogUtils::BranchIdentifier()` rebuilds for
every catalog call, as the Java client does. `SnapshotCommit::Commit()`
now takes that branch, so a renaming commit writes through a manager of
the branch and a catalog commit addresses the branch's object name.
`UseRESTCatalogCommit()` still builds a body naming no branch, so the
caller sends it to the branch's own URL.
A branch keeps its schema, snapshots and real-time offsets under
`branch/branch-<name>`, while data and manifests stay shared under the
table path. A write or a commit aimed at a branch reads the schema
published there rather than the catalog's, as
`AbstractFileStoreTable.switchToBranch()` does, so a catalog serving
only the table's own current schema still takes the branch's snapshots;
only the main branch reloads the catalog's schema id for a new snapshot.
Refuse the two kinds of name a catalog cannot tell apart from another
object: a branch differing from `main` by case alone, whose snapshots
would go to a directory of their own, and a branch holding a `$`, which
reads back as a system table of another branch.
Expiration and snapshot loading follow the commit's branch. Expiration
reads the retained snapshots of that branch alone, as Java does, while
every branch shares the table's data files, so a file that only another
branch still refers to is deleted, which the public header and the
catalog guide both state.
0 commit comments