Commit b674e6dd authored by Howard Chu's avatar Howard Chu
Browse files

Omit transaction support when running with SLAP_TOOL_QUICK

parent fe03b5a8
......@@ -241,7 +241,7 @@ struct bdb_op_info {
#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
......
......@@ -63,7 +63,7 @@ bdb_db_cache(
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;
......@@ -118,11 +118,15 @@ bdb_db_cache(
#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 );
......
......@@ -138,8 +138,10 @@ bdb_db_open( BackendDB *be )
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.
......@@ -273,6 +275,11 @@ bdb_db_open( BackendDB *be )
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 *) );
......
......@@ -307,6 +307,7 @@ ID bdb_tool_entry_put(
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 ) {
......@@ -318,6 +319,7 @@ ID bdb_tool_entry_put(
text->bv_val, 0, 0 );
return NOID;
}
}
op.o_hdr = &ohdr;
op.o_bd = be;
......@@ -356,6 +358,7 @@ ID bdb_tool_entry_put(
done:
if( rc == 0 ) {
if ( !( slapMode & SLAP_TOOL_QUICK )) {
rc = TXN_COMMIT( tid, 0 );
if( rc != 0 ) {
snprintf( text->bv_val, text->bv_len,
......@@ -366,8 +369,10 @@ done:
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)",
......@@ -375,6 +380,7 @@ done:
Debug( LDAP_DEBUG_ANY,
"=> " LDAP_XSTRING(bdb_tool_entry_put) ": %s\n",
text->bv_val, 0, 0 );
}
e->e_id = NOID;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment