Skip to content

Feat(router service): implement grpc function#9723

Merged
ti-chi-bot[bot] merged 15 commits intotikv:masterfrom
bufferflies:feat/router_grpc_impl
Nov 5, 2025
Merged

Feat(router service): implement grpc function#9723
ti-chi-bot[bot] merged 15 commits intotikv:masterfrom
bufferflies:feat/router_grpc_impl

Conversation

@bufferflies
Copy link
Copy Markdown
Contributor

@bufferflies bufferflies commented Sep 5, 2025

What problem does this PR solve?

Issue Number: Ref #9212

What is changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

None.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Sep 5, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 5, 2025
Signed-off-by: 童剑 <1045931706@qq.com>
Signed-off-by: 童剑 <1045931706@qq.com>
Signed-off-by: 童剑 <1045931706@qq.com>
Signed-off-by: 童剑 <1045931706@qq.com>
Signed-off-by: 童剑 <1045931706@qq.com>
Signed-off-by: 童剑 <1045931706@qq.com>
@bufferflies bufferflies force-pushed the feat/router_grpc_impl branch 3 times, most recently from 44f7459 to 54a2392 Compare October 14, 2025 12:33
@bufferflies bufferflies marked this pull request as ready for review October 14, 2025 12:33
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 14, 2025
@bufferflies bufferflies force-pushed the feat/router_grpc_impl branch 5 times, most recently from e14be22 to 238b1b4 Compare October 15, 2025 04:41
Signed-off-by: 童剑 <1045931706@qq.com>
@bufferflies bufferflies force-pushed the feat/router_grpc_impl branch from 238b1b4 to 9a85795 Compare October 15, 2025 08:48
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 53.21337% with 182 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.60%. Comparing base (a749e77) to head (96f8937).
⚠️ Report is 6 commits behind head on master.

❌ Your patch status has failed because the patch coverage (53.21%) is below the target coverage (74.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9723      +/-   ##
==========================================
- Coverage   78.68%   78.60%   -0.08%     
==========================================
  Files         492      494       +2     
  Lines       66274    66299      +25     
==========================================
- Hits        52148    52115      -33     
- Misses      10418    10467      +49     
- Partials     3708     3717       +9     
Flag Coverage Δ
unittests 78.60% <53.21%> (-0.08%) ⬇️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bufferflies
Copy link
Copy Markdown
Contributor Author

/test pull-unit-test-next-gen

@bufferflies
Copy link
Copy Markdown
Contributor Author

/ping @rleungx @okJiang

PendingPeers: region.GetPendingPeers(),
Buckets: buckets,
}, nil
request.NeedBuckets = !*followerHandle && rc.GetStoreConfig().IsEnableRegionBucket() && request.GetNeedBuckets()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about wrap a function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three variables from different structures, it seems so strange if a new function needs three parameters.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 29, 2025
// See the License for the specific language governing permissions and
// limitations under the License.

package grpc
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we choose a better package name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about move this into the pkg/utils/grpcutil/grpcutil.go?

)

// IncRegionRequestCounter increments the region request counter with the given method, header, error, and counter.
func IncRegionRequestCounter(method string, header *pdpb.RequestHeader, err *pdpb.Error, counter *prometheus.CounterVec) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest moving back to metrics.go

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

// BatchScanRegions implements gRPC PDServer.
func BatchScanRegions(rc *core.BasicCluster, request *pdpb.BatchScanRegionsRequest, isFollower bool) (resp *pdpb.BatchScanRegionsResponse, err error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems no need to use a new package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: 童剑 <1045931706@qq.com>
)

// IncRegionRequestCounter increments the region request counter with the given method, header, error, and counter.
func IncRegionRequestCounter(method string, header *pdpb.RequestHeader, err *pdpb.Error, counter *prometheus.CounterVec) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in metering?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: 童剑 <1045931706@qq.com>
@bufferflies bufferflies requested a review from rleungx November 4, 2025 07:52
)

// RegionRequestCounter increments the region request counter with the given method, header, error, and counter.
func RegionRequestCounter(method string, header *pdpb.RequestHeader, err *pdpb.Error, counter *prometheus.CounterVec) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func RegionRequestCounter(method string, header *pdpb.RequestHeader, err *pdpb.Error, counter *prometheus.CounterVec) {
func RequestCounter(method string, header *pdpb.RequestHeader, err *pdpb.Error, counter *prometheus.CounterVec) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: 童剑 <1045931706@qq.com>
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Nov 4, 2025

@bufferflies: 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
non-block/pull-unit-test-next-gen 050093d link false /test pull-unit-test-next-gen

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.

@bufferflies
Copy link
Copy Markdown
Contributor Author

/test pull-unit-test-next-gen

@bufferflies
Copy link
Copy Markdown
Contributor Author

/test pull-integration-realcluster-test

@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Nov 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: okJiang, rleungx

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

The pull request process is described 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 lgtm approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 5, 2025
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Nov 5, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-10-29 09:42:44.62911585 +0000 UTC m=+1469670.706368410: ☑️ agreed by okJiang.
  • 2025-11-05 02:56:04.972749804 +0000 UTC m=+238814.415779673: ☑️ agreed by rleungx.

@bufferflies bufferflies requested a review from rleungx November 5, 2025 02:56
@ti-chi-bot ti-chi-bot bot merged commit 7f7165e into tikv:master Nov 5, 2025
36 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. 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.

3 participants