InvisibleProgrammer commented on code in PR #5722:
URL: https://github.com/apache/hive/pull/5722#discussion_r2024253417


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -422,6 +426,32 @@ public void 
preAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTable, E
     }
   }
 
+  private HiveLock lockObject(org.apache.hadoop.hive.metastore.api.Table 
hmsTable) {
+    if (hiveLockEnabled(hmsTable, conf)) {
+      return new MetastoreLock(conf, new CachedClientPool(conf, 
Maps.fromProperties(catalogProperties)),
+          catalogProperties.getProperty(Catalogs.NAME), hmsTable.getDbName(), 
hmsTable.getTableName());
+    } else {
+      return new NoLock();
+    }
+  }
+
+  private static boolean 
hiveLockEnabled(org.apache.hadoop.hive.metastore.api.Table hmsTable, 
Configuration conf) {
+    if (SessionStateUtil.getQueryState(conf).map(QueryState::getHiveOperation)

Review Comment:
   If I understood it correctly, the evaluation order of deciding if locking is 
enabled is: session level -> table properties -> config file. 
   
   Am I correct? 
   The other question is: What is the user experience if the enable locking, 
disable locking on a session level, forget about it and use a table when 
locking is explicitly enabled on table level? 
   Should we give at least a warning in that case just to be able to 
troubleshoot it? 



-- 
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: gitbox-unsubscr...@hive.apache.org

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


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

Reply via email to