I need to add a
last_modified column to a MyISAM table
tbl_items. The crux of this problem is that
tbl_items houses several gigabytes of data. Also of note, I am using a master-slave deployment with one slave.
Obviously, running the necessary
ALTER TABLE command on the master is unacceptable since it locks the table for well over a half-hour. I cannot afford this kind of downtime at ANY time of day or night, most unfortunately.
A few sources have suggested some form of the following:
- Disable replication to the slave
- Run the
ALTER TABLEcommand on the slave
- Switch replication back on and wait for slave to catch up
- Promote slave to master
Is this a viable solution? It would seem to me that all new
tbl_items inserts would be lost between the beginning of step 2 and step 4; that is, is it possible for
tbl_items data to replicate throughout the interval that it's missing the new column?
If that's the case, is there an alternate solution that eliminates the possibility of both downtime and data-loss?