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 multiple table rename (swap table use case) #9384

Closed
morgo opened this issue Feb 20, 2019 · 27 comments · Fixed by #19962
Closed

Support multiple table rename (swap table use case) #9384

morgo opened this issue Feb 20, 2019 · 27 comments · Fixed by #19962
Labels
challenge-program sig/sql-infra SIG: SQL Infra type/compatibility type/enhancement The issue or PR belongs to an enhancement.

Comments

@morgo
Copy link
Contributor

morgo commented Feb 20, 2019

Feature Request

Is your feature request related to a problem? Please describe:

I know that multiple DDL changes are currently on the roadmap. My feature request is to support a much smaller subset, which is an atomic rename of two tables.

This supports the use case of swapping tables, something that occurs frequently in the replication stream due to its usage by tools such as pt-online-schema-change.

Describe the feature you'd like:

mysql> CREATE TABLE t1 (a int);
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE TABLE t2 (a int, b int);
Query OK, 0 rows affected (0.01 sec)

mysql> RENAME TABLE t1 to t1_old, t2 to t1; <--- should work 
ERROR 1105 (HY000): can't run multi schema change

Describe alternatives you've considered:

The alternative is to do this non-atomically (breaks apps) or under a global lock (not yet supported by TiDB). So there is not really a good alternative.

Teachability, Documentation, Adoption, Migration Strategy:

MySQL compatible behavior.

Score

1500

SIG Slack Channel

You can join #sig-ddl on slack in your spare time to discuss and get help with mentors or others.

Mentor(s)

Recommended Skills

  • DDL
  • Golang

Learning Materials

MySQL's document for syntax reference.
TiDB DDL architecture

@morgo
Copy link
Contributor Author

morgo commented Feb 20, 2019

@shenli @winkyao PTAL

@winkyao
Copy link
Contributor

winkyao commented Feb 21, 2019

@morgo Got it, we are planning to have a design document of the multiple DDL changes. Multi table rename can be developed first.

@zimulala
Copy link
Contributor

RENAME TABLE
    tbl_name TO new_tbl_name
    [, tbl_name2 TO new_tbl_name2] ...

Refer to: https://dev.mysql.com/doc/refman/5.7/en/rename-table.html

@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@TszKitLo40 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Sep 16, 2020
@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@TszKitLo40 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Sep 30, 2020
@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@TszKitLo40 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Oct 7, 2020
@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

This issue already picked by TszKitLo40.

@ti-challenge-bot
Copy link

@TszKitLo40 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Oct 15, 2020
@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@TszKitLo40 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Oct 22, 2020
@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@TszKitLo40 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Oct 29, 2020
@TszKitLo40
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

This issue is already closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program sig/sql-infra SIG: SQL Infra type/compatibility type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants