arunk-kumar commented on PR #6621:
URL: https://github.com/apache/hive/pull/6621#issuecomment-5069536410

   Thanks for the stack trace — that pinpointed it. The switch from 
`daemon.run()` (synchronous) to `daemon.start()` (async) in the earlier commit 
broke a pre-existing invariant: `LeaderElectionContext.start()` used to not 
return until listener callbacks (housekeeping thread creation etc.) had fired 
synchronously, and `TestMetastoreHousekeepingLeaderEmptyConfig` scans for those 
threads immediately after HMS starts.
   
   Fix: join each daemon after starting all of them, so elections still run in 
parallel but `start()` waits until every initial `tryBeLeader()` completes. 
Since `LeaseLeaderElection.tryBeLeader` dispatches lease renewal to a separate 
`Heartbeater`/`NonLeaderWatcher` thread and then returns (rather than looping 
on renewal itself), `join()` terminates in bounded time on success, on 
wait-state, and on retry exhaustion.
   
   `TestLeaderElection` still passes locally: `Tests run: 4, Failures: 0, 
Errors: 0, Skipped: 0`. Couldn't reproduce 
`TestMetastoreHousekeepingLeaderEmptyConfig` locally — upstream 
`itests/hive-unit` build is transiently broken on my end (Iceberg module 
compile issues on master). Relying on Jenkins to verify the fix.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to