]> git.sur5r.net Git - openldap/commitdiff
ITS#6365 wait for read locks in tool mode
authorHoward Chu <hyc@openldap.org>
Thu, 7 Feb 2013 18:23:25 +0000 (18:23 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 7 Feb 2013 18:23:25 +0000 (18:23 +0000)
Fix commit e5b96f2c764f2ca8106560a9e46d3a9880cc2a12

servers/slapd/back-bdb/init.c

index 1d8527332a956d4c4122ae94a69f07ba9f4da9a1..57690fc532a3c3c803ceeb1b404ad5952b5df734 100644 (file)
@@ -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 );