Skip to content

server, member, election: document and test the election client pinning (#11110) - #11188

Open
ti-chi-bot wants to merge 1 commit into
tikv:release-8.5from
ti-chi-bot:cherry-pick-11110-to-release-8.5
Open

server, member, election: document and test the election client pinning (#11110)#11188
ti-chi-bot wants to merge 1 commit into
tikv:release-8.5from
ti-chi-bot:cherry-pick-11110-to-release-8.5

Conversation

@ti-chi-bot

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #11110

What problem does this PR solve?

Issue Number: ref #11106, ref #10671, ref #10746, ref #7780

#9986 made the etcd client health checker optional and created the election client with it disabled. The election client is built from the member's own advertise client URLs, and only the health checker rewrites that endpoint list, so leaving it off confines leader lease renewals to the local etcd server.

The constraint is not recorded anywhere in the tree and no test asserts it. This PR supplies the missing documentation and tests. It changes no behaviour.

What is changed and how does it work?

Record why the election client's health checker must stay disabled: at the call
site, and in newClient, where AutoSyncInterval must remain unset. Document on
GetEtcdLeader what may and may not depend on it, listing every current caller.

Add three integration tests. The first asserts that the election client's
endpoints stay equal to the local advertise URLs while the health checked
server client discovers its peers. The other two assert that a member ends its
term when its renewals fail locally, and when its lease is revoked, in both
cases with the colocation check blinded so that it cannot be what fires.

Two failpoints support them: staleEtcdLeaderView on Member.GetEtcdLeader,
matched by member name, and keepAliveFailed in the lease keepalive worker,
matched as "<purpose>@<name>" so that enabling it affects a single member of an
in-process cluster.

No behaviour change.

Check List

Tests

  • Integration test

Release note

None.

Summary by CodeRabbit

  • Bug Fixes

    • Leadership now steps down promptly when its lease is revoked or renewal fails, including when status information is temporarily stale.
    • Election connections remain tied to the local member, improving leadership-lease validation and preventing misleading continued leadership.
  • Tests

    • Added coverage for lease-loss handling, failed renewals, stale status views, and local election connection behavior.
  • Documentation

    • Clarified expected election-client and leadership behavior during connectivity or progress changes.

ref tikv#7780, ref tikv#10671, ref tikv#10746, ref tikv#11106

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a PR is ready to be tested. labels Sep 2, 2026
@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 2, 2026
@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 2, 2026
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Sep 2, 2026
@ti-chi-bot

ti-chi-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yisaer for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot

ti-chi-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be LGTMed and approved by the reviewers firstly.
  2. For pull requests to TiDB-x branches, it must have no failed tests.
  3. AFTER it has lgtm and approved labels, please wait for the cherry-pick merging approval from triage owners.
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 0fc3b7b4-9851-43d7-b63e-a36d3e9c813e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 2, 2026
@ti-chi-bot

ti-chi-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@ti-chi-bot: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-build-release-8.5 352d0bd link true /test pull-build-release-8.5

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/cherry-pick-not-approved do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants