I need to implement a retry loop for deadlock and lock timeout cases. I
found on the Informix User Group the following list of error codes that
need to be caught to handle database locking. This list is pretty old
and it has a disclaimer that it is not guaranteed to be definitive. Does
anyone know about a more recent and definitive documentation of deadlock
and lock timeout errors.
Thanks,
Reinhard
The following SQL error codes can occur because of locking problems:
-233: Cannot read record that is locked by another user.
-240: Could not delete a row.
-244: Could not do a physical-order read to fetch next row.
-245: Could not position within a file via an index.
-246: Could not do an indexed read to get the next row.
-250: Cannot read record from file for update.
-263: Could not lock row for update.
-271: Could not insert new row into the table.
-346: Could not update a row in the table.
-348: Could not read a row from the table.
-378: Record currently locked by another user.
The following ISAM error codes can occur because of locking problems:
-78: Deadlock detected
-79: No record locks available.
-107: ISAM error: record is locked.
-113: ISAM error: the file is locked.
-134: ISAM error: no more locks.
-143: ISAM error: deadlock detected.
-144: ISAM error: key value locked.
-154: ISAM error: Deadlock Timeout Expired - Possible Deadlock.
Errors -78 through -154 can also be shown as positive values under some
circumstances. The error message
files record the same message for both -78 and +78. This is not true of
the SQL error messages.
If you are working on System V based machines (rather than BSD), the
system error number leads to certain
errors being mis-reported. The locking errors which may cause problems
are:
-45: SysV -- Deadlock detected
-45: BSD -- Operation not supported on socket
-46: SysV -- No record locks available
-46: BSD -- Protocol family not supported.
-56: SysV -- File locking deadlock error
-56: BSD -- Socket is already connected.
In each case, the error would be reported using the BSD message, but
would actually have the System V meaning.
This list was generated from the document "Informix Error Messages"
(December 1991) Part No 000-7121. Neither of these list is guaranteed to
be definitive, nor are they guaranteed to remain unchanged with
newversions of the software. However, the document used includes Version
5.00 error messages as well as 4.10 error messages.