Using Percona 5.6.34-79.1. Storage Engine is InnoDB. One of the table to be optimized is 300Gb in size. tmpdir is a separate partition, and datadir is separate.
datadir has 500Gb of space, so optimize should work (taking its time). tmpdir has less space than table size.
Its a standby slave, so no query of any kind is hitting this db instance, so tmpdir partition is un-used. Before I run any query, if I do lsof | grep -i deleted, I don't see any thing related to mysql.
Once I fire the optimize command, the tmpdir starts to fill up, and doing lsof | grep -i deleted shows large number of deleted but yet held files related to mysql.
Also on the datadir, the new file by the name #sql-ib4586-1246909784.ibd forms but remains in few kilobyte in size.
Normally tmpdir should not fill up and the new file (#sql-ib4586-1246909784.ibd) should increase in size taking up datadir space. Why is that not happening?