Article View: borland.public.interbase.sql
Article #11076Re: Deadlock error
From: Edward Diener
Date: Fri, 20 Dec 2002 16:03
Date: Fri, 20 Dec 2002 16:03
33 lines
2489 bytes
2489 bytes
"T. van Rompaey" <tvrompaey@scabbouw.nlNOSPAM> wrote in message news:3e032c57$1@newsgroups.borland.com... > A deadlock is when a statement (i.e. UPDATE) locks for example row 1 and > then tries to update row 2. > In the mean time another user has locked and edited row 2 and now tries to > update row 1. > > So, row 1 is locked by user 1 and row 2 is locked by user 2 who are now both > waiting for the other user to release the lock. I didn't realize IB could detect this and generate an error. I guess this is the isc_deadlock error. > > The situation in your last sentence will (in my option) not generate a error > because the second statement will wait till the records are release from the > lock and either 1) try to delete or update a row that already is deleted (= > no problem) or 2) update or delete a row that is updated which will not > generate a database error but you should write your software to prevent > this. (i.e. check how much rows are edited / deleted after the stament and > compare this to what you expect) From my understanding it will wait only if one uses "read_committed", "no_rec_version", and "wait" transaction attributes or one uses "consistency" and "wait", else an error is produced when the second transaction attempts to delete or update the record before the first transaction commits. I guess this error is the isc_lock_conflict. Thanks. The two cases explain the different errors.
Technical Details
Message-ID:
<3e033e98$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!uunet!sea.uu.net!sac.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3dff68ba$1@newsgroups.borland.com> <3e032c57$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,9f2c74387cedc577 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-20 08:03:30 PST From: "Edward Diener" <eddielee@tropicsoft.com> Newsgroups: borland.public.interbase.sql References: <3dff68ba$1@newsgroups.borland.com> <3e032c57$1@newsgroups.borland.com> Subject: Re: Deadlock error Date: Fri, 20 Dec 2002 11:03:10 -0500 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 66.32.67.6 Message-ID: <3e033e98$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1040400024 66.32.67.6 (20 Dec 2002 08:00:24 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!uunet!sea.uu.net!sac.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail