soundcloud/large-hadron-migrator — pull request #13 by tiegz (2012-03-16 23:08:45+00:00)
Title: Add AtomicSwitcher and set to default unless not supported.

This commit replaces the chunk_options hash with a universal options hash, and adds a new option[:atomic_switch] boolean, which defaults to true.

If set to true, Invoker uses the new AtomicSwitcher class, which will use a single atomic "rename ... to ..., ... to ...".

If set to false, Invoker uses the original LockedSwitcher class.

If not set and the mysql version is affected by the rename bug (http://bugs.mysql.com/bug.php?id=39675), we default to use LockedSwitcher and warn the user (with a 30-second countdown).

fwiw, we ran into the LockedSwitcher scenario where the 2nd rename fails because the original table still exists after running the 1st rename. The migration failed so we had to manually rename the new table (we didn't encounter this while testing, thought it was safe, but then it happened under production under load).