Error handling in InnoDB is not always the same as specified in the SQL standard. According to the standard, any error during an SQL statement should cause the rollback of that statement. InnoDB sometimes rolls back only part of the statement, or the whole transaction. The following items describe how InnoDB performs error handling:
If you run out of file space in the tablespace, you will get the MySQL Table is full error and InnoDB rolls back the SQL statement.
A transaction deadlock or a timeout in a lock wait causes InnoDB to roll back the whole transaction.
A duplicate-key error rolls back only the insert of that particular row, even in a statement like INSERT INTO ... SELECT. This will probably change so that the SQL statement will be rolled back if you have not specified the IGNORE option in your statement.
A “row too long” error rolls back the SQL statement.
Other errors are mostly detected by the MySQL layer of code (above the InnoDB storage engine level), and they roll back the corresponding SQL statement.
The following is a non-exhaustive list of common InnoDB-specific errors that you may encounter, with information about why they occur and how to resolve the problem.
Cannot create table. If the error message string refers to errno 150, table creation failed because a foreign key constraint was not correctly formed.
Cannot find the InnoDB table from the InnoDB data files though the .frm file for the table exists. See the section called “Troubleshooting InnoDB Data Dictionary Operations”.
InnoDB has run out of free space in the tablespace. You should reconfigure the tablespace to add a new data file.
Lock wait timeout expired. Transaction was rolled back.
Transaction deadlock. You should rerun the transaction.
You are trying to add a row but there is no parent row, and a foreign key constraint fails. You should add the parent row first.
You are trying to delete a parent row that has children, and a foreign key constraint fails. You should delete the children first.
To print the meaning of an operating system error number, use the perror program that comes with the MySQL distribution.
The following table provides a list of some common Linux system error codes. For a more complete list, see Linux source code.
Operation not permitted
No such file or directory
No such process
Interrupted system call
I/O error
No such device or address
Arg list too long
Exec format error
Bad file number
No child processes
Try again
Out of memory
Permission denied
Bad address
Block device required
Device or resource busy
File exists
Cross-device link
No such device
Not a directory
Is a directory
Invalid argument
File table overflow
Too many open files
Inappropriate ioctl for device
Text file busy
File too large
No space left on device
Illegal seek
Read-only file system
Too many links
The following table provides a list of some common Windows system error codes. For a complete list see the Microsoft website.
Incorrect function.
The system cannot find the file specified.
The system cannot find the path specified.
The system cannot open the file.
Access is denied.
The handle is invalid.
The storage control blocks were destroyed.
Not enough storage is available to process this command.
The storage control block address is invalid.
The environment is incorrect.
An attempt was made to load a program with an incorrect format.
The access code is invalid.
The data is invalid.
Not enough storage is available to complete this operation.
The system cannot find the drive specified.
The directory cannot be removed.
The system cannot move the file to a different disk drive.
There are no more files.
The media is write protected.
The system cannot find the device specified.
The device is not ready.
The device does not recognize the command.
Data error (cyclic redundancy check).
The program issued a command but the command length is incorrect.
The drive cannot locate a specific area or track on the disk.
The specified disk or diskette cannot be accessed.
The drive cannot find the sector requested.
The printer is out of paper.
The system cannot write to the specified device.
The system cannot read from the specified device.
A device attached to the system is not functioning.
The process cannot access the file because it is being used by another process.
The process cannot access the file because another process has locked a portion of the file.
The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.
Too many files opened for sharing.
Reached the end of the file.
The disk is full.
The disk is full.
The filename, directory name, or volume label syntax is incorrect.
Insufficient system resources exist to complete the requested service.