fix(hive-sync): drop the unreachable HMS lock timeout-recovery path - #19371
Conversation
|
@voonhous could you please review this too. |
f7645fb to
fc893fd
Compare
hudi-agent
left a comment
There was a problem hiding this comment.
Thanks for the contribution! This PR removes an unreachable HMS lock timeout-recovery branch so that an acquire timeout now reports a TimeoutException-caused HoodieLockException instead of a misleading error, and adds a focused test. No issues flagged from this automated pass — a Hudi committer or PMC member can take it from here for a final review.
cc @yihua
voonhous
left a comment
There was a problem hiding this comment.
Reviewed the removal itself and it holds up. LockRequestBuilder.build() never sets txnid (only setTransactionId(long) does, and the provider never calls it), so getTxnid() returns 0 and TxnHandler.checkLock throws NoSuchLockException for lock id 0 -- lock ids come from NEXT_LOCK_ID, seeded at 1.
Worth adding to the PR body: there is a second, independent reason the branch was dead. Both callers of acquireLockInternal are gated by ValidationUtils.checkArgument(this.lock == null), and the only assignment to lock inside the try is the get(time, unit) that threw, so this.lock == null was always true at the catch site -- the state == ACQUIRED adopt-and-return branch could never be taken even if checkLock had been given the right id.
Two notes on the new test below.
hudi-agent
left a comment
There was a problem hiding this comment.
Thanks for working on this! This PR removes the unreachable HMS lock timeout-recovery branch in HiveMetastoreBasedLockProvider.acquireLockInternal so an acquire timeout now surfaces a TimeoutException cause instead of a misleading NoSuchLockException. Tracing both the old and new paths, the removed branch could not recover against a real metastore (it looked up lockRequest.getTxnid(), which is 0 for a request never populated from a server response), and the server-granted-lock leak behavior is unchanged, so this is a net improvement. No new issues flagged from this automated pass beyond what other reviewers already noted on the test. Please take a look at any inline comments, and this should be ready for a Hudi committer or PMC member to take it from here.
cc @yihua
|
On the second reason: with Leaving the body as is on that basis, since the txnid-0 argument stays the only reason the recovery was dead. |
Describe the issue this Pull Request addresses
Closes #19345, point 1. Point 2 of that issue is addressed by #19370.
Summary and Changelog
An acquire that times out now reports the timeout instead of a misleading
NoSuchLockException.catch (InterruptedException | TimeoutException e)block fromHiveMetastoreBasedLockProvider.acquireLockInternal. Both exceptions are already declared by the method, so they propagate andtryLockwraps the actualTimeoutException.lockRequestlocal and itslockRequestFinalcopy into one final local, since they only existed to feedcheckLockafter thetryblock.TestHiveMetastoreBasedLockProviderAcquireTimeouton top of the sharedHiveMetastoreBasedLockProviderTestBase: with a mockedIMetaStoreClientwhoselock()never answers, the acquire must fail withHoodieLockExceptioncaused byTimeoutExceptionand must not callcheckLock. Without this change that test fails with a bareNullPointerException.Impact
HoodieLockExceptionon an acquire timeout is now caused byTimeoutExceptionrather thanNoSuchLockException. No API or configuration change.Risk Level
low
The removed code could not execute against a real metastore, so no working behaviour is taken away.
Documentation Update
none
Contributor's checklist