From d3892ae2a5112a919d355418732b7e8c40cc97d7 Mon Sep 17 00:00:00 2001 From: ajantha-bhat Date: Sun, 15 May 2022 21:16:27 +0530 Subject: [PATCH] Remove deprecated table.rollback() --- .palantir/revapi.yml | 6 ++ .../java/org/apache/iceberg/Rollback.java | 56 ------------------- .../main/java/org/apache/iceberg/Table.java | 9 --- .../org/apache/iceberg/BaseMetadataTable.java | 5 -- .../java/org/apache/iceberg/BaseTable.java | 5 -- .../org/apache/iceberg/BaseTransaction.java | 5 -- .../apache/iceberg/RollbackToSnapshot.java | 39 ------------- .../org/apache/iceberg/SerializableTable.java | 5 -- 8 files changed, 6 insertions(+), 124 deletions(-) delete mode 100644 api/src/main/java/org/apache/iceberg/Rollback.java delete mode 100644 core/src/main/java/org/apache/iceberg/RollbackToSnapshot.java diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml index 483e7e2344f4..a9d1362538b6 100644 --- a/.palantir/revapi.yml +++ b/.palantir/revapi.yml @@ -85,3 +85,9 @@ acceptedBreaks: - code: "java.method.addedToInterface" new: "method org.apache.iceberg.ReplacePartitions org.apache.iceberg.ReplacePartitions::validateNoConflictingDeletes()" justification: "Accept all changes prior to introductig API compatibility checks" + - code: "java.class.removed" + old: "interface org.apache.iceberg.Rollback" + justification: "{remove deprecated table.rollback}" + - code: "java.method.removed" + old: "method org.apache.iceberg.Rollback org.apache.iceberg.Table::rollback()" + justification: "{remove deprecated table.rollback}" \ No newline at end of file diff --git a/api/src/main/java/org/apache/iceberg/Rollback.java b/api/src/main/java/org/apache/iceberg/Rollback.java deleted file mode 100644 index b73353943670..000000000000 --- a/api/src/main/java/org/apache/iceberg/Rollback.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iceberg; - -import org.apache.iceberg.exceptions.CommitFailedException; - -/** - * API for rolling table data back to the state at an older table {@link Snapshot snapshot}. - *

- * This API does not allow conflicting calls to {@link #toSnapshotId(long)} and - * {@link #toSnapshotAtTime(long)}. - *

- * When committing, these changes will be applied to the current table metadata. Commit conflicts - * will not be resolved and will result in a {@link CommitFailedException}. - */ -public interface Rollback extends PendingUpdate { - - /** - * Roll this table's data back to a specific {@link Snapshot} identified by id. - * - * @param snapshotId long id of the snapshot to roll back table data to - * @return this for method chaining - * @throws IllegalArgumentException If the table has no snapshot with the given id - * @deprecated Replaced by {@link ManageSnapshots#setCurrentSnapshot(long)} - */ - @Deprecated - Rollback toSnapshotId(long snapshotId); - - /** - * Roll this table's data back to the last {@link Snapshot} before the given timestamp. - * - * @param timestampMillis a long timestamp, as returned by {@link System#currentTimeMillis()} - * @return this for method chaining - * @throws IllegalArgumentException If the table has no old snapshot before the given timestamp - * @deprecated Replaced by {@link ManageSnapshots#rollbackToTime(long)} - */ - @Deprecated - Rollback toSnapshotAtTime(long timestampMillis); -} diff --git a/api/src/main/java/org/apache/iceberg/Table.java b/api/src/main/java/org/apache/iceberg/Table.java index 1e9667f4ccd8..6d5a604ca0c4 100644 --- a/api/src/main/java/org/apache/iceberg/Table.java +++ b/api/src/main/java/org/apache/iceberg/Table.java @@ -261,15 +261,6 @@ default AppendFiles newFastAppend() { */ ExpireSnapshots expireSnapshots(); - /** - * Create a new {@link Rollback rollback API} to roll back to a previous snapshot and commit. - * - * @return a new {@link Rollback} - * @deprecated Replaced by {@link #manageSnapshots()} - */ - @Deprecated - Rollback rollback(); - /** * Create a new {@link ManageSnapshots manage snapshots API} to manage snapshots in this table and commit. * @return a new {@link ManageSnapshots} diff --git a/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java b/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java index f4966352ecd6..06f0edb61a55 100644 --- a/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java +++ b/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java @@ -221,11 +221,6 @@ public ExpireSnapshots expireSnapshots() { throw new UnsupportedOperationException("Cannot expire snapshots from a metadata table"); } - @Override - public Rollback rollback() { - throw new UnsupportedOperationException("Cannot roll back a metadata table"); - } - @Override public ManageSnapshots manageSnapshots() { throw new UnsupportedOperationException("Cannot manage snapshots in a metadata table"); diff --git a/core/src/main/java/org/apache/iceberg/BaseTable.java b/core/src/main/java/org/apache/iceberg/BaseTable.java index b9886f0a1e68..c12205f2b733 100644 --- a/core/src/main/java/org/apache/iceberg/BaseTable.java +++ b/core/src/main/java/org/apache/iceberg/BaseTable.java @@ -194,11 +194,6 @@ public ExpireSnapshots expireSnapshots() { return new RemoveSnapshots(ops); } - @Override - public Rollback rollback() { - return new RollbackToSnapshot(name, ops); - } - @Override public ManageSnapshots manageSnapshots() { return new SnapshotManager(name, ops); diff --git a/core/src/main/java/org/apache/iceberg/BaseTransaction.java b/core/src/main/java/org/apache/iceberg/BaseTransaction.java index 70410b682434..7024ec7a353f 100644 --- a/core/src/main/java/org/apache/iceberg/BaseTransaction.java +++ b/core/src/main/java/org/apache/iceberg/BaseTransaction.java @@ -703,11 +703,6 @@ public ExpireSnapshots expireSnapshots() { return BaseTransaction.this.expireSnapshots(); } - @Override - public Rollback rollback() { - throw new UnsupportedOperationException("Transaction tables do not support rollback"); - } - @Override public ManageSnapshots manageSnapshots() { throw new UnsupportedOperationException("Transaction tables do not support managing snapshots"); diff --git a/core/src/main/java/org/apache/iceberg/RollbackToSnapshot.java b/core/src/main/java/org/apache/iceberg/RollbackToSnapshot.java deleted file mode 100644 index 3497d83182a1..000000000000 --- a/core/src/main/java/org/apache/iceberg/RollbackToSnapshot.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iceberg; - -class RollbackToSnapshot extends SnapshotManager implements Rollback { - - RollbackToSnapshot(String tableName, TableOperations ops) { - super(tableName, ops); - } - - @Override - public Rollback toSnapshotId(long snapshotId) { - super.setCurrentSnapshot(snapshotId); - return this; - } - - @Override - public Rollback toSnapshotAtTime(long timestampMillis) { - super.rollbackToTime(timestampMillis); - return this; - } -} diff --git a/core/src/main/java/org/apache/iceberg/SerializableTable.java b/core/src/main/java/org/apache/iceberg/SerializableTable.java index 403e2e39de37..df9ea1a089d1 100644 --- a/core/src/main/java/org/apache/iceberg/SerializableTable.java +++ b/core/src/main/java/org/apache/iceberg/SerializableTable.java @@ -327,11 +327,6 @@ public ExpireSnapshots expireSnapshots() { throw new UnsupportedOperationException(errorMsg("expireSnapshots")); } - @Override - public Rollback rollback() { - throw new UnsupportedOperationException(errorMsg("rollback")); - } - @Override public ManageSnapshots manageSnapshots() { throw new UnsupportedOperationException(errorMsg("manageSnapshots"));