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

table partition: enhance auto id for exchange partition with table #36663

Closed
wants to merge 11 commits into from

Conversation

ymkzpx
Copy link
Contributor

@ymkzpx ymkzpx commented Jul 28, 2022

What problem does this PR solve?

Issue Number: close #36661

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

[REVIEW NOTIFICATION]

This pull request has not been approved.

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-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 28, 2022
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jul 28, 2022

@@ -74,7 +75,7 @@ func (b *bundleInfoBuilder) SetDeltaUpdateBundles() {
b.deltaUpdate = true
}

func (b *bundleInfoBuilder) deleteBundle(is *infoSchema, tblID int64) {
func (_ *bundleInfoBuilder) deleteBundle(is *infoSchema, tblID int64) {
Copy link
Member

Choose a reason for hiding this comment

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

func (*bundleInfoBuilder)

infoschema/builder.go Show resolved Hide resolved
return err
}
// non-partition table auto IDs.
ntAutoIDs, err := m.GetAutoIDAccessors(ntSchemaID, ntID).Get()
Copy link
Contributor

Choose a reason for hiding this comment

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

What would happen in this case?

CREATE TABLE pt (a int unsigned auto_increment, b varchar(255)) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1000000), partition p1M values less than (2000000));
create table t (a int unsigned auto_increment, b varchar(255));
insert into pt values (1, "1");
insert into t values (2, "2");
insert into t values (4000000, "4M");
delete from t where a = 4000000;
alter table pt exchange partition p0 with table t;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put it to the test,RowID is equal to 4005000.

@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 4, 2022
Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

Is this ready for review? I did not manage to build it and there are still code commented out etc. so I stopped my review.

@@ -5,6 +5,7 @@ package restore_test
import (
"context"
"encoding/json"
"github.com/pingcap/tidb/infoschema"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can revert this file change?

//tkCancel := testkit.NewTestKit(t, store)

tk.MustExec("set @@tidb_enable_exchange_partition=1")
defer tk.MustExec("set @@tidb_enable_exchange_partition=0")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is necessary. I think this is a session scoped variable and the session will end after the test anyway?

Comment on lines +2384 to +2385
// why use tkCancel, not tk.
//tkCancel := testkit.NewTestKit(t, store)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// why use tkCancel, not tk.
//tkCancel := testkit.NewTestKit(t, store)

}
hook.OnJobUpdatedExported = hookFunc

//tk.MustExec(`create table nt1(a int);`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//tk.MustExec(`create table nt1(a int);`)

Comment on lines +2416 to +2422

//tk.MustQuery("select * from pt partition(p0)").Check(testkit.Rows("1"))
//tk.MustExec("alter table pt exchange partition p0 with table nt")
//tkCancel.MustExec("insert into nt values (1)")
//tkCancel.MustExec("use test")
// tkCancel.MustExec("insert into pt values (2)")
// tkCancel.MustQuery("select * from pt partition(p0)").Check(testkit.Rows())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//tk.MustQuery("select * from pt partition(p0)").Check(testkit.Rows("1"))
//tk.MustExec("alter table pt exchange partition p0 with table nt")
//tkCancel.MustExec("insert into nt values (1)")
//tkCancel.MustExec("use test")
// tkCancel.MustExec("insert into pt values (2)")
// tkCancel.MustQuery("select * from pt partition(p0)").Check(testkit.Rows())

@ymkzpx ymkzpx closed this Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

table partition: may be an error setting the AutoID
5 participants