Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to kill a replicating MySQL-process which is 'copying to tmp table'?

I'm having a problem on a master MySQL (5.0, Linux) server: I tried to add a comment to a table row, which translates into an ALTER TABLE command. Now the process is stuck on 'copy to tmp table', copying the 100'000'000+ rows. Disk IO usage is uncomfortably high.

Since the master is using replication, I'm unsure if I can kill this process. The slaves haven't seen the ALTER TABLE command yet.

(To make this clear: I'm talking about killing the process from the MySQL-PROCESSLIST, not the MySQL-Daemon-process itself.)

like image 584
Christian Studer Avatar asked Jan 27 '10 13:01

Christian Studer


1 Answers

Yes you can kill it - the ALTER won't make it into the binlogs until the transaction is committed, i.e. until the ALTER is finished. So the slaves won't see nor execute it, and the master will rollback to the old table structure.

You can easily verify that the ALTER is not yet in the binlogs by using show binlog events or the mysqlbinlog utility.

like image 196
ggiroux Avatar answered Oct 03 '22 23:10

ggiroux