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


##########
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStatistics.java:
##########
@@ -130,6 +130,28 @@ public void testStatsWithInsert() {
     checkColStatMinMaxValue(identifier.name(), "customer_id", 0, 5);
   }
 
+  @Test
+  public void testStatsWithPessimisticLockInsert() {
+    TableIdentifier identifier = TableIdentifier.of("default", "customers");
+
+    shell.setHiveSessionValue(HiveConf.ConfVars.HIVE_STATS_AUTOGATHER.varname, 
true);
+    
shell.setHiveSessionValue(HiveConf.ConfVars.HIVE_TXN_EXT_LOCKING_ENABLED.varname,
 true);
+    testTables.createTable(shell, identifier.name(), 
HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
+        PartitionSpec.unpartitioned(), fileFormat, ImmutableList.of(), 1,
+        ImmutableMap.of(TableProperties.HIVE_LOCK_ENABLED, "false"));

Review Comment:
   I would like to clarify something.
   Even after this fix, when `HIVE_LOCK_ENABLED`=`true`, the STATS TASK 
(`HiveIcebergMetaHook`) does not acquire the HMS lock during the INSERT query, 
but the MOVE TASK (`HiveTableOperations`) still acquires the HMS lock. This 
leads to a deadlock with pessimistic lock.
   
   Given this, I understand that if you want to use pessimistic locking with 
Iceberg tables, you should set `HIVE_LOCK_ENABLED`=`false`. If not, it seems 
that modifications might be necessary in `HiveTableOperations` to enable the 
use of pessimistic locking regardless of the `HIVE_LOCK_ENABLED`.
   
   Could you please confirm if my understanding is correct?



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