Mysql – Will canceling InnoDB compression that’s already in progress corrupt data

compressioncorruptioninnodbMySQL

I have a 155GB table that is in the process of being compressed.

ALTER TABLE $table_name ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;

This compression has been running for a long time and is impeding my ability to backup.

I'm thinking about killing the compression query, backing up, and trying the compression again once my devs know how long it'll be till the next backup.

Is there any danger in just running a kill statement? Is there a safe way to back out of this compression?

My fear is that backing out of a compression mid query will corrupt the table. I would like to run the following query below but I believe it will be dangerous.

KILL QUERY 12345

Best Answer

If innodb_file_per_table is enabled, then a temp table is being populated with the new compression. The original table is currently intact, just not writable.

Running KILL QUERY 12345 on the Connection running the ALTER TABLE should do the following:

  • release the write lock
  • drop the temp table
  • leave the original table as is