Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Effective deadlock handling
Comments in-line.
Galen Boyer wrote:
> On Mon, 05 Jan 2004, damorgan_at_x.washington.edu wrote:
>
>>Galen Boyer wrote: >> >> >>>On Sun, 04 Jan 2004, damorgan_at_x.washington.edu wrote: >>> >>> >>>>I always code it with SKIP LOCKED and trap the PK of any >>>>missed records for later processing. >>> >>>So, the application can have logic producing deadlock >>>conditions but you put a little bit of dressing on the code so >>>the application doesn't experience the deadlock error. >>> >> >>One could say the same thing about EXCEPTION WHEN OTHERS too.
You and I seem to do a truly marvelous job of miscommunicating. Errors can happen ... we trap them and deal with them. Deadlocks are errors ... we trap them and deal with them. A deadlock is no different to a PL/SQL program than an Oracle error like a ORA-0051 nor is it any different from a user defined exception such as RAISE Credit_Risk;
Whether an error is expected or not expected is a point-of-view. I expect no errors because every line of code I write is perfect. I put EXCEPTION WHEN OTHERS in everything because I've found out my ego is far bigger than my ability to anticipate every possible error.
>>Just a matter of perspective. From my experience ... at least >>50% of good code is defensive in nature.
Defensive coding is defensive coding. Haven't you ever coded for a database link? Didn't you write code to reconnect if the initial attempt failed? Haven't you ever written for RAC? Isn't TAF nothing but trapping errors and fixing the connection afterwards? That's what fail-over is by definition. What do you do in your code when someone tries to enter a value that conflicts with a referential constraint? Raise an exception and ....
Perhaps we are still miscommunicating here but almost all error trapping is fixing things afterwards: The alternative is to crash and burn.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Mon Jan 05 2004 - 18:53:29 CST
![]() |
![]() |