fix(leader-election): suppress standby lease false positive#72
Open
rswigginton wants to merge 1 commit into
Open
fix(leader-election): suppress standby lease false positive#72rswigginton wants to merge 1 commit into
rswigginton wants to merge 1 commit into
Conversation
In HA (leader election on, 2+ replicas), the non-leader replica logged "no controller is watching nodes" at ERROR every 2x leaseDuration forever, even with a healthy leader. The monitor only watched its own Elected() channel, which never fires on a standby, so it could not tell "another pod is leading" (fine) from "nobody is leading" (the real Nextdoor#55 wedge). monitorLeaseAcquisition now reads the election Lease before escalating. If another replica holds it and renewed within the lease duration, this pod is a standby and logs at debug instead of warning. ERROR is reserved for when no leader is live, preserving Nextdoor#55 detection. The lease namespace is pinned to POD_NAMESPACE (downward API) so the probe and the manager read the same Lease. Tests: healthy standby -> no ERROR; no live leader -> ERROR; a stale lease fed through the real probe -> ERROR (Nextdoor#55 end to end); leaderLeaseLive table. Fixes Nextdoor#70 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In HA (leader election on, 2+ replicas), the non-leader replica logged "no controller is watching nodes" at ERROR every 2x leaseDuration forever, even with a healthy leader. The monitor only watched its own Elected() channel, which never fires on a standby, so it could not tell "another pod is leading" (fine) from "nobody is leading" (the real #55 wedge).
monitorLeaseAcquisition now reads the election Lease before escalating. If another replica holds it and renewed within the lease duration, this pod is a standby and logs at debug instead of warning. ERROR is reserved for when no leader is live, preserving #55 detection.
The lease namespace is pinned to POD_NAMESPACE (downward API) so the probe and the manager read the same Lease.
Tests: healthy standby -> no ERROR; no live leader -> ERROR; a stale lease fed through the real probe -> ERROR (#55 end to end); leaderLeaseLive table.
Fixes #70