Package org.apache.iceberg
Class SnapshotManager
java.lang.Object
org.apache.iceberg.SnapshotManager
- All Implemented Interfaces:
- ManageSnapshots,- PendingUpdate<Snapshot>
- 
Method SummaryModifier and TypeMethodDescriptionapply()Apply the pending changes and return the uncommitted changes for validation.cherrypick(long snapshotId) Apply supported changes in given snapshot and create a new snapshot which will be set as the current snapshot on commit.voidcommit()Apply the pending changes and commit.createBranch(String name) Create a new branch.createBranch(String name, long snapshotId) Create a new branch pointing to the given snapshot id.Create a new tag pointing to the given snapshot idfastForwardBranch(String from, String to) Performs a fast-forward offromup to thetosnapshot iffromis an ancestor ofto.removeBranch(String name) Remove a branch by nameRemove the tag with the given name.renameBranch(String name, String newName) Rename a branchreplaceBranch(String name, long snapshotId) Replaces the branch with the given name to point to the specified snapshotreplaceBranch(String from, String to) Replaces thefrombranch to point to thetosnapshot.replaceTag(String name, long snapshotId) Replaces the tag with the given name to point to the specified snapshot.rollbackTo(long snapshotId) Rollback table's state to a specificSnapshotidentified by id.rollbackToTime(long timestampMillis) Roll this table's data back to the lastSnapshotbefore the given timestamp.setCurrentSnapshot(long snapshotId) Roll this table's data back to a specificSnapshotidentified by id.setMaxRefAgeMs(String name, long maxRefAgeMs) Updates the retention policy for a reference.setMaxSnapshotAgeMs(String name, long maxSnapshotAgeMs) Updates the max snapshot age for a branch.setMinSnapshotsToKeep(String name, int minSnapshotsToKeep) Updates the minimum number of snapshots to keep for a branch.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.PendingUpdateupdateEvent
- 
Method Details- 
cherrypickDescription copied from interface:ManageSnapshotsApply supported changes in given snapshot and create a new snapshot which will be set as the current snapshot on commit.- Specified by:
- cherrypickin interface- ManageSnapshots
- Parameters:
- snapshotId- a snapshotId whose changes to apply
- Returns:
- this for method chaining
 
- 
setCurrentSnapshotDescription copied from interface:ManageSnapshotsRoll this table's data back to a specificSnapshotidentified by id.- Specified by:
- setCurrentSnapshotin interface- ManageSnapshots
- Parameters:
- snapshotId- long id of the snapshot to roll back table data to
- Returns:
- this for method chaining
 
- 
rollbackToTimeDescription copied from interface:ManageSnapshotsRoll this table's data back to the lastSnapshotbefore the given timestamp.- Specified by:
- rollbackToTimein interface- ManageSnapshots
- Parameters:
- timestampMillis- a long timestamp, as returned by- System.currentTimeMillis()
- Returns:
- this for method chaining
 
- 
rollbackToDescription copied from interface:ManageSnapshotsRollback table's state to a specificSnapshotidentified by id.- Specified by:
- rollbackToin interface- ManageSnapshots
- Parameters:
- snapshotId- long id of snapshot id to roll back table to. Must be an ancestor of the current snapshot
 
- 
createBranchDescription copied from interface:ManageSnapshotsCreate a new branch. The branch will point to current snapshot if the current snapshot is not NULL. Otherwise, the branch will point to a newly created empty snapshot.- Specified by:
- createBranchin interface- ManageSnapshots
- Parameters:
- name- branch name
- Returns:
- this for method chaining
 
- 
createBranchDescription copied from interface:ManageSnapshotsCreate a new branch pointing to the given snapshot id.- Specified by:
- createBranchin interface- ManageSnapshots
- Parameters:
- name- branch name
- snapshotId- id of the snapshot which will be the head of the branch
- Returns:
- this for method chaining
 
- 
createTagDescription copied from interface:ManageSnapshotsCreate a new tag pointing to the given snapshot id- Specified by:
- createTagin interface- ManageSnapshots
- Parameters:
- name- tag name
- snapshotId- snapshotId for the head of the new branch.
- Returns:
- this for method chaining
 
- 
removeBranchDescription copied from interface:ManageSnapshotsRemove a branch by name- Specified by:
- removeBranchin interface- ManageSnapshots
- Parameters:
- name- branch name
- Returns:
- this for method chaining
 
- 
removeTagDescription copied from interface:ManageSnapshotsRemove the tag with the given name.- Specified by:
- removeTagin interface- ManageSnapshots
- Parameters:
- name- tag name
- Returns:
- this for method chaining
 
- 
setMinSnapshotsToKeepDescription copied from interface:ManageSnapshotsUpdates the minimum number of snapshots to keep for a branch.- Specified by:
- setMinSnapshotsToKeepin interface- ManageSnapshots
- Parameters:
- name- branch name
- minSnapshotsToKeep- minimum number of snapshots to retain on the branch
- Returns:
- this for method chaining
 
- 
setMaxSnapshotAgeMsDescription copied from interface:ManageSnapshotsUpdates the max snapshot age for a branch.- Specified by:
- setMaxSnapshotAgeMsin interface- ManageSnapshots
- Parameters:
- name- branch name
- maxSnapshotAgeMs- maximum snapshot age in milliseconds to retain on branch
- Returns:
- this for method chaining
 
- 
setMaxRefAgeMsDescription copied from interface:ManageSnapshotsUpdates the retention policy for a reference.- Specified by:
- setMaxRefAgeMsin interface- ManageSnapshots
- Parameters:
- name- branch name
- maxRefAgeMs- retention age in milliseconds of the tag reference itself
- Returns:
- this for method chaining
 
- 
replaceTagDescription copied from interface:ManageSnapshotsReplaces the tag with the given name to point to the specified snapshot.- Specified by:
- replaceTagin interface- ManageSnapshots
- Parameters:
- name- Tag to replace
- snapshotId- new snapshot id for the given tag
- Returns:
- this for method chaining
 
- 
replaceBranchDescription copied from interface:ManageSnapshotsReplaces the branch with the given name to point to the specified snapshot- Specified by:
- replaceBranchin interface- ManageSnapshots
- Parameters:
- name- Branch to replace
- snapshotId- new snapshot id for the given branch
- Returns:
- this for method chaining
 
- 
replaceBranchDescription copied from interface:ManageSnapshotsReplaces thefrombranch to point to thetosnapshot. Thetowill remain unchanged, andfrombranch will retain its retention properties. If thefrombranch does not exist, it will be created with default retention properties.- Specified by:
- replaceBranchin interface- ManageSnapshots
- Parameters:
- from- Branch to replace
- to- The branch- fromshould be replaced with
- Returns:
- this for method chaining
 
- 
fastForwardBranchDescription copied from interface:ManageSnapshotsPerforms a fast-forward offromup to thetosnapshot iffromis an ancestor ofto. Thetowill remain unchanged, andfromwill retain its retention properties. If thefrombranch does not exist, it will be created with default retention properties.- Specified by:
- fastForwardBranchin interface- ManageSnapshots
- Parameters:
- from- Branch to fast-forward
- to- Ref for the- frombranch to be fast forwarded to
- Returns:
- this for method chaining
 
- 
renameBranchDescription copied from interface:ManageSnapshotsRename a branch- Specified by:
- renameBranchin interface- ManageSnapshots
- Parameters:
- name- name of branch to rename
- newName- the desired new name of the branch
 
- 
applyDescription copied from interface:PendingUpdateApply the pending changes and return the uncommitted changes for validation.This does not result in a permanent update. - Specified by:
- applyin interface- PendingUpdate<Snapshot>
- Returns:
- the uncommitted changes that would be committed by calling PendingUpdate.commit()
 
- 
commitpublic void commit()Description copied from interface:PendingUpdateApply the pending changes and commit.Changes are committed by calling the underlying table's commit method. Once the commit is successful, the updated table will be refreshed. - Specified by:
- commitin interface- PendingUpdate<Snapshot>
 
 
-