nsivabalan commented on code in PR #6549:
URL: https://github.com/apache/hudi/pull/6549#discussion_r960935122
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/transaction/TestInProcessLockProvider.java:
##########
@@ -160,6 +160,48 @@ public void testTryLockReAcquisitionByDifferentThread() {
});
}
+ @Test
+ public void testTryUnLockByDifferentThread() {
+ InProcessLockProvider inProcessLockProvider = new
InProcessLockProvider(lockConfiguration, hadoopConfiguration);
+ final AtomicBoolean writer2Completed = new AtomicBoolean(false);
+ final AtomicBoolean writer3Completed = new AtomicBoolean(false);
+
+ // Main test thread
+ Assertions.assertTrue(inProcessLockProvider.tryLock());
+
+ // Another writer thread
+ Thread writer2 = new Thread(() -> {
Review Comment:
here is the context
writer2 unlocks w/o actually locking. if a non owner unlocks, we don't throw
any exception as such. but intrinsically, the lock is still acquired by the
original owner (wirter1)
and so, we again try to acquire the lock by writer3. if at all the unlocking
by writer2 succeeded above, writer3 should be able to acquire the lock. but we
expect it to fail since writer1 is the orignal owner of the lock.
and hence we need 3 writers to verify this scenario.
--
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]