[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: back-bdb deadlocks
You wrote:
> At 04:40 PM 2002-01-16, Howard Chu wrote (but not as ordered here):
> >Someone needs to take a careful look at what records we touch and in what
> >order.
>
> I note that BDB locks are page oriented, not record oriented, so its
> hard for the application to enforce a lock hierarchy. We need to use
> transactions to avoid deadlock. That is, we are likely deadlocking
> because some DB actions being done by the thread are not part of the
> transaction wrapping the LDAP operation.
>
Well, it's perfectly possible to mix null txn with real txn. As
long as you make sure your deadlock abort strategy aborts the
youngest one.
(Whether you want it is another question, although you can achieve
great reduction in deadlocks)
However, Howard does have a point, but it's not absolutely necessary
to stick to the order. It only reduces deadlocks.
>
> If we don't do the parent fetch within the transaction, then the
> thread can deadlock waiting for the parent instead of the being
> aborted because we cannot lock the parent.
>
If you lookup the parent outside the txn and there is no danger of a
unrecoverable deadlock. At least not in the current backend.
--
Marijn@bitpit.net
---
When everything comes your way, you're in the wrong lane.