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

executor: ALTER TABLE COMPACT support partition #36173

Merged
merged 9 commits into from
Sep 28, 2022

Conversation

hehechen
Copy link
Contributor

@hehechen hehechen commented Jul 13, 2022

Signed-off-by: hehechen awd123456sss@gmail.com

What problem does this PR solve?

Issue Number: close #36175 ref pingcap/tiflash#5315

Problem Summary:
In #34741 and #36368, ALTER TABLE [name] COMPACT and ALTER TABLE [name] COMPACT TIFLASH REPLICA syntax has been added. Deal with partition tables, allowing more fine-grained control. The syntax can be extended as: ALTER TABLE [name] COMPACT PARTITION [PartitionNameList] and ALTER TABLE [name] COMPACT PARTITION [PartitionNameList] TIFLASH REPLICA

What is changed and how it works?

  • Parser:
    Add new syntaxes:
    ALTER TABLE [name] COMPACT PARTITION [PartitionNameList]
    ALTER TABLE [name] COMPACT PARTITION [PartitionNameList] TIFLASH REPLICA.

  • Executor:
    In compact_table executor, find the partition name in table info, and send compact request to TiFlash for these partitions.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    • compact partition table, with valid and invalid partition name list.
    • Use PARTITION and no PARTITION to compact a table without partition respectively.
  • No code

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.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 13, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breezewish
  • crazycs520

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 submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue 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. labels Jul 13, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Jul 13, 2022

@hehechen hehechen force-pushed the compact_partition branch from f0189a5 to fa484b0 Compare July 13, 2022 06:40
@hehechen hehechen marked this pull request as draft July 13, 2022 06:58
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 22, 2022
@hehechen hehechen force-pushed the compact_partition branch 2 times, most recently from 09f4529 to 306ae38 Compare August 10, 2022 03:16
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2022
@hehechen
Copy link
Contributor Author

/rebuild

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 4, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 26, 2022
@hehechen hehechen force-pushed the compact_partition branch 2 times, most recently from d8ed129 to a6b7d21 Compare September 26, 2022 16:04
Signed-off-by: hehechen <awd123456sss@gmail.com>
@hehechen hehechen marked this pull request as ready for review September 27, 2022 06:08
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 27, 2022
@hehechen
Copy link
Contributor Author

/cc @breezewish

@windtalker
Copy link
Contributor

I'm not sure if alter table t compact partition p1,p2,... tiflash replica is a good statement, my first thought was alter table t partition(p1,p2,...) compact tiflash replica, because MySQL has a similar statement that you can select data from some partitions.
https://dev.mysql.com/doc/refman/8.0/en/partitioning-selection.html

@hehechen
Copy link
Contributor Author

hehechen commented Sep 27, 2022

I'm not sure if alter table t compact partition p1,p2,... tiflash replica is a good statement, my first thought was alter table t partition(p1,p2,...) compact tiflash replica, because MySQL has a similar statement that you can select data from some partitions. https://dev.mysql.com/doc/refman/8.0/en/partitioning-selection.html

https://dev.mysql.com/doc/refman/8.0/en/partitioning-maintenance.html
MySQL has similar statements ALTER TABLE t1 OPTIMIZE PARTITION p0, p1; and ALTER TABLE t1 ANALYZE PARTITION p3;.

@hehechen hehechen requested review from windtalker and crazycs520 and removed request for breezewish, windtalker and crazycs520 September 27, 2022 10:12
Signed-off-by: hehechen <awd123456sss@gmail.com>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 27, 2022
@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 Sep 27, 2022
Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: hehechen <awd123456sss@gmail.com>
@hehechen hehechen requested a review from breezewish September 27, 2022 14:36
@breezewish
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: c06dec4

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 28, 2022
@ti-chi-bot ti-chi-bot merged commit 415d03f into pingcap:master Sep 28, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Sep 28, 2022

TiDB MergeCI notify

🔴 Bad News! [1] CI still failing after this pr merged.
These failed integration tests don't seem to be introduced by the current PR.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/common-test 🔴 failed 1, success 10, total 11 8 min 34 sec Existing failure
idc-jenkins-ci/integration-cdc-test 🟢 all 37 tests passed 26 min Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 24 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 17 tests passed 11 min Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 6 min 21 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 5 min 50 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 5 min 39 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 1 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 49 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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.

Per-Partition support for "alter table xxx compact tiflash replica"
6 participants