You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/12/28 18:30:33 UTC

[GitHub] [iceberg] giovannifumarola commented on a change in pull request #1998: Hive: ensure unlock is called when new metadata cannot be deleted

giovannifumarola commented on a change in pull request #1998:
URL: https://github.com/apache/iceberg/pull/1998#discussion_r549445722



##########
File path: hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
##########
@@ -367,6 +363,20 @@ private long acquireLock() throws UnknownHostException, TException, InterruptedE
     return lockId;
   }
 
+  private void cleanupMetadataAndUnlock(boolean errorThrown, String metadataLocation, Optional<Long> lockId) {
+    try {
+      if (errorThrown) {
+        // if anything went wrong, clean up the uncommitted metadata file
+        io().deleteFile(metadataLocation);
+      }
+    } catch (RuntimeException e) {
+      LOG.error("Fail to cleanup metadata file at {}", metadataLocation, e);
+      throw e;

Review comment:
       Not a fan of Throw within a Catch.
   Maybe you can wrap it in something else.
   




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org