Over the past few years of dealing with mysql in larger environments, one thing I’ve always felt that ALTER TABLE statements are flaky with replication, but could never really prove it. I never had a chance to dig into some of strange things I saw, and would tend to overlook and fix them
While working for a client, I encountered an issue that I could no longer ignore. In order to reload a small table from a master database to a number of slaves, I simply piped the output of mysqldump into the master and expected everything to flow into the slaves.
The bug is very specific, and probably not very common. If you send a statement like below, as mysqldump automatically adds, to your master:
/*!40000 ALTER TABLE table_name DISABLE KEYS */;
and have configured something like
replicate-rewrite-db=mydb->mydb_slave
on …
[Read more]