Skip to content

pdpb: preserve caller components in QueryRegion requests - #1542

Open
JmPotato wants to merge 1 commit into
pingcap:masterfrom
JmPotato:query-region-request-components
Open

JmPotato wants to merge 1 commit into
pingcap:masterfrom
JmPotato:query-region-request-components

Conversation

@JmPotato

@JmPotato JmPotato commented Sep 22, 2026

Copy link
Copy Markdown
Member

QueryRegion can contain logical queries from different caller components, but its shared request header carries only one component. Per-query metadata lets PD attribute these queries correctly while retaining mixed batches.

Add optional id_caller_components, key_caller_components, and prev_key_caller_components arrays, aligned by position with ids, keys, and prev_keys. An absent or mismatched array falls back to header.caller_component; an empty entry represents an unknown component. Existing field numbers and response encoding remain unchanged, and older receivers ignore the new fields.

Update the generated Go bindings and protocol lock. Related: tikv/pd#11180.

Validation: make go (protocol formatting, compatibility checks, generation, module tidy, and Go build), go build ./pkg/..., and go test ./pkg/pdpb ./pkg/routerpb.

Summary by CodeRabbit

  • New Features
    • Query requests now support optional caller-component information for ID, key, and previous-key lookups.
    • Caller components can be specified per query, with unspecified or unknown entries handled automatically.

Add optional caller component arrays aligned with each query selector.
Define header fallback for missing or mismatched arrays so receivers can
attribute logical requests without splitting mixed-component batches.

Regenerate Go bindings and update the protocol lock.

Signed-off-by: JmPotato <github@ipotato.me>
@ti-chi-bot

ti-chi-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

[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 likidu, you06 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 added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 22, 2026
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bf626114-be50-4c60-854b-ab0c714214d3

📥 Commits

Reviewing files that changed from the base of the PR and between 0e902ba and fa85d26.

⛔ Files ignored due to path filters (2)
  • pkg/pdpb/pdpb.pb.go is excluded by !**/*.pb.go
  • scripts/proto.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • proto/pdpb.proto

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

QueryRegionRequest adds optional caller-component arrays for ID, key, and previous-key queries. Arrays use positional matching. Missing or incorrectly sized arrays fall back to header.caller_component; empty entries represent unknown components.

Changes

Query caller components

Layer / File(s) Summary
QueryRegionRequest caller-component fields
proto/pdpb.proto
QueryRegionRequest adds id_caller_components, key_caller_components, and prev_key_caller_components. Each array aligns with its query category and defines fallback behavior.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Feature

Suggested reviewers: disksing

Merge Risk: ⚪ Minimal · up to fa85d

The request can preserve per-query caller metadata while remaining compatible with existing receivers; no merge-blocking risk is currently identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving caller components in QueryRegion requests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

I’m a rabbit with fields in a row
Caller components now know where to go
IDs, keys, and old keys align
Empty hops mark unknown by design
If lengths go astray
The header leads the way

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

@ti-chi-bot

ti-chi-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

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

Labels

do-not-merge/needs-linked-issue size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant