github / gh-ost

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

Add atomic cut over function that renames locked tables in the same session #1433

Open whhe opened 2 months ago

whhe commented 2 months ago

https://github.com/github/gh-ost/pull/715 once tried to introduce a simpler cut over logic, but it was not merged. Now our team is developing a MySQL compatible binlog service of OceanBase database called OceanBase Binlog Service, which also supports the renaming locked table feature that was introduced to MySQL from 8.0.13. But the OceanBase database does not support parallel DDL now, that is, the rename process in the original atomic cut over function cannot be executed normally. Therefore, in order to support OceanBase Binlog Service, I want to introduce the new cut over function again.

I want to add a function named atomicCutOverRenameWithLock, which will lock the origin table and the ghost table firstly, and rename these two tables in the same session. This function should be called when connecting to OceanBase or MySQL version 8.0.13 or later.