apache / helix

Mirror of Apache Helix
Apache License 2.0
457 stars 218 forks source link

MetaClient leader election isLeader method NPE #2798

Closed GrantPSpencer closed 2 months ago

GrantPSpencer commented 3 months ago

Issues

Description

Add null pointer check to isLeader() method. isLeader() will now return false when isLeader() is called before the client joins the leader election participant pool. Added test to assert NPE no longer thrown and that isLeader() returns false in above scenario.

Tests

testIsLeaderBeforeJoiningParticipantPool in TestLeaderElection.java

Changes that Break Backward Compatibility (Optional)

Commits

Code Quality

GrantPSpencer commented 2 months ago

Pull request approved by @xyuanlu , @desaikomal , @MarkGaox Commit message: Prevent MetaClient LeaderElectionClient isLeader NPE before joining pool