nastra commented on code in PR #10001:
URL: https://github.com/apache/iceberg/pull/10001#discussion_r1533422080


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java:
##########
@@ -139,22 +212,40 @@ static StorageDescriptor storageDescriptor(TableMetadata 
metadata, boolean hiveE
       
storageDescriptor.setInputFormat("org.apache.hadoop.mapred.FileInputFormat");
       
serDeInfo.setSerializationLib("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe");
     }
+
     storageDescriptor.setSerdeInfo(serDeInfo);
     return storageDescriptor;
   }
 
-  static void cleanupMetadata(FileIO io, String commitStatus, String 
metadataLocation) {
+  default void cleanupMetadataAndUnlock(
+      HiveLock lock,
+      FileIO io,
+      BaseMetastoreOperations.CommitStatus commitStatus,
+      String metadataLocation) {
     try {
-      if (commitStatus.equalsIgnoreCase("FAILURE")) {
+      if (commitStatus.name().equalsIgnoreCase("FAILURE")) {
         // If we are sure the commit failed, clean up the uncommitted metadata 
file
         io.deleteFile(metadataLocation);
       }
     } catch (RuntimeException e) {
       LOG.error("Failed to cleanup metadata file at {}", metadataLocation, e);
+    } finally {
+      lock.unlock();
     }
   }
 
-  default Table newHmsTable(String hmsTableOwner) {
+  default HiveLock lockObject(
+      Map<String, String> properties, Configuration conf, String catalogName) {
+    if (hiveLockEnabled(conf, properties)) {
+      return new MetastoreLock(conf, metaClients(), catalogName, database(), 
table());
+    } else {
+      return new NoLock();
+    }
+  }
+
+  default Table newHmsTable(Map<String, String> properties) {

Review Comment:
   why do we need to change this method's parameter?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to