Bug #73077 truncate table might cause .ibd file lost if disk full
Submitted: 23 Jun 2014 8:20 Modified: 8 Jul 2014 3:20
Reporter: hui liu (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.6.16+ OS:Any
Assigned to: CPU Architecture:Any
Tags: disk full, ibd lost, truncate table

[23 Jun 2014 8:20] hui liu
For TRUNCATE, it's equal to "DROP+CREATE". While for disk full situation, the freed space by DROP, that is deleting .ibd file from data dir, might be consumed by other writes, then for CREATE, it might failed to recreate .ibd due to disk full, that caused inconsistent with .frm and .ibd.

How to repeat:
code reading

Suggested fix:
delay the deleting for .ibd later until recreate is successfully.
[24 Jun 2014 8:06] hui liu
Ops, it's fixed in 5.7.2, seen from WL6501 http://dev.mysql.com/worklog/task/?id=6501 and ReleaseNote http://mysqlserverteam.com/the-mysql-5-7-2-milestone-release/

Major changes 
$ bzr diff -c6092 > wl6501.diff

And related with bugfix
$ bzr log | grep 6501 --color -C5
[27 Jun 2014 10:23] Umesh Shastry
Thank you for the report.
Yes, this issue most likely fixed in 5.7.2
Please reopen the bug if you hit this issue in >5.7.2.

[2 Jul 2014 2:55] hui liu
In theory, 5.7.2 fixed this issue, and you can close it now.

For the 5.6 users, they can try this patch if needed.
[2 Jul 2014 2:55] hui liu
quick fix for bug73077 in 5.6

Attachment: bug73077.diff (application/octet-stream, text), 9.84 KiB.

[8 Jul 2014 3:20] hui liu
Close it as 5.7 has already fixed with more complex solution.