prodeezy commented on a change in pull request #695: [WIP] Cherrypick snapshot
feature
URL: https://github.com/apache/incubator-iceberg/pull/695#discussion_r364982163
##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -391,17 +401,34 @@ public TableMetadata addStagedSnapshot(Snapshot
snapshot) {
}
public TableMetadata replaceCurrentSnapshot(Snapshot snapshot) {
- List<Snapshot> newSnapshots = ImmutableList.<Snapshot>builder()
- .addAll(snapshots)
- .add(snapshot)
- .build();
- List<HistoryEntry> newSnapshotLog = ImmutableList.<HistoryEntry>builder()
- .addAll(snapshotLog)
- .add(new SnapshotLogEntry(snapshot.timestampMillis(),
snapshot.snapshotId()))
- .build();
- return new TableMetadata(null, uuid, location,
- snapshot.timestampMillis(), lastColumnId, schema, defaultSpecId,
specs, properties,
- snapshot.snapshotId(), newSnapshots, newSnapshotLog,
addPreviousFile(file, lastUpdatedMillis));
+ // there can be operations (viz. rollback, cherrypick) where an existing
snapshot could be replacing current
Review comment:
The only issue with keeping `replaceCurrentSnapshot` and
`setCurrentSnapshotTo` separate is that cherrypick and rollback workflows will
then need to override `commit()` and hence re-implement retry logic inside
their `commit()` logic (all the things `SnapshotProducer` is doing for us
today). The reason I incorporated logic for existing and new snapshot inside
`replaceCurrentSnapshot` was coz now rollback and cherrypick workflows rely on
this method ( and not `setCurrentSnapshotTo` - erstwhile `rollbackTo` ).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]