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

MySQL2TiDB better support gh-ost #234

Open
Ryan-Git opened this issue Nov 21, 2019 · 2 comments
Open

MySQL2TiDB better support gh-ost #234

Ryan-Git opened this issue Nov 21, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@Ryan-Git
Copy link
Collaborator

Ryan-Git commented Nov 21, 2019

TiDB supports online schema change natively while MySQL often leverages tools like gh-ost. For task syncing from MySQL to TiDB, we'd better come up with a solution.

@xialuo1990 could you list ddl stmts gh-ost would execute during schema change?

@xialuo1990
Copy link

----------------------------------------伪装成从库-------------------------------------
2018-05-28 03:38:12 INFO Connecting binlog streamer at mysql-bin.000006:1037154042
2018/05/28 03:38:12 binlogsyncer.go:246: [info] begin to sync binlog from position (mysql-bin.000006, 1037154042)
2018/05/28 03:38:12 binlogsyncer.go:139: [info] register slave for master server 10.0.222.222:3302
2018/05/28 03:38:12 binlogsyncer.go:573: [info] rotate to (mysql-bin.000006, 1037154042)
----------------------------------------建立临时表-------------------------------------
2018-05-28 03:38:13 INFO Creating changelog table optimizesql._mbk_interfere_test_ghc
2018-05-28 03:38:13 INFO Changelog table created
2018-05-28 03:38:13 INFO Creating ghost table optimizesql._mbk_interfere_test_gho
2018-05-28 03:38:13 INFO Ghost table created
2018-05-28 03:38:13 INFO Altering ghost table optimizesql._mbk_interfere_test_gho
2018-05-28 03:38:13 INFO Ghost table altered
----------------------------------------拷贝数据---------------------------------------
Copy: 1001/1001 100.0%; Applied: 0; Backlog: 1/1000; Time: 2s(total), 1s(copy); streamer: mysql-bin.000006:1037231288; State: migrating; ETA: duelock2018-05-28
----------------------------------------给原标和临时表加锁-------------------------------
03:38:14 INFO Locking optimizesql.mbk_interfere_test, optimizesql._mbk_interfere_test_del
----------------------------------------确认增量数据拷贝完毕-----------------------------
2018-05-28 03:38:14 INFO Writing changelog state: AllEventsUpToLockProcessed:1527449894246894344
----------------------------------------将临时表变更为原表-----------------------------
2018-05-28 03:38:15 INFO Issuing and expecting this to block: rename /* gh-ost */ table optimizesql.mbk_interfere_test to optimizesql._mbk_interfere_test_del, optimizesql._mbk_interfere_test_gho to optimizesql.mbk_interfere_test

@Ryan-Git
Copy link
Collaborator Author

Ryan-Git commented Nov 21, 2019

So we need to

  • ignore create table stmt if table name begins with _ and ends with _ghc or _gho
  • ignore alter table stmt if table name begins with _ and ends with _gho
  • ignore rename table if target name begins with _ and ends with _del
  • rewrite rename table if source name begins with _ and ends with gho, generate alter table stmt comparing gho and origin table schema

@Ryan-Git Ryan-Git changed the title MySQL2TiDB support gh-ost MySQL2TiDB better support gh-ost Nov 22, 2019
@Ryan-Git Ryan-Git added the enhancement New feature or request label Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants