deniskuzZ commented on code in PR #4291:
URL: https://github.com/apache/hive/pull/4291#discussion_r1235249683


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -324,19 +326,39 @@ public void 
preAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTable, E
           context.getProperties().get(OLD_TABLE_NAME)).toString());
     }
     if (commitLock == null) {
-      commitLock = new HiveCommitLock(conf, new CachedClientPool(conf, 
Maps.fromProperties(catalogProperties)),
-          catalogProperties.getProperty(Catalogs.NAME), hmsTable.getDbName(), 
hmsTable.getTableName());
+
+      Optional<Long> txnId = getTxnId();
+
+      commitLock = new MetastoreLock(conf, new CachedClientPool(conf, 
Maps.fromProperties(catalogProperties)),
+          catalogProperties.getProperty(Catalogs.NAME), hmsTable.getDbName(), 
hmsTable.getTableName(), txnId);
     }
 
     try {
-      commitLock.acquire();
+      commitLock.lock();
       doPreAlterTable(hmsTable, context);
     } catch (Exception e) {
-      commitLock.release();
+      commitLock.unlock();
       throw new MetaException(StringUtils.stringifyException(e));
     }
   }
 
+  @NotNull
+  private static Optional<Long> getTxnId() {

Review Comment:
   same code was added multiple times



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