Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

br/lightning: support pd_enable_follower_handle_region #58653

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Jan 2, 2025

What problem does this PR solve?

Issue Number: close #58651

Problem Summary:

After this pr, if tidb enables pd_enable_follower_handle_region, BR/ lightning will also benefit from this parameter and send ScanRegions/GetRegion to PD follower/leader distributively.

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

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

if TiDB enables `pd_enable_follower_handle_region`, BR/ lightning will also benefit from it.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 2, 2025
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 75.2504%. Comparing base (068b9a8) to head (cfa4ce3).
Report is 18 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58653        +/-   ##
================================================
+ Coverage   73.1093%   75.2504%   +2.1410%     
================================================
  Files          1676       1722        +46     
  Lines        463369     475543     +12174     
================================================
+ Hits         338766     357848     +19082     
+ Misses       103786      95424      -8362     
- Partials      20817      22271      +1454     
Flag Coverage Δ
integration 49.1553% <25.0000%> (?)
unit 72.7672% <75.0000%> (+0.4663%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 61.3535% <50.0000%> (+15.5421%) ⬆️

Signed-off-by: okJiang <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/needs-tests-checked labels Jan 2, 2025
@okJiang
Copy link
Member Author

okJiang commented Jan 2, 2025

/retest

@okJiang
Copy link
Member Author

okJiang commented Jan 2, 2025

@lance6716
Copy link
Contributor

can you provide some information about the behaviour? for example, will the follower returns the latest information like a TiDB follower read?

Please also add this description in the comment of WithAllowFollowerHandle

@okJiang
Copy link
Member Author

okJiang commented Jan 3, 2025

can you provide some information about the behaviour? for example, will the follower returns the latest information like a TiDB follower read?

The followers exist a slight delay compared to the PD leader, and they synchronize region data through a syncer. Therefore, followers may not necessarily return the latest information. I have checked all the modified requests, and they should all have a retry mechanism, as the PD leader cannot guarantee that the region information is up to date.

Whatever, from the actual effect of enabling pd_enable_follower_handle_region in TiDB , this feature still offers significant benefits in scenarios with a massive number of regions. It can significantly reduce the load pressure on the PD leader during POC.

Please also add this description in the comment of WithAllowFollowerHandle

WithAllowFollowerHandle is a client switch. It takes effect in combination with pd_enable_follower_handle_region. This means that when this variable is not set, all requests are the same as before. When this variable is set, only requests that include WithAllowFollowerHandle may be sent to the follower. After discussion, I will add comment to it.

@lance6716

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 3, 2025
Copy link

ti-chi-bot bot commented Jan 3, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, YuJuncen

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

The pull request process is described 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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 3, 2025
Copy link

ti-chi-bot bot commented Jan 3, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-03 04:47:08.807323161 +0000 UTC m=+671364.163327700: ☑️ agreed by lance6716.
  • 2025-01-03 07:26:02.576321337 +0000 UTC m=+680897.932325876: ☑️ agreed by YuJuncen.

@ti-chi-bot ti-chi-bot bot merged commit 65e514e into pingcap:master Jan 3, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Apply pd_enable_follower_handle_region to Lightning/BR
3 participants