Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
import org.apache.iceberg.deletes.PositionDeleteWriter;
import org.apache.iceberg.encryption.EncryptedFiles;
import org.apache.iceberg.encryption.InputFilesDecryptor;
import org.apache.iceberg.exceptions.ForbiddenException;
import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.io.DataWriter;
import org.apache.iceberg.io.FileIO;
Expand Down Expand Up @@ -188,11 +189,26 @@ public void catalogSetup() {

public void catalogCleanup(List<Namespace> namespaces) throws IOException {
for (Namespace namespace : namespaces) {
for (TableIdentifier identifier : catalog.listTables(namespace)) {
catalog.dropTable(identifier);
}
if (catalog instanceof SupportsNamespaces) {
((SupportsNamespaces) catalog).dropNamespace(namespace);
for (int attempt = 1; attempt <= 3; attempt++) {
try {
for (TableIdentifier identifier : catalog.listTables(namespace)) {
catalog.dropTable(identifier);
}
if (catalog instanceof SupportsNamespaces) {
((SupportsNamespaces) catalog).dropNamespace(namespace);
}
break;
} catch (ForbiddenException e) {
if (attempt == 3) {
throw e;
}
try {
Thread.sleep(SETUP_TEARDOWN_SLEEP_MS * attempt);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw new IOException("Interrupted while waiting to retry catalog cleanup", ie);
}
}
}
}
}
Expand Down
Loading