moiot / gravity

A Data Replication Center
Apache License 2.0
912 stars 173 forks source link

MySQL2TiDB better support gh-ost #234

Open Ryan-Git opened 5 years ago

Ryan-Git commented 5 years ago

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 commented 5 years ago

----------------------------------------伪装成从库------------------------------------- 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 commented 5 years ago

So we need to