]> git.sur5r.net Git - openldap/commitdiff
Tweak: For slap tools, don't set DB_RECOVERY flag when opening DB environment.
authorHoward Chu <hyc@openldap.org>
Sat, 13 Jul 2002 00:18:15 +0000 (00:18 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 13 Jul 2002 00:18:15 +0000 (00:18 +0000)
This allows slapcat to run while slapd is running, otherwise causes db
corruption.

servers/slapd/back-bdb/init.c

index 5fe8baa358ada6836e0cf5022f7d1333bf126754..2a80970a46c48604c006ef59ea8523e5109a5e35 100644 (file)
@@ -197,7 +197,12 @@ bdb_db_open( BackendDB *be )
        }
 
        flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
-               | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER;
+               | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN;
+       
+       /* Only slapd will do recovery, slap-tools won't. Otherwise
+        * running slapcat while slapd is active corrupts the db.
+        */
+       if( !(slapMode & SLAP_TOOL_MODE) ) flags |= DB_RECOVER;
 
        bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
        bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );