Skip to content

feat: add CherryPickOperation and wire SnapshotManager::Cherrypick - #926

Open
shangxinli wants to merge 1 commit into
apache:mainfrom
shangxinli:feat/cherry-pick-operation
Open

feat: add CherryPickOperation and wire SnapshotManager::Cherrypick#926
shangxinli wants to merge 1 commit into
apache:mainfrom
shangxinli:feat/cherry-pick-operation

Conversation

@shangxinli

Copy link
Copy Markdown
Contributor

Adds CherryPickOperation and implements SnapshotManager::Cherrypick(), which was a TODO stub.

Follows Java's CherryPickOperation: appends re-apply their added files, dynamic overwrites (replace-partitions) re-apply adds and deletes and are rejected if a replaced partition changed, and anything else can only be fast-forward. Records source-snapshot-id and published-wap-id, and rejects a WAP id that was already published.

Like Java, the operation is reachable only through Transaction, not Table.

One divergence worth a look: Apply() here always builds a new snapshot, so it cannot express Java's fast-forward, which returns an existing one. SnapshotManager instead routes a fast-forward to SetSnapshot, with the predicate in SnapshotUtil::CanFastForward() so there is a single definition. SetSnapshot::RequireFastForward() re-checks it at apply time so a commit retry cannot silently turn the fast-forward into a branch move.

14 tests ported from Java TestSnapshotManager and TestWapWorkflow.

Part of #637.

Implements cherry-picking an append or dynamic partition overwrite onto
the current state, with source-snapshot-id and WAP publish tracking,
non-ancestor and replaced-partition validation. SnapshotManager routes
fast-forwardable picks to SetSnapshot, since those produce no snapshot.

Closes the CherryPickOperation item in apache#637.
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.

1 participant