[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: back-bdb deadlocks?



> Next major = 5.xx?

I think it might make it into the next 4.x release.

> It turns out that a simple patch to BDB is all that's needed (see
attached).

Hmm. It's not documented that you can pass
DB_TXN_NOT_DURABLE to DB->txn_begin(),
but perhaps that's a doc bug.

But this will not give you Level 2 Isolation.
You will still be acquiring read page locks under your
long lived transaction. Eventually I suspect that
you will overflow the lock table, or worse
deadlock with a writer thread.

> The corresponding patch to back-bdb is just this:
>
> Index: cache.c
> ===================================================================
> RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/back-bdb/cache.c,v
> retrieving revision 1.78
> diff -u -r1.78 cache.c
> --- cache.c     12 Jul 2004 18:02:24 -0000      1.78
> +++ cache.c     17 Jul 2004 16:38:15 -0000
> @@ -1186,7 +1186,7 @@
>
>          if ( ldap_pvt_thread_pool_getkey( ctx, ((char *)env)+1, &data,
> NULL ) ) {
>                  for ( i=0, rc=1; rc != 0 && i<4; i++ ) {
> -                       rc = TXN_BEGIN( env, NULL, txn, 0 );
> +                       rc = TXN_BEGIN( env, NULL, txn,
> DB_TXN_NOT_DURABLE );
>                          if (rc) ldap_pvt_thread_yield();
>                  }
>                  if ( rc != 0) {
>