diff --git a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java index 6fed33167696..2eab6f28065a 100644 --- a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java +++ b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java @@ -304,16 +304,6 @@ public ClientPool metaClients() { return metaClients; } - void doUnlock(HiveLock lock) { - if (lock != null) { - try { - lock.unlock(); - } catch (Exception e) { - LOG.warn("Failed to unlock {}.{}", database, tableName, e); - } - } - } - /** * Returns if the hive engine related values should be enabled on the table, or not. *

diff --git a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java index 9ff99edd163c..c091aa60875a 100644 --- a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java +++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java @@ -281,7 +281,6 @@ public void testLockAcquisitionAfterFailedNotFoundLock() throws TException, Inte .doReturn(acquiredLockResponse) .when(spyClient) .checkLock(eq(dummyLockId)); - doNothing().when(spyOps).doUnlock(any()); doNothing().when(spyClient).heartbeat(eq(0L), eq(dummyLockId)); spyOps.doCommit(metadataV2, metadataV1); @@ -307,7 +306,6 @@ public void testLockAcquisitionAfterFailedAndFoundLock() throws TException, Inte doReturn(showLocksResponse).when(spyClient).showLocks(any()); doReturn(acquiredLockResponse).when(spyClient).checkLock(eq(dummyLockId)); - doNothing().when(spyOps).doUnlock(any()); doNothing().when(spyClient).heartbeat(eq(0L), eq(dummyLockId)); spyOps.doCommit(metadataV2, metadataV1); @@ -569,11 +567,11 @@ public void testTableLevelProcessLockBlocksConcurrentHMSRequestsForSameTable() t } @Test - public void testLockHeartbeat() throws TException { + public void testLockHeartbeat() throws TException, InterruptedException { doReturn(acquiredLockResponse).when(spyClient).lock(any()); doAnswer(AdditionalAnswers.answersWithDelay(2000, InvocationOnMock::callRealMethod)) - .when(spyClient) - .getTable(any(), any()); + .when(spyOps) + .loadHmsTable(); doNothing().when(spyClient).heartbeat(eq(0L), eq(dummyLockId)); spyOps.doCommit(metadataV2, metadataV1);