List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:September 18 2001 9:28pm
Subject:Re: BDB table error
View as plain text  

>>>>> "Dana" == Dana Powers <dana@stripped> writes:

Dana> Thanks for the reply! I can understand the situation with muti statement
Dana> transactions, but I'm not using transactions ( at least from my
Dana> perspective ); Im only issuing single 'atomic' statements. It would make
Dana> much more sense if mysql internally detected the deadlock, released the
Dana> locks and tried to process the statement again. It just seems so
Dana> counter-intuitive that i can connect, issue a single, isolated select
Dana> statement and get a deadlock. I dont know if this is possible, but I would
Dana> love something like this in the mysql engine:

Dana> retry-deadlock:
Dana> error = do_query();
Dana> if ( ( auto-commit == on ) && ( error == DEADLOCK ) && ( ++tries
> <
Dana> threshold ) ) {
Dana>   warn('Deadlock detected. Retrying query.');
Dana>   goto retry-deadlock;
Dana> }

Dana> Of course this could go into the application code, but it would have to go
Dana> around every single query, transactional or not, and that seems so
Dana> cumbersome given that the solution is the same in every case.
Dana> dpk

Currenty the only way we can affect how locks works with BDB tables is
to use the --bdb-lock option.
This is passed to BDB with db_env->set_lk_detect().

We have actually a variable to do retry of locks:

In, line 82:

ulong berkeley_trans_retry=1;

Could you try to change the above to 10 and see if this helps.

This retry count is only used for insert/delete/update but it may
still help solve some of your problems (If it does, we will make this
variable available from the command line).

One problem in doing the lock detection in the server is that the you
may get a lock after you have already sent some data to the client.

It would on the other hand not that hard to do retries on the client
side if something goes wrong.  I shall put this on our TODO.

Re: BDB table errorHeikki Tuuri16 Sep