Interface ManageSnapshots

  • All Superinterfaces:
    PendingUpdate<Snapshot>
    All Known Implementing Classes:
    SnapshotManager

    public interface ManageSnapshots
    extends PendingUpdate<Snapshot>
    API for managing snapshots. Allows rolling table data back to a stated at an older table snapshot. Rollback:

    This API does not allow conflicting calls to setCurrentSnapshot(long) and rollbackToTime(long).

    When committing, these changes will be applied to the current table metadata. Commit conflicts will not be resolved and will result in a CommitFailedException. Cherrypick:

    In an audit workflow, new data is written to an orphan snapshot that is not committed as the table's current state until it is audited. After auditing a change, it may need to be applied or cherry-picked on top of the latest snapshot instead of the one that was current when the audited changes were created. This class adds support for cherry-picking the changes from an orphan snapshot by applying them to the current snapshot. The output of the operation is a new snapshot with the changes from cherry-picked snapshot.

    • Method Detail

      • setCurrentSnapshot

        ManageSnapshots setCurrentSnapshot​(long snapshotId)
        Roll this table's data back to a specific Snapshot identified by id.
        Parameters:
        snapshotId - long id of the snapshot to roll back table data to
        Returns:
        this for method chaining
        Throws:
        java.lang.IllegalArgumentException - If the table has no snapshot with the given id
      • rollbackToTime

        ManageSnapshots rollbackToTime​(long timestampMillis)
        Roll this table's data back to the last Snapshot before the given timestamp.
        Parameters:
        timestampMillis - a long timestamp, as returned by System.currentTimeMillis()
        Returns:
        this for method chaining
        Throws:
        java.lang.IllegalArgumentException - If the table has no old snapshot before the given timestamp
      • rollbackTo

        ManageSnapshots rollbackTo​(long snapshotId)
        Rollback table's state to a specific Snapshot identified by id.
        Parameters:
        snapshotId - long id of snapshot id to roll back table to. Must be an ancestor of the current snapshot
        Throws:
        java.lang.IllegalArgumentException - If the table has no snapshot with the given id
        ValidationException - If given snapshot id is not an ancestor of the current state
      • cherrypick

        ManageSnapshots cherrypick​(long snapshotId)
        Apply supported changes in given snapshot and create a new snapshot which will be set as the current snapshot on commit.
        Parameters:
        snapshotId - a snapshotId whose changes to apply
        Returns:
        this for method chaining
        Throws:
        java.lang.IllegalArgumentException - If the table has no snapshot with the given id
        DuplicateWAPCommitException - In case of a WAP workflow and if the table has a duplicate commit with same wapId