Table_dancer is a project mainly written in Ruby, it's free.
Run all the steps at once:
TableDancer.run!('account_transaction')
Or run them individually:
dance = TableDancer.setup('account_transaction')
dance.init!
dance.copy!
dance.replay!
dance.cutover!
table "table_dances"
integer id
string source_table
string dest_table
integer phase
integer last_copy_id # ID of last record that needs to be considered during Copy phase
table "table_dance_replays"
integer id
integer table_dance_id # We support multiple table dances in the same replays table
integer instruction # 1 = Insert, 2 = Update, 3 = Delete
datetime event_time # "Original time" of event (created_at for insert, current timestamp for Update/Delete
integer source_id # ID of row in source table
boolean performed
MySQL at Facebook's OSC (Online Schema Change) openark kit's oak-online-alter-table TableMigrator
From http://dev.mysql.com/doc/refman/5.0/en/lock-tables-and-transactions.html
SET autocommit=0;
LOCK TABLES t1 WRITE, t2 READ, ...;
... do something with tables t1 and t2 here ...
COMMIT;
UNLOCK TABLES;
See also in_table_lock
: https://github.com/freels/table_migrator/blob/master/lib/table_migrator/copy_engine.rb#L265