rdblue commented on a change in pull request #695: [WIP] Cherrypick snapshot 
feature
URL: https://github.com/apache/incubator-iceberg/pull/695#discussion_r368056858
 
 

 ##########
 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:
   Sounds good to me. I agree that it's worth it to avoid overriding commit. 
Should we also make `setCurrentSnapshotTo` private?

----------------------------------------------------------------
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]

Reply via email to