Skip to content

[DO NOT MERGE / test bundle] resourcecontrol: PredictedReadBytes hint for paging pre-charge#1969

Draft
YuhaoZhang00 wants to merge 6 commits into
tikv:masterfrom
YuhaoZhang00:rc-precharge-premium-test
Draft

[DO NOT MERGE / test bundle] resourcecontrol: PredictedReadBytes hint for paging pre-charge#1969
YuhaoZhang00 wants to merge 6 commits into
tikv:masterfrom
YuhaoZhang00:rc-precharge-premium-test

Conversation

@YuhaoZhang00

Copy link
Copy Markdown

Draft / test-bundle PR for the rc-precharge-premium-test integration bundle (Premium / TiDB X variant of the RC paging pre-charge feature).

Summary

  • resourcecontrol: add PredictedReadBytes hint to RequestInfo
  • tikvrpc: tighten PredictedReadBytes field comment

Sibling PRs (test bundle)

  • pingcap/kvproto rc-precharge-premium-test
  • tikv/pd rc-precharge-premium-test
  • pingcap/tidb rc-precharge-premium-test
  • tidbcloud/cloud-storage-engine rc-precharge-premium-test

This branch exists for upstream CI / cross-repo integration testing. Not intended to be merged as-is.

Add a client-go-internal PredictedReadBytes field on tikvrpc.Request so
the caller (e.g. TiDB, maintaining a per-logical-scan EMA across paging
cop RPCs) can supply a learned estimate of how many bytes the request
will read. MakeRequestInfo propagates this into RequestInfo, and the new
RequestInfo.PredictedReadBytes() getter satisfies the optional
predictedReadBytesProvider interface that PD's resource_group/controller
checks via type assertion.

When the hint is > 0, PD uses it as the byte basis for RC paging
pre-charge. Zero means the caller has no prediction (e.g. cold start);
the request is not pre-charged and is billed at settlement time by
actual read bytes only.

The field is kept out of the proto because it is purely a client-side
estimate consumed before the RPC is sent - TiKV neither needs nor reads
it.

Signed-off-by: Yuhao Zhang <yhzhang00@outlook.com>
Drop the verbose restatement of how the hint is produced and consumed;
keep only what a reader of this struct needs to know to set the field.

Signed-off-by: Yuhao Zhang <yhzhang00@outlook.com>
Signed-off-by: Yuhao Zhang <yhzhang00@outlook.com>
PD promoted PredictedReadBytes to a required method on RequestInfo, so
this is no longer an optional duck-typed satisfaction.

Signed-off-by: Yuhao Zhang <yhzhang00@outlook.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the dco. labels May 15, 2026
@ti-chi-bot

ti-chi-bot Bot commented May 15, 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 marsishandsome 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

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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: Pro

Run ID: bb59848a-fde6-48df-ab74-026d9c9e7661

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@ti-chi-bot ti-chi-bot Bot added contribution This PR is from a community contributor. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 15, 2026
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/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant