Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c/leaders: trigger leadership notification when term changes #16776

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

mmaslankaprv
Copy link
Member

@mmaslankaprv mmaslankaprv commented Feb 28, 2024

When term changes but leader stays on the same we should still trigger the leadership notification.

Downstream components like leadership_balancer rely on this information to be triggered after successful leader election i.e. stable term change.

Fixes: #16142

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x
  • v23.1.x

Release Notes

  • none

When term changes but leader stays on the same we should still trigger
the leadership notification.

Downstream components like `leadership_balancer` rely on this
information to be triggered after successful leader election i.e. stable
term change.

Fixes: redpanda-data#16142

Signed-off-by: Michal Maslanka <michal@redpanda.com>
Leadership notification is triggered only on successful leader election.
We do not need to pass the optional as `leader_id` is always present.

Signed-off-by: Michal Maslanka <michal@redpanda.com>
@mmaslankaprv mmaslankaprv marked this pull request as ready for review February 28, 2024 17:31
@StephanDollberg
Copy link
Member

StephanDollberg commented Feb 28, 2024

When term changes but leader stays on the same we should still trigger the leadership notification.

Under which scenarios does that happen? When we vote but the current leader wins the election?

@mmaslankaprv
Copy link
Member Author

mmaslankaprv commented Feb 28, 2024

Under which scenarios does that happen? When we vote but the current leader wins the election?

it may happen when leadership transfer to desired node fails f.e. transfer request from 2->1 fails and 2 is elected as the leader once again

@StephanDollberg
Copy link
Member

I see, so it should still be relatively rare.

@vbotbuildovich
Copy link
Collaborator

@bharathv bharathv merged commit 99adbbf into redpanda-data:dev Feb 28, 2024
18 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

@vbotbuildovich
Copy link
Collaborator

/backport v23.2.x

@vbotbuildovich
Copy link
Collaborator

Failed to create a backport PR to v23.2.x branch. I tried:

git remote add upstream https://github.com/redpanda-data/redpanda.git
git fetch --all
git checkout -b backport-pr-16776-v23.2.x-224 remotes/upstream/v23.2.x
git cherry-pick -x 386d2b8c2af0adbfd4a8d45b45f35676b4929e89 faed71dc93489ca6f26e1358f53f8f4ddd1fc5c6

Workflow run logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI Failure (Leadership did not stablize) in AutomaticLeadershipBalancingTest.test_automatic_rebalance
4 participants