rdblue commented on a change in pull request #695: [WIP] Cherrypick snapshot
feature
URL: https://github.com/apache/incubator-iceberg/pull/695#discussion_r368045957
##########
File path: core/src/main/java/org/apache/iceberg/RollbackToSnapshot.java
##########
@@ -19,61 +19,21 @@
package org.apache.iceberg;
-import com.google.common.base.Preconditions;
-import org.apache.iceberg.exceptions.ValidationException;
-
-class RollbackToSnapshot implements Rollback {
- private final TableOperations ops;
+class RollbackToSnapshot extends SnapshotManager implements Rollback {
private TableMetadata base = null;
private Long targetSnapshotId = null;
RollbackToSnapshot(TableOperations ops) {
- this.ops = ops;
- this.base = ops.current(); // do not retry
+ super(ops);
}
@Override
public Rollback toSnapshotId(long snapshotId) {
- Preconditions.checkArgument(base.snapshot(snapshotId) != null,
- "Cannot roll back to unknown snapshot id: %s", snapshotId);
-
- this.targetSnapshotId = snapshotId;
-
- return this;
+ return (Rollback) super.setCurrentSnapshot(snapshotId);
Review comment:
I don't think the cast is needed. It can return `this` instead:
```java
public Rollback toSnapshotId(long snapshotId) {
super.setCurrentSnapshot(snapshotId);
return this;
}
```
----------------------------------------------------------------
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]