From: Howard Chu Date: Thu, 7 Feb 2013 18:23:25 +0000 (+0000) Subject: ITS#6365 wait for read locks in tool mode X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=853b9d1335d27e280751e9cfb8ca6b5356ffec73;p=openldap ITS#6365 wait for read locks in tool mode Fix commit e5b96f2c764f2ca8106560a9e46d3a9880cc2a12 --- diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 1d8527332a..57690fc532 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -529,7 +529,13 @@ shm_retry: } if ( !quick ) { - TXN_BEGIN(bdb->bi_dbenv, NULL, &bdb->bi_cache.c_txn, DB_READ_COMMITTED | DB_TXN_NOWAIT); + int txflag = DB_READ_COMMITTED; + /* avoid deadlocks in server; tools should + * wait since they have no deadlock retry mechanism. + */ + if ( slapMode & SLAP_SERVER_MODE ) + txflag |= DB_TXN_NOWAIT; + TXN_BEGIN(bdb->bi_dbenv, NULL, &bdb->bi_cache.c_txn, txflag); } entry_prealloc( bdb->bi_cache.c_maxsize );