|
|
sybperl-l Archive
Up Prev Next
From: Phil dot Moore at morganstanley dot com
Subject: Patch to DBD::SYbase 1.01 for nsql deadlock retry logic
Date: Nov 12 2003 4:55PM
Mike --
Please apply this patch to the next release of DBD::Sybase. The
nsql() implementation has a critical flaw in the deadlock retry logic
upon which many of us depend.
When a failure occurs the errors is stashed in $err, and if that error
is a deadlock (Message 1205), and the application has configured the
various retry attributes, then the SQL is resubmitted correctly.
However, if a subsequent execute succeeds, the $err variable still has
the value from the previous failure, and the code then returns no
data. $err needs to be reset per invocation od the DEADLOCK block.
The patch is trivial:
*** Sybase.pm.~1~ Mon Sep 8 17:30:22 2003
--- Sybase.pm Mon Nov 10 17:05:21 2003
***************
*** 381,388 ****
# DBI->trace(3);
! DEADLOCK:
{
# Use RaiseError technique to throw a fatal error if anything goes
# wrong in the execute or fetch phase.
eval {
--- 381,395 ----
# DBI->trace(3);
! DEADLOCK:
{
+
+ #
+ # Initialize $err before each iteration through this loop.
+ # Otherwise, we inherit the value from the previous failure.
+ #
+ $err = undef;
+
# Use RaiseError technique to throw a fatal error if anything goes
# wrong in the execute or fetch phase.
eval {
|