Skip to content

Advanced Features

Junyi, Lu edited this page Feb 2, 2017 · 6 revisions

Use OSC for ALTER TABLE IGNORE

This is useful when you want to add UK/PK on an existing table which has conflicting data into, and you don't care about which row to keep while adding indexes. MySQL doesn't support ALTER TABLE IGNORE for INNODB. However you can do this with OSC.

Just add --eliminate-dups when running OSC on CLI, and it will automatically discard the conflict rows depends on the order how the data is coming into the shadow table.

Warnings:

  • If you are using this feature, be sure to run it on master first, otherwise you may have data corruption if there're DMLs touching the conflicting rows
  • --eliminate-dups will disable checksum logic, you're running this at your own risk. Make sure you know what you're doing

Use OnlineSchemaChange as a Python Class