arunk-kumar opened a new pull request, #6621:
URL: https://github.com/apache/hive/pull/6621

   ### What changes were proposed in this pull request?
   
   Install an `UncaughtExceptionHandler` on each election daemon in 
`LeaderElectionContext.start()`. On retry exhaustion it logs the failing 
election at `ERROR` and calls an injectable `abortAction` (default 
`System.exit(1)`), which triggers the existing HMS shutdown-hook chain 
(election `close()`, ZooKeeper deregistration, metrics, servlet server). An 
`AtomicBoolean` guards against a second abort when both electors fail 
concurrently. Also adds `@Category(MetastoreUnitTest.class)` to 
`TestLeaderElection` — the class was previously excluded by the module's 
`test.groups` filter.
   
   
   ### Why are the changes needed?
   
   Retry exhaustion in `LeaseLeaderElection` previously terminated the daemon 
thread with no `UncaughtExceptionHandler` — no log, no audit, no shutdown. HMS 
kept running with no leader for `HOUSEKEEPING` / `ALWAYS_TASKS`, silently 
stalling compaction and stats updates until users noticed via query slowdowns.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. When leader election exhausts metastore.lock.numretries retries, HMS 
now shuts down cleanly instead of remaining up without a leader for its 
housekeeping / always-tasks work. The existing retry knobs remain the tolerance 
dial.
   
   ### How was this patch tested?
   
   Added two unit tests to `TestLeaderElection` that inject a failing 
`LeaderElection` and a fake `abortAction`, asserting the handler fires and that 
concurrent failures still trigger the abort exactly once. Full class runs in 
~4.5s: `Tests run: 4, Failures: 0, Errors: 0, Skipped: 0`.


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