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

ddl: add truncate partition all support #23040

Merged
merged 6 commits into from
Mar 19, 2021

Conversation

AndrewDi
Copy link
Contributor

@AndrewDi AndrewDi commented Mar 1, 2021

What problem does this PR solve?

Issue Number: close #22704

Problem Summary:

What is changed and how it works?

What's Changed:

if ddl contains truncate partition all, all current partition id will pass to ddl_api

How it Works:

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

Release note

  • alter table truncate partition now support all option

@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 1, 2021
@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Mar 1, 2021
@AndrewDi
Copy link
Contributor Author

AndrewDi commented Mar 1, 2021

/cc @bb7133 PTAL

@ti-chi-bot ti-chi-bot requested a review from bb7133 March 1, 2021 13:31
@ti-chi-bot
Copy link
Member

@AndrewDi: GitHub didn't allow me to request PR reviews from the following users: PTAL.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @bb7133 PTAL

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.

@AndrewDi
Copy link
Contributor Author

AndrewDi commented Mar 1, 2021

releated parser pr is 1179

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 7, 2021
@AndrewDi AndrewDi requested review from a team as code owners March 7, 2021 10:39
@AndrewDi AndrewDi requested review from lzmhhh123 and removed request for a team March 7, 2021 10:39
@github-actions github-actions bot added the sig/planner SIG: Planner label Mar 7, 2021
@xhebox
Copy link
Contributor

xhebox commented Mar 7, 2021

@AndrewDi You need a rebase. There are too many commits coauthored by you.

@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 7, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2021
@AndrewDi
Copy link
Contributor Author

@xhebox rebase has been done, sorry for the later response.

@AndrewDi
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@xhebox xhebox 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, but it is a new feature. You should not close the issue until the document is updated.

ddl/db_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-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. labels Mar 14, 2021
@AndrewDi
Copy link
Contributor Author

@xhebox @bb7133 PTAL, add test case

ddl/db_test.go Outdated
tk1.MustExec("drop table if exists partition_table;")
}()
tk1.MustExec("create table partition_table (v int) partition by hash (v) partitions 2;")
tk1.MustExec("insert into partition_table values (1);")
Copy link
Contributor

@xhebox xhebox Mar 14, 2021

Choose a reason for hiding this comment

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

We can make a better test that emphasizes on all partitions:

  1. partitioning by less than 10 and 20, or so
  2. insert 8 and 15, to insert into all partitions
  3. truncate all partitions and count(*) == 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PTAL again?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is fine to me. Plz fix the build, and do not close the issue. I think it is better to leave the issue open for documentation PR.

@xhebox
Copy link
Contributor

xhebox commented Mar 14, 2021

/run-all-tests

@xhebox
Copy link
Contributor

xhebox commented Mar 14, 2021

/run-check_dev_2

@xhebox
Copy link
Contributor

xhebox commented Mar 14, 2021

There is a failed test in check_dev_2, could you investigate whether it is because of your modifications? @AndrewDi

@AndrewDi
Copy link
Contributor Author

There is a failed test in check_dev_2, could you investigate whether it is because of your modifications? @AndrewDi

No, I didn't touch privileges part, but I will fix the test case, may be some one has modified parser parted, but tidb part has not merged.

@AndrewDi
Copy link
Contributor Author

/run-all-tests

@@ -82,7 +82,7 @@ func (s *testSuite1) TestRevokeTableScope(c *C) {

// Make sure all the table privs for new user is Y.
res := tk.MustQuery(`SELECT Table_priv FROM mysql.tables_priv WHERE User="testTblRevoke" and host="localhost" and db="test" and Table_name="test1"`)
res.Check(testkit.Rows("Select,Insert,Update,Delete,Create,Drop,Index,Alter"))
res.Check(testkit.Rows("Select,Insert,Update,Delete,Create,Drop,Index,Alter,Show View"))
Copy link
Contributor

Choose a reason for hiding this comment

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

it this true in MySQL? I haven't tested it.

Copy link
Contributor

@xhebox xhebox Mar 15, 2021

Choose a reason for hiding this comment

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

From mysql-8.0.22

| Select,Insert,Update,Delete,Create,Drop,References,Index,Alter,Create View,Show view,Trigger |

Copy link
Contributor

Choose a reason for hiding this comment

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

we are not supporting trigger now, I think it ok here.

@xhebox
Copy link
Contributor

xhebox commented Mar 14, 2021

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 14, 2021
@xhebox
Copy link
Contributor

xhebox commented Mar 15, 2021

/unhold

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

xhebox commented Mar 18, 2021

/cc @zimulala

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • xhebox
  • xiongjiwei

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 18, 2021
@xhebox
Copy link
Contributor

xhebox commented Mar 19, 2021

@AndrewDi Please fix the conflicts. And I will fire the merge.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2021
@AndrewDi
Copy link
Contributor Author

@AndrewDi Please fix the conflicts. And I will fire the merge.

done...please merge asap

@xhebox
Copy link
Contributor

xhebox commented Mar 19, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 2e63b48

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 19, 2021
@ti-chi-bot
Copy link
Member

@AndrewDi: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 7d113f0 into pingcap:master Mar 19, 2021
@AndrewDi AndrewDi deleted the add_truncate_all_support branch March 19, 2021 15:16
SabaPing pushed a commit to SabaPing/tidb that referenced this pull request Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/planner SIG: Planner sig/sql-infra SIG: SQL Infra size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TRUNCATE PARTITION ALL gets stuck, ddl_worker retries, error returned
5 participants