#if DB_VERSION_FULL >= 0x04010011
#undef DB_OPEN
#define DB_OPEN(db, file, name, type, flags, mode) \
- (db)->open(db, NULL, file, name, type, (flags)|DB_AUTO_COMMIT, mode)
+ (db)->open(db, NULL, file, name, type, flags, mode)
#endif
#endif
const char *name,
DB **dbout )
{
- int i;
+ int i, flags;
int rc;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
struct bdb_db_info *db;
#ifdef HAVE_EBCDIC
__atoe( file );
+#endif
+ flags = DB_CREATE | DB_THREAD;
+#ifdef DB_AUTO_COMMIT
+ if ( !( slapMode & SLAP_TOOL_QUICK ))
+ flags |= DB_AUTO_COMMIT;
#endif
rc = DB_OPEN( db->bdi_db,
file, NULL /* name */,
- BDB_INDEXTYPE, bdb->bi_db_opflags | DB_CREATE | DB_THREAD,
- bdb->bi_dbenv_mode );
+ BDB_INDEXTYPE, bdb->bi_db_opflags | flags, bdb->bi_dbenv_mode );
ch_free( file );
return rc;
}
- flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
- | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN;
+ flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE | DB_INIT_LOCK;
+
+if ( !( slapMode & SLAP_TOOL_QUICK ))
+ flags |= DB_INIT_LOG | DB_INIT_TXN;
#if 0
/* Never do automatic recovery, must perform it manually.
flags = DB_THREAD | bdb->bi_db_opflags;
+#ifdef DB_AUTO_COMMIT
+ if ( !( slapMode & SLAP_TOOL_QUICK ))
+ flags |= DB_AUTO_COMMIT;
+#endif
+
bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
BDB_INDICES * sizeof(struct bdb_db_info *) );
Debug( LDAP_DEBUG_TRACE, "=> " LDAP_XSTRING(bdb_tool_entry_put)
"( %ld, \"%s\" )\n", (long) e->e_id, e->e_dn, 0 );
+ if (! (slapMode & SLAP_TOOL_QUICK)) {
rc = TXN_BEGIN( bdb->bi_dbenv, NULL, &tid,
bdb->bi_db_opflags );
if( rc != 0 ) {
text->bv_val, 0, 0 );
return NOID;
}
+ }
op.o_hdr = &ohdr;
op.o_bd = be;
done:
if( rc == 0 ) {
+ if ( !( slapMode & SLAP_TOOL_QUICK )) {
rc = TXN_COMMIT( tid, 0 );
if( rc != 0 ) {
snprintf( text->bv_val, text->bv_len,
text->bv_val, 0, 0 );
e->e_id = NOID;
}
+ }
} else {
+ if ( !( slapMode & SLAP_TOOL_QUICK )) {
TXN_ABORT( tid );
snprintf( text->bv_val, text->bv_len,
"txn_aborted! %s (%d)",
Debug( LDAP_DEBUG_ANY,
"=> " LDAP_XSTRING(bdb_tool_entry_put) ": %s\n",
text->bv_val, 0, 0 );
+ }
e->e_id = NOID;
}