RE: -113 ISAM error: - the file is locked
Posted in 1996
Topics: Error Codes & Troubleshooting, Transactions, Locking & Isolation
This is Informix's favourite error (I'm convinced)... We used to get this error alot in 2.10 (sometimes erroneously)... 5.02 cleared it up some. Anyway, I'll tell you about a BUG having to do with locking in EVERY version of Informix Standard Engine (I don't know about Online). BEGIN WORK DECLARE UPD_CUR CURSOR FOR UPDATE .............. OPEN UPD_CUR FETCH UPD_CUR /*** NOW THAT ROW YOU JUST FETCHED SHOULD BE LOCKED, RIGHT???? ***/ /*** THE LOCK IS NOT PROPERLY PROMOTED UNTIL AN ACTUAL UPDATE OCCURS *** THIS OCCURRED SO INFREQUENTLY (It depends upon a usually VERY small window of opportunity) that it took me 2 years to convince Informix that it was their bug (and not mine). I parsed the transaction log (after nitpicking over my own code) and found the following USER A: BEGIN WORK FETCH (For Update) USER B: BEGIN WORK FETCH (For Update----THIS SHOULD HAVE FAILED) UPDATE...WHERE CURRENT OF... COMMIT WORK USER A: UPDATE...WHERE CURRENT OF... COMMIT WORK - The table in question was a serial number which was assigned as a primary key to various transaction header tables. It was possible for both of these transactions to go through (in certain cases) and cause a later transaction to fail because of an attempt to insert a duplicate key. (And of course it only happens under heavy (highly concurrent) usage...(busy season) and has the potential to prevent any transactions from commiting.... Hooray Informix