github / gh-ost

GitHub's Online Schema-migration Tool for MySQL
MIT License
12.33k stars 1.25k forks source link

gh-ost with MTS #841

Closed Roguelazer closed 3 years ago

Roguelazer commented 4 years ago

We use gh-ost all the time and are considering switching our 5.7+ clusters to use MTS / parallel replication in one of the LOGICAL_CLOCK modes (COMMIT_ORDER for now; maybe WRITESET_SESSION later). Has gh-ost been tested with MTS or would we need to keep around a serial replica to run migrations from? I couldn't find anything in the docs or in any other issues, but I would imagine that parallel replication would mess up the way gh-ost detects events through the _ghc tables since you couldn't assume any kind of synchronization barrier between reading DML on the main table and reading DML into the ghc table.

ggunson commented 4 years ago

gh-ost is/was used with multithreaded replication at GitHub, using slave_parallel_type=LOGICAL_CLOCK and slave_preserve_commit_order=1. Events would get committed on the replicas in the order they had on the master, and the event ordering in the replica binary logs would match the master's.

Roguelazer commented 4 years ago

That's good to hear.

Would it be worth adding a pre-launch check that, if MTS is enabled, slave_preserve_commit_order is set to 1 (the way gh-ost right now checks that, e.g., BINLOG_ROW_IMAGE is set to FULL)?

ggunson commented 4 years ago

Probably a good idea. And anything else that may be relevant from https://dev.mysql.com/doc/refman/5.7/en/replication-features-transaction-inconsistencies.html

timvaillancourt commented 3 years ago

Closing this as an answered question. Feel free to open a new issue!