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

[FLASH-480] Fix bug: rename column #227

Merged
merged 4 commits into from
Sep 10, 2019

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Sep 9, 2019

If we create a table with two column, naming a,b.
Then we rename column a-> c, b -> a.
Rename will fail and error log as below

2019.09.09 17:25:42.248979 [ 3 ] <Debug> SchemaSyncer: try load schema diffs.
2019.09.09 17:25:42.249008 [ 3 ] <Debug> SchemaSyncer: end load schema diffs.
2019.09.09 17:25:42.249079 [ 3 ] <Error> SchemaBuilder: detect column a rename to c
2019.09.09 17:25:42.249123 [ 3 ] <Error> SchemaBuilder: detect column b rename to a
2019.09.09 17:25:42.249166 [ 3 ] <Debug> SchemaBuilder: void DB::SchemaBuilder<DB::MockSchemaGetter>::applyAlterTableImpl(TiDB::TableInfoPtr, const DB::String &, DB::StorageMergeTree *) [Getter = DB::MockSchemaGetter]: Detected schema changes: default.test
RENAME COLUMN from a to c, RENAME COLUMN from a to _tiflash_tmp_a, RENAME COLUMN from b to a,
2019.09.09 17:25:42.257102 [ 3 ] <Error> SchemaSyncer: apply diff meets exception : DB::Exception: Rename column fails, old column name: a doesn't exist

The second AlterCommand for rename( which rename a to _tiflash_tmp_a ) is redundant since we have already renamed column a to c at the first AlterCommand.

We should remove dependency from rename_map once its rename command has generated.

@JaySon-Huang
Copy link
Contributor Author

/run-integration-tests

Copy link
Member

@hanfei1991 hanfei1991 left a comment

Choose a reason for hiding this comment

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

LGTM

@JaySon-Huang
Copy link
Contributor Author

/run-integration-tests

@JaySon-Huang JaySon-Huang merged commit 1b40aba into pingcap:master Sep 10, 2019
@JaySon-Huang JaySon-Huang deleted the bugfix-rename-column branch September 10, 2019 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants