danielcweeks commented on code in PR #18203:
URL: https://github.com/apache/iceberg/pull/18203#discussion_r4095544956


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:
##########
@@ -297,6 +312,60 @@ protected String defaultWarehouseLocation(TableIdentifier 
table) {
     return SLASH.join(defaultNamespaceLocation(table.namespace()), 
tableLocation);
   }
 
+  @Override
+  public Table unregisterTable(TableIdentifier identifier) {
+    Preconditions.checkArgument(
+        identifier != null && isValidIdentifier(identifier), "Invalid 
identifier: %s", identifier);
+
+    TableMetadata initialMetadata = newTableOps(identifier).current();
+    if (initialMetadata == null) {
+      throw new NoSuchTableException("Table does not exist: %s", identifier);
+    }
+
+    AtomicReference<Table> unregistered = new AtomicReference<>();
+    Tasks.foreach(identifier)
+        .retry(initialMetadata.propertyAsInt(COMMIT_NUM_RETRIES, 
COMMIT_NUM_RETRIES_DEFAULT))
+        .exponentialBackoff(
+            initialMetadata.propertyAsInt(
+                COMMIT_MIN_RETRY_WAIT_MS, COMMIT_MIN_RETRY_WAIT_MS_DEFAULT),
+            initialMetadata.propertyAsInt(
+                COMMIT_MAX_RETRY_WAIT_MS, COMMIT_MAX_RETRY_WAIT_MS_DEFAULT),
+            initialMetadata.propertyAsInt(
+                COMMIT_TOTAL_RETRY_TIME_MS, 
COMMIT_TOTAL_RETRY_TIME_MS_DEFAULT),
+            2.0 /* exponential */)
+        .onlyRetryOn(CommitFailedException.class)
+        .run(tableIdentifier -> 
unregistered.set(unregisterTableOnce(tableIdentifier)));

Review Comment:
   This doesn't make sense to me.  Unregister is a single operation, so why do 
we have retry with exponential backoff?  We don't do this for other operations 
like rename.  Overall, seems unnecessary and over complicated.  



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to