Skip to content

Conversation

@AmoebaProtozoa
Copy link
Contributor

@AmoebaProtozoa AmoebaProtozoa commented Oct 30, 2025

What problem does this PR solve?

Issue Number: close #64191

Problem Summary:

What changed and how does it work?

change the way server id was released. Instead of deleting the etcd key directly, which may leak empty lease, close the serverID session instead.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  • tiup playground with local build tiup playground --db.binpath ./bin/tidb-server
  • check server id and lease
# log
[2025/10/30 15:46:46.044 +08:00] [INFO] [domain.go:2678] [acquireServerID] [serverID=1989] ["lease id"=22319a34154c819a]`

# etcdctl
❯ etcdctl --endpoints 127.0.0.1:2379 get "/tidb/server_id/1989" --prefix -w fields
"ClusterID" : 15674009460217235928
"MemberID" : 3474484975246189105
"Revision" : 298
"RaftTerm" : 2
"Key" : "/tidb/server_id/1989"
"CreateRevision" : 207
"ModRevision" : 207
"Version" : 1
"Value" : "0"
"Lease" : 2463920019634684314
"More" : false
"Count" : 1
❯ etcdctl --endpoints 127.0.0.1:2379 lease timetolive 22319a34154c819a
lease 22319a34154c819a granted with TTL(43200s), remaining(43011s)
  • scale-in tidb tiup playground --pid xxx
  • check key and lease removed
# log
[2025/10/30 15:51:10.393 +08:00] [INFO] [domain.go:2703] ["releaseServerID succeed"] [serverID=1989] [leaseID=2463920019634684314]

# etcdctl
❯ etcdctl --endpoints 127.0.0.1:2379 get "/tidb/server_id/1989" --prefix -w fields
"ClusterID" : 15674009460217235928
"MemberID" : 3474484975246189105
"Revision" : 366
"RaftTerm" : 2
"More" : false
"Count" : 0
❯ etcdctl --endpoints 127.0.0.1:2379 lease timetolive 22319a34154c819a
lease 22319a34154c819a already expired

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 30, 2025
@tiprow
Copy link

tiprow bot commented Oct 30, 2025

Hi @AmoebaProtozoa. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@AmoebaProtozoa AmoebaProtozoa changed the title domain: release server id by revoke session Oct 30, 2025
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 30, 2025
@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.8469%. Comparing base (0230916) to head (8a38ec6).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #64192        +/-   ##
================================================
+ Coverage   72.6828%   74.8469%   +2.1640%     
================================================
  Files          1858       1881        +23     
  Lines        502725     510840      +8115     
================================================
+ Hits         365395     382348     +16953     
+ Misses       115087     104881     -10206     
- Partials      22243      23611      +1368     
Flag Coverage Δ
integration 48.1411% <0.0000%> (?)
unit 72.5232% <50.0000%> (+0.2767%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.8700% <ø> (ø)
parser ∅ <ø> (∅)
br 62.2434% <ø> (+15.9062%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 30, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: disksing, hawkingrei
Once this PR has been reviewed and has the lgtm label, please assign wjhuang2016 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.

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 added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 30, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-10-30 07:58:33.163479679 +0000 UTC m=+1549819.240732239: ☑️ agreed by hawkingrei.
  • 2025-10-30 08:20:10.267672507 +0000 UTC m=+1551116.344925057: ☑️ agreed by disksing.
@AmoebaProtozoa
Copy link
Contributor Author

/assign @wjhuang2016

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

Labels

do-not-merge/needs-triage-completed lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

4 participants