refactor cutover for MySQL 8.x rename feature && support OceanBase
A Pull Request should be associated with an Issue.
Close #1433 Close #1427
Description
This PR is based on #715 by @shlomi-noach. There is a new option --oceanbase which is introduced for OceanBase Binlog Service, just like the azure and gcp options. This PR would also change the behavior of the atomic cut over on MySQL 8.0.13 and later versions, please let me know if anyone have concerns about it.
In case this PR introduced Go code changes:
- [x] contributed code is using same conventions as original code
- [x]
script/cibuildreturns with no formatting errors, build errors or unit test errors.
Is this comment by Schlomi still relevant @whhe?
This complicates matters. I can't just place a lock on both tables, since I want to be able to keep writing to the ghost table what remains in the binary logs after having locked the original table. The only way to be able to do so is if the same connection which places the lock would be the one to apply the remaining events; this is doable but non trivial.
It looks like atomicCutOverMySQL8 still waits for the applier to finish the DML events up to the lock, while the table is locked with singletonDB
@meiji163 I added LockGhostTable after waitForEventsUpToLock, so it should lock the ghost table with singletonDB after all events are applied to the ghost table.
I removed the command-line flag oceanbase, it could be replaced by the new validateOceanBaseConnection function.