Skip to content

executor: support new sql syntax show distribution jobs and distribute table t1 #60169

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

Merged
merged 17 commits into from
Apr 18, 2025

Conversation

bufferflies
Copy link
Contributor

@bufferflies bufferflies commented Mar 19, 2025

What problem does this PR solve?

Issue Number: close #60063

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
    Side effects
mysql> distribute table t rule=leader engine=tikv;
+--------+
| JOB_ID |
+--------+
|      0 |
+--------+
mysql> show distribution jobs;
+--------+----------+-------+----------------+--------+---------+----------+---------------------+---------------------+---------------------+
| Job_ID | Database | Table | Partition_List | Engine | Rule    | Status   | Create_Time         | Start_Time          | Finish_Time         |
+--------+----------+-------+----------------+--------+---------+----------+---------------------+---------------------+---------------------+
|      0 | test     | t     |                | tikv   | leader  | finished | 2025-04-03 11:44:34 | 2025-04-03 11:44:34 | 2025-04-03 12:44:38 |
|      1 | test     | t     |                | tikv   | learner | finished | 2025-04-03 11:44:46 | 2025-04-03 12:44:43 | 2025-04-03 13:44:43 |
+--------+----------+-------+----------------+--------+---------+----------+---------------------+---------------------+---------------------+
mysql> show distribution job 1;
+--------+----------+-------+----------------+--------+---------+----------+---------------------+---------------------+---------------------+
| Job_ID | Database | Table | Partition_List | Engine | Rule    | Status   | Create_Time         | Start_Time          | Finish_Time         |
+--------+----------+-------+----------------+--------+---------+----------+---------------------+---------------------+---------------------+
|      1 | test     | t     |                | tikv   | learner | finished | 2025-04-03 11:44:46 | 2025-04-03 12:44:43 | 2025-04-03 13:44:43 |
+--------+----------+-------+----------------+--------+---------+----------+---------------------+---------------------+---------------------+

Documentation

Release note

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

None

Copy link

ti-chi-bot bot commented Mar 19, 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/needs-tests-checked 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. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 19, 2025
Copy link

tiprow bot commented Mar 19, 2025

Hi @bufferflies. 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.

Signed-off-by: 童剑 <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 27, 2025
@bufferflies bufferflies marked this pull request as ready for review March 27, 2025 08:45
@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 Mar 27, 2025
Signed-off-by: 童剑 <[email protected]>
Signed-off-by: 童剑 <[email protected]>
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 65.67164% with 92 lines in your changes missing coverage. Please review.

Project coverage is 75.5165%. Comparing base (83ee05d) to head (dbcbba6).
Report is 59 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #60169        +/-   ##
================================================
+ Coverage   73.0789%   75.5165%   +2.4375%     
================================================
  Files          1711       1762        +51     
  Lines        473515     495113     +21598     
================================================
+ Hits         346040     373892     +27852     
+ Misses       106161      98560      -7601     
- Partials      21314      22661      +1347     
Flag Coverage Δ
integration 49.1394% <2.2388%> (?)
unit 72.8531% <65.6716%> (+0.5477%) ⬆️

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

Components Coverage Δ
dumpling 52.6553% <ø> (ø)
parser ∅ <ø> (∅)
br 61.9120% <ø> (+14.7002%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: 童剑 <[email protected]>
Signed-off-by: bufferflies <[email protected]>
Signed-off-by: bufferflies <[email protected]>
@ti-chi-bot ti-chi-bot bot removed the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 9, 2025
now.Add(-time.Minute).Format("2006-01-02 15:04:05"),
now.Add(-time.Second*30).Format("2006-01-02 15:04:05"))))

tk.MustQuery("show distribution jobs where `job_id`=1").Check(tk.MustQuery("show distribution job 1").Rows())
Copy link
Member

Choose a reason for hiding this comment

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

Can you add checks for show distribution job 1 and show distribution job 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

job2 is the same as job 0

@@ -78,7 +78,31 @@ func GetRegionDistributionByKeyRange(ctx context.Context, startKey []byte, endKe
return nil, err
}
if is.pdHTTPCli == nil {
return nil, errs.ErrClientGetLeader.FastGenByArgs("pd client not found")
return nil, errs.ErrClientGetLeader.FastGenByArgs("http cli is nil")
Copy link
Member

Choose a reason for hiding this comment

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

Is this error appropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert

Copy link
Member

Choose a reason for hiding this comment

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

Why use this error(ErrClientGetLeader)? 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The HTTP client will init after tidb connects the pd leader, so if the client is nil, it means that the tidb can't get the PD leader

@bufferflies bufferflies force-pushed the executor/distribute_table branch 3 times, most recently from 5fc6168 to cc80a4a Compare April 10, 2025 11:48
Signed-off-by: bufferflies <[email protected]>
@bufferflies bufferflies force-pushed the executor/distribute_table branch from cc80a4a to cd3e584 Compare April 11, 2025 08:42
@bufferflies
Copy link
Contributor Author

/test check-dev2

Copy link

tiprow bot commented Apr 14, 2025

@bufferflies: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev2

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.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Apr 14, 2025
@bufferflies
Copy link
Contributor Author

/test unit-test

Copy link

tiprow bot commented Apr 15, 2025

@bufferflies: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test unit-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.

@bufferflies
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Apr 16, 2025
@bufferflies bufferflies requested a review from lcwangchao April 16, 2025 01:15
Copy link

ti-chi-bot bot commented Apr 16, 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
pull-unit-test-ddlv1 74fbf6b link true /test pull-unit-test-ddlv1

Full PR test history. Your PR dashboard.

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
Contributor Author

/test unit-test

@bufferflies
Copy link
Contributor Author

/ping @lcwangchao

Copy link

tiprow bot commented Apr 16, 2025

@bufferflies: 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 unit-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.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 17, 2025
Copy link

ti-chi-bot bot commented Apr 17, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-04-14 02:22:06.366959475 +0000 UTC m=+2655020.051195569: ☑️ agreed by okJiang.
  • 2025-04-17 02:16:45.570275204 +0000 UTC m=+2913899.254511297: ☑️ agreed by lcwangchao.

Copy link

ti-chi-bot bot commented Apr 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, hawkingrei, lcwangchao, okJiang

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 the approved label Apr 18, 2025
@ti-chi-bot ti-chi-bot bot merged commit ee95b9b into pingcap:master Apr 18, 2025
26 checks passed
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-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner 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.

executor: impl new sql syntax to distribute the region for the given table
5 participants