[Dbix-class] Strange statistically significant failure for DBIC with Sybase

demerphq demerphq at gmail.com
Tue Feb 4 10:42:46 GMT 2014


On 4 February 2014 06:16, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:
> On Mon, Feb 03, 2014 at 04:34:07PM -0500, Phillip Moore wrote:
>>
>> I'm starting to see a problem where about 2% of the DBIC objects I create
>> come back with a primary key (which is a Sybase identity column) whose
>> value has been incremented one too many times.
>> ...
>> I am working on getting more in depth debugging information, and I am well
>> aware that this problem report is lacking in such details, but in the
>> meantime do these symptoms sound familiar to anyone at all?
>
> Yes, the way we talk to Sybase is rather hideous:
> https://metacpan.org/pod/DBIx::Class::Storage::DBI::Sybase::ASE#INSERTS-WITH-PLACEHOLDERS
>
> Some debug ideas: look at the result of DBIC_TRACE=1 to see if you are
> indeed affected by this (a SELECT MAX query being fired). If not the
> case - likely something to do with how @@IDENTITY is isolated on your
> version of Sybase (likely badly). You could also DBI_TRACE=2=logfile
> (note DBI not DBIC) to see what values does DBIC see coming from DBI (to
> rule out a DBIC-level problem). Also you could potentially have issues
> with retries, though this is much less likely - set
> DBIC_STORAGE_RETRY_DEBUG=1 to see those.
>
> In either case - please please do get to the bottom of this. It looks
> like a rather serious problem, I don't want to leave it unsolved, but at
> the same time do not have easy access to a Sybase server (wink wink
> nudge nudge ;)

Its been a long time since I used DBD::Sybase but something I see in
the link you posted rings some bells for me...

DBD::Sybase used to use server side procedures to implement placeholders.

However only one server side procedure can be set up at one time, and
DBD::Sybase "helpfully" starts an entirely new connection when you
want to do multiple placeholder enabled statements at once. Each one
of these has its own transaction.

Not using placeholders avoids this whole process.

I could easily imagine this being related to the OP's problem.
Assuming the state of affairs hasnt change much in the last 8 years or
so.

Just a thought....

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"



More information about the DBIx-Class mailing list