Add ManageSnapshots.fast_forward_branch - #3900
Open
Ferdinanddb wants to merge 3 commits into
Open
Conversation
Fast-forward a branch to the snapshot of another ref, following Java's ManageSnapshots.fastForwardBranch: the ref to fast-forward to can be a branch or a tag, a missing branch is created with default retention, and a branch that is not an ancestor raises ValueError. Operations chained in one manage_snapshots() see each other, and a ref set twice in a chain results in a single set-snapshot-ref update. rollback_to_snapshot and rollback_to_timestamp stage pending ref updates before validating, like commitIfRefUpdatesExist in Java. Supersedes apache#3649.
SnapshotRef requires min-snapshots-to-keep, max-snapshot-age-ms and max-ref-age-ms to be greater than 0, but SetSnapshotRefUpdate did not, so an invalid value only failed when the ref was built at apply time. Java validates these in SnapshotRef.Builder when they are set.
rambleraptor
approved these changes
Sep 4, 2026
rambleraptor
left a comment
Collaborator
There was a problem hiding this comment.
We already went through reviews, so this looks good to me. Thanks for doing this!
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.
Adds
ManageSnapshots.fast_forward_branch, following Java'sManageSnapshots.fastForwardBranchand Spark'ssystem.fast_forwardprocedure.ValueErrormanage_snapshots()see each other, and a ref set twice in a chain results in a singleset-snapshot-refupdateSupersedes #3649 by @JeroenSchmidt, which has been conflicting since August. It keeps the same API and intra-chain behaviour and addresses the open review comments from @rambleraptor (refs injected directly in the tests, default retention of a created branch documented, tag target and no-op covered, shorter docs). Differences: plain
ValueErrorinstead of new exception classes, the pending refs come fromupdate_table_metadatainstead of a separate overlay, and chained updates on the same ref are collapsed.The second commit is separable: it adds the
gt=0bounds thatSnapshotRefalready has toSetSnapshotRefUpdate, so an invalid retention value fails when it is passed instead of at apply time, likeSnapshotRef.Builderin Java. Happy to split it out if preferred.