Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,6 @@ public ClientPool<IMetaStoreClient, TException> 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.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down