MySQL rollback insert statement causes ibd file grows 'double', a simple test:
insert into tb1 values (3, repeat ( 'a', 65000), 'x', 1);
Is tb1.ibd before insertion, before the rollback, the rollback file size
Why rollback will result tb1.idb disk space increases?
In fact, the reason is very simple:
131072-98304 163840-131072 = 32768 =
So: Rollback insert = delete + re-insert, and delete refers to set up some flag, so ... content doubled.
insert rollback operation, first delete before insert value, and then re-insert again, and delete the tombstone, which is to set a flag, not really deleted. This is the reason.
However, because the transaction did not submit, so the data has not been written to disk, then why tb1.idb the disk space it happened twice growth? Obviously, it is because tb1.idb disk space is pre-allocated, that is to say when the statement is executed, disk space has been allocated, but because the transaction did not submit, and the data can not be uncommitted checkpoint brush into the disk, allocation of disk space, but did not insert the data written to disk. At this point insert the data still exists in the buffer. Disk space is pre-allocated.