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

*: support REORGANIZE PARTITION, part 1 - data reorg / data+index copying #38460

Merged

Conversation

mjonss
Copy link
Contributor

@mjonss mjonss commented Oct 13, 2022

What problem does this PR solve?

First part of REORGANIZE PARTITION, implementing the data copying from one set of partitions to a new set of partitions
as in:
ALTER TABLE t REORGANIZE PARTITION INTO ()

This part covers:

Issue Number: ref #15000 , ref #38535

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • 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 Oct 13, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bb7133
  • tangenta

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 13, 2022
@mjonss
Copy link
Contributor Author

mjonss commented Oct 14, 2022

/run-all-test

@mjonss
Copy link
Contributor Author

mjonss commented Oct 17, 2022

/run-build plugin=main

@mjonss
Copy link
Contributor Author

mjonss commented Oct 17, 2022

/run-check_dev_2 plugin=main

@wuhuizuo
Copy link
Contributor

/run-build plugin=master

1 similar comment
@mjonss
Copy link
Contributor Author

mjonss commented Oct 17, 2022

/run-build plugin=master

@mjonss
Copy link
Contributor Author

mjonss commented Oct 17, 2022

/run-build

@mjonss
Copy link
Contributor Author

mjonss commented Oct 17, 2022

/run-check_dev_2

@mjonss
Copy link
Contributor Author

mjonss commented Oct 17, 2022

/run-unit-test

@mjonss
Copy link
Contributor Author

mjonss commented Oct 20, 2022

/run-check_dev_2

@mjonss
Copy link
Contributor Author

mjonss commented Oct 20, 2022

/run-unit-test

@bb7133 bb7133 closed this Nov 10, 2022
@bb7133 bb7133 reopened this Nov 10, 2022
table/table.go Show resolved Hide resolved
table/tables/partition.go Outdated Show resolved Hide resolved
table/tables/partition.go Outdated Show resolved Hide resolved
@@ -939,19 +950,34 @@ func (t *partitionedTable) PartitionExpr() (*PartitionExpr, error) {
return t.partitionExpr, nil
}

func (t *partitionedTable) GetPartitionColumnNames() []model.CIStr {
func (t *partitionedTable) GetPartitionColumnIDs() []int64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add a UT for this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it is used by GetPartitionColumnNames, and that is included in one UT, I don't think it is needed. But if you like I can create such UT?

table/tables/partition.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
@mjonss
Copy link
Contributor Author

mjonss commented Nov 15, 2022

/run-check_dev_2

ddl/partition.go Outdated Show resolved Hide resolved
ddl/partition.go Outdated Show resolved Hide resolved
ddl/partition.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/db_partition_test.go Outdated Show resolved Hide resolved
ddl/db_partition_test.go Outdated Show resolved Hide resolved
ddl/db_partition_test.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
table/tables/partition.go Outdated Show resolved Hide resolved
table/tables/partition.go Outdated Show resolved Hide resolved
table/tables/partition.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 22, 2022
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 22, 2022
Comment on lines 772 to 777
if err != nil {
if b.canSkipError(err) {
continue
}
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The errors returned from newReorgPartitionWorker are not recoverable... We had better not to skip them :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I agree and have removed it. But I don't think it would be too bad, since it would just limit the number of workers if by somehow the newReorgPartitionWorker would have succeeded.

Copy link
Contributor

@tangenta tangenta Dec 23, 2022

Choose a reason for hiding this comment

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

When newReorgPartitionWorker is possible to succeed for part of workers(for example the memory is limited by the resource manager), we can add it back and update the log message inside canSkipError.

@ti-chi-bot ti-chi-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 Dec 22, 2022
@mjonss mjonss requested a review from a team as a code owner December 23, 2022 08:21
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 23, 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 Dec 23, 2022
@mjonss
Copy link
Contributor Author

mjonss commented Dec 23, 2022

/run-unit-test

1 similar comment
@mjonss
Copy link
Contributor Author

mjonss commented Dec 24, 2022

/run-unit-test

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@Benjamin2037
Copy link
Collaborator

XPnqEx9yf7
could we check that has ut option?

@bb7133
Copy link
Member

bb7133 commented Dec 30, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 0eab90d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 30, 2022
@ti-chi-bot ti-chi-bot merged commit 25df00e into pingcap:feature/reorganize-partition Dec 30, 2022
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.