rc = bdb->bi_dbenv->set_lg_dir( bdb->bi_dbenv, dir );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: set_lg_dir(%s) failed: %s (%d)\n",
+ "bdb_db_open: set_lg_dir(%s) failed: %s (%d)\n",
dir, db_strerror(rc), rc );
return rc;
}
#endif
Debug( LDAP_DEBUG_TRACE,
- "bi_back_db_open: dbenv_open(%s)\n",
+ "bdb_db_open: dbenv_open(%s)\n",
bdb->bi_dbenv_home, 0, 0);
rc = bdb->bi_dbenv->open( bdb->bi_dbenv,
flags = DB_THREAD | DB_CREATE;
+ bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
+ BDB_INDICES * sizeof(struct bdb_db_info *) );
+
/* open (and create) main database */
for( i = 0; i < BDB_INDICES; i++ ) {
struct bdb_db_info *db;
bdb->bi_dbenv_home, db_strerror(rc), rc );
return rc;
}
+
+ bdb->bi_databases[i] = db;
}
/* <insert> open (and create) index databases */
{
int rc;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+
+ assert( be != NULL );
+ assert( bdb != NULL );
rc = bdb->bi_id2entry->bdi_db->cursor(
bdb->bi_id2entry->bdi_db, NULL, &cursor, 0 );
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+ assert( be != NULL );
+
if( key.data ) {
ch_free( key.data );
key.data = NULL;
int rc;
ID id;
+ assert( be != NULL );
assert( slapMode & SLAP_TOOL_MODE );
assert( cursor != NULL );
int rc;
Entry *e;
struct berval bv;
+
+ assert( be != NULL );
assert( slapMode & SLAP_TOOL_MODE );
assert( data.data != NULL );
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
DB_TXN *tid;
+ assert( be != NULL );
assert( slapMode & SLAP_TOOL_MODE );
Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_put( %ld, \"%s\" )\n",
rc = txn_begin( bdb->bi_dbenv, NULL, &tid, 0 );
if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: txn_begin failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
return NOID;
}
rc = bdb_next_id( be, tid, &e->e_id );
if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: next_id failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
goto done;
}
/* add dn2id indices */
rc = bdb_dn2id_add( be, tid, e->e_ndn, e->e_id );
if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: dn2id_add failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
goto done;
}
/* id2entry index */
rc = bdb_id2entry_add( be, tid, e );
if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: id2entry_add failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
goto done;
}
if( rc == 0 ) {
rc = txn_commit( tid, 0 );
if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: txn_commit failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
e->e_id = NOID;
}
} else {
+ Debug( LDAP_DEBUG_ANY,
+ "=> bdb_tool_entry_put: txn_aborted!\n",
+ 0, 0, 0 );
txn_abort( tid );
e->e_id = NOID;
}