-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Conversation
[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 The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: Weizhen Wang <[email protected]>
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/77938832b25f6fda9ce7e5385e88f40808509bb7 |
…lehorse/tidb into AutoID-For-Exchange-Partition
infoschema/builder.go
Outdated
@@ -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) { |
There was a problem hiding this comment.
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
Outdated
return err | ||
} | ||
// non-partition table auto IDs. | ||
ntAutoIDs, err := m.GetAutoIDAccessors(ntSchemaID, ntID).Get() |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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.
There was a problem hiding this 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" |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?
// why use tkCancel, not tk. | ||
//tkCancel := testkit.NewTestKit(t, store) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// why use tkCancel, not tk. | |
//tkCancel := testkit.NewTestKit(t, store) |
} | ||
hook.OnJobUpdatedExported = hookFunc | ||
|
||
//tk.MustExec(`create table nt1(a int);`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//tk.MustExec(`create table nt1(a int);`) |
|
||
//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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//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()) |
What problem does this PR solve?
Issue Number: close #36661
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.