api/etcdserverpb/rpc.proto: add leader_id response header - #22327
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gyuho The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @gyuho. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
/ok-to-test |
|
The commit requires author to signoff by |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
... and 25 files with indirect coverage changes @@ Coverage Diff @@
## main #22327 +/- ##
==========================================
- Coverage 69.76% 69.72% -0.05%
==========================================
Files 448 448
Lines 38159 38164 +5
==========================================
- Hits 26622 26610 -12
- Misses 10107 10122 +15
- Partials 1430 1432 +2 Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Add leader_id (field 5) to the ResponseHeader proto and populate it at every server-side fill site from RaftStatusGetter.Leader(). That interface is already wired at each site. The field is advisory: 0 means the responding member does not know who the leader is. It is not a fencing token and is not atomic with raft_term. Old clients ignore the field; new clients treat 0 as "no hint." Covers all v3 RPC responses through fillWithoutRevision / fill, newResponseHeader (watch), ClusterServer.header, EtcdServer.newHeader, and applierV3backend.newHeader. ref. etcd-io#22268 Signed-off-by: Gyuho Lee <gyuhol@nvidia.com>
43ef676 to
575d780
Compare
(/cc @SaranBalaji90 @jamesmthompson)
Adds
leader_id(field 5) to the v3ResponseHeaderand fills it at every server-side header site from the already-wiredRaftStatusGetter.Leader(). The field is optional:0means "no hint," and it is not a fencing token. Old clients ignore it; new clients treat0from old servers as "unknown leader." Cost is at most ~11 bytes per response for a value the server already holds in memory.Today a client must poll
Statusto learn the leader; this field puts that leader member ID in every Put/Get/Watch response, which is what Phase 2's opt-in leader-aware balancer builds on.A new common-suite test (
TestResponseHeaderLeaderId, integration and e2e) verifiesleader_idis nonzero once a leader is elected, matches each member'sstatus.leader, agrees across members, and appears on Put and Get, with mixed-version clusters checked per current-version endpoint.c.f., #22268