Skip to content

feat(transaction): add ManageSnapshotsAction for snapshot refs. (#1939)#2709

Open
hippalus wants to merge 1 commit into
apache:mainfrom
hippalus:feat/manage-snapshots-action
Open

feat(transaction): add ManageSnapshotsAction for snapshot refs. (#1939)#2709
hippalus wants to merge 1 commit into
apache:mainfrom
hippalus:feat/manage-snapshots-action

Conversation

@hippalus

Copy link
Copy Markdown

Which issue does this PR close?

What changes are included in this PR?

Adds ManageSnapshotsAction, a transaction action for managing branches and tags (like Java's ManageSnapshots). PR1 of #1939 ref management only, no rollback/set-current-snapshot/cherrypick.

Transaction::manage_snapshots() supports:

  • create_branch / create_tag
  • remove_branch / remove_tag
  • rename_branch
  • replace_branch (by id) / replace_branch_with_ref (by ref) / replace_tag
  • fast_forward_branch
  • set_min_snapshots_to_keep / set_max_snapshot_age_ms (branch-only) / set_max_ref_age_ms

Notes:

  • Validation runs at commit time, against a working copy of the refs map (chained ops see intermediate state).
  • Updates/requirements are diff-based against the current refs, net no-ops emit nothing, concurrent ref changes are caught via RefSnapshotIdMatch.
  • Reuses existing SetSnapshotRef/RemoveSnapshotRef + UuidMatch/RefSnapshotIdMatch no new variants.

Supporting changes:

  • TableMetadata::refs() and snapshot_reference() accessors.
  • util::snapshot::is_ancestor_of() (used by fast-forward).
  • TableMetadataBuilder::set_ref() rejects setting main to a tag (Java parity).

Are these changes tested?

Yes unit tests in manage_snapshots.rs, following the expire_snapshots.rs style:

  • One test per operation plus its failure cases (missing/duplicate refs, wrong ref kind, removing/renaming main, non-ancestor fast-forward, negative retention, …).
  • Diff/requirement behavior: minimal diffs from chained ops, transient refs get no requirement, source-ref concurrency assertions, round-trip through TableMetadataBuilder.
  • The main-as-tag rejection is covered by a test in table_metadata_builder.rs.

…he#1939)

Create, remove, replace, rename, fast-forward branches/tags and set per-ref
retention in a transaction, with diff-based updates and requirements.
@hippalus hippalus marked this pull request as ready for review June 25, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the ability to transactionally create named references (tags) to a snapshot in the FastAppendAction

1 participant