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

*: Remove the check of initialized auto ID #4971

Merged
merged 3 commits into from Nov 2, 2017

Conversation

Projects
None yet
4 participants
@zimulala
Member

zimulala commented Nov 1, 2017

Using the way to check the initialized auto ID will have a compatibility issue with previous versions. So we remove the check of initialized auto ID.

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala
Member

zimulala commented Nov 1, 2017

@@ -141,18 +141,20 @@ func (m *Meta) parseTableID(key string) (int64, error) {
}
// GenAutoTableID adds step to the auto ID of the table and returns the sum.
func (m *Meta) GenAutoTableID(dbID int64, tableID int64, step int64) (int64, error) {
func (m *Meta) GenAutoTableID(originalDBID, dbID, tableID, step int64) (int64, error) {
// Check if DB exists.

This comment has been minimized.

@hanfei1991

hanfei1991 Nov 1, 2017

Member

Do we also need to check if old db exists or not ?

@hanfei1991

hanfei1991 Nov 1, 2017

Member

Do we also need to check if old db exists or not ?

This comment has been minimized.

@coocood

coocood Nov 1, 2017

Member

The old db doesn't need to exist, it can be dropped.

@coocood

coocood Nov 1, 2017

Member

The old db doesn't need to exist, it can be dropped.

@hanfei1991

This comment has been minimized.

Show comment
Hide comment
@hanfei1991

hanfei1991 Nov 1, 2017

Member

LGTM

Member

hanfei1991 commented Nov 1, 2017

LGTM

@@ -225,7 +225,7 @@ func (s *testSuite) TestRenameTable(c *C) {
tk.MustExec("insert rename2.t values ()")
tk.MustExec("rename table rename2.t to rename3.t")
tk.MustExec("insert rename3.t values ()")
tk.MustQuery("select * from rename3.t").Check(testkit.Rows("1", "2", "3"))
tk.MustQuery("select * from rename3.t").Check(testkit.Rows("1", "5001", "10001"))

This comment has been minimized.

@coocood

coocood Nov 1, 2017

Member

Why this result changed?

@coocood

coocood Nov 1, 2017

Member

Why this result changed?

This comment has been minimized.

@zimulala

zimulala Nov 2, 2017

Member

Because of the change at your second question.

@zimulala

zimulala Nov 2, 2017

Member

Because of the change at your second question.

@@ -73,7 +73,7 @@ func (b *Builder) ApplyDiff(m *meta.Meta, diff *model.SchemaDiff) ([]int64, erro
// We try to reuse the old allocator, so the cached auto ID can be reused.
var alloc autoid.Allocator
if tableIDIsValid(oldTableID) {
if oldTableID == newTableID {
if oldTableID == newTableID && diff.Type != model.ActionRenameTable {

This comment has been minimized.

@coocood

coocood Nov 1, 2017

Member

We can still reuse the allocator for rename table, just add a method SetDBID.

@coocood

coocood Nov 1, 2017

Member

We can still reuse the allocator for rename table, just add a method SetDBID.

This comment has been minimized.

@zimulala

zimulala Nov 2, 2017

Member

But, it needs to add an interface to Allocator.

@zimulala

zimulala Nov 2, 2017

Member

But, it needs to add an interface to Allocator.

This comment has been minimized.

@coocood

coocood Nov 2, 2017

Member

Alright, skip auto ID when rename table is acceptable.

@coocood

coocood Nov 2, 2017

Member

Alright, skip auto ID when rename table is acceptable.

@zimulala

This comment has been minimized.

Show comment
Hide comment
@zimulala

zimulala Nov 2, 2017

Member

/run-all-test

Member

zimulala commented Nov 2, 2017

/run-all-test

@iamxy

This comment has been minimized.

Show comment
Hide comment
@iamxy

iamxy Nov 2, 2017

Member

/run-all-tests

Member

iamxy commented Nov 2, 2017

/run-all-tests

@coocood

coocood approved these changes Nov 2, 2017

@coocood coocood merged commit 030b362 into pingcap:master Nov 2, 2017

12 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 71.722%
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
jenkins-ci-tidb/common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-compatibility-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
jenkins-ci-tidb/mybatis-test Jenkins job succeeded.
Details
jenkins-ci-tidb/sqllogic-test Jenkins job succeeded.
Details
jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@zimulala zimulala deleted the zimulala:compatibility branch Nov 2, 2017

dbjoa added a commit to cloud-pi/tidb that referenced this pull request Nov 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment