Skip to content

Conversation

River2000i
Copy link
Contributor

@River2000i River2000i commented Sep 19, 2024

What problem does this PR solve?

Issue Number: close #55184 ref tikv/pd#8424 ref #54886

Problem Summary:
region distribution not balance in create table with enable tidb_scatter_region in cluster level.

What changed and how does it work?

  1. tidb_scatter_region support "", "table", "global" instead of on and off.
  2. In global, trigger PD scatter region is achieved by passing tableID as nil. When tableID is nil, PD selects new peers based on the cluster level by https://github.com/tikv/pd/blob/13174b5d4cab4d958f0b4ea2718ea7bb74992bc7/pkg/schedule/scatter/region_scatterer.go#L444

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.

refer: https://github.com/pingcap/docs-cn/pull/18626/files

@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. do-not-merge/needs-triage-completed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-tests-checked labels Sep 19, 2024
Copy link

ti-chi-bot bot commented Sep 19, 2024

Hi @River2000i. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

Copy link

tiprow bot commented Sep 19, 2024

Hi @River2000i. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@River2000i
Copy link
Contributor Author

@D3Hunter @Benjamin2037 PTAL~

@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Sep 19, 2024
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 89.28571% with 6 lines in your changes missing coverage. Please review.

Project coverage is 76.4343%. Comparing base (bf455f5) to head (6102476).
Report is 16 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56157        +/-   ##
================================================
+ Coverage   73.4156%   76.4343%   +3.0186%     
================================================
  Files          1605       1656        +51     
  Lines        445006     460780     +15774     
================================================
+ Hits         326704     352194     +25490     
+ Misses        98251      87181     -11070     
- Partials      20051      21405      +1354     
Flag Coverage Δ
integration 52.7683% <75.0000%> (?)
unit 73.1537% <89.2857%> (+0.6459%) ⬆️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 63.0870% <ø> (+17.0560%) ⬆️

@River2000i
Copy link
Contributor Author

/retest

@River2000i
Copy link
Contributor Author

/test pull-br-integration-tes

@River2000i
Copy link
Contributor Author

/test pull-br-integration-test

Copy link

tiprow bot commented Sep 24, 2024

@River2000i: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test pull-br-integration-test

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.

@River2000i
Copy link
Contributor Author

/retest

@ti-chi-bot ti-chi-bot bot added the approved label Sep 24, 2024
@River2000i
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 25, 2024
@River2000i
Copy link
Contributor Author

/retest

1 similar comment
@River2000i
Copy link
Contributor Author

/retest

@River2000i River2000i closed this Sep 25, 2024
@River2000i River2000i reopened this Sep 25, 2024
Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

rest LGTM

tableStartKey := tablecodec.GenTablePrefix(physicalTableID)
regionIDs, err := store.SplitRegions(ctx, [][]byte{tableStartKey}, scatter, &tableID)
scatter, tID := getScatterConfig(scatterScope, tableID)
regionIDs, err := store.SplitRegions(ctx, [][]byte{tableStartKey}, scatter, &tID)
Copy link
Contributor

Choose a reason for hiding this comment

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

so -1 is ok or it should be nil here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both is ok. In client-go, the tableID will convert from *int64 to string. If it's nil, it will equal "0". The -1 is used to distinguish it from the default setting of 0 in client-go.
refer: https://github.com/tikv/client-go/blob/6ba909c4ad2de65b5b36d0e5036d0a85f3154cc0/tikv/split_region.go#L245-L248

@River2000i
Copy link
Contributor Author

/retest

@River2000i
Copy link
Contributor Author

/retest

@River2000i
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 25, 2024
Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Sep 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, benmeadowcroft, GMHDBJD, Leavrth, wjhuang2016

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

@Leavrth
Copy link
Contributor

Leavrth commented Sep 25, 2024

/retest

2 similar comments
@River2000i
Copy link
Contributor Author

/retest

@Leavrth
Copy link
Contributor

Leavrth commented Sep 25, 2024

/retest

@ti-chi-bot ti-chi-bot bot merged commit e5c9867 into pingcap:master Sep 25, 2024
22 of 25 checks passed
@River2000i River2000i deleted the fix-55184 branch September 26, 2024 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

region distribution not balance in create table with enable tidb_scatter_region in cluster level
7 participants