bdb_open( BackendInfo *bi )
{
/* initialize the underlying database system */
+ Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
+ 0, 0, 0 );
- db_env_set_func_malloc( ch_malloc );
- db_env_set_func_realloc( ch_realloc );
- db_env_set_func_free( ch_free );
- db_env_set_func_yield( ldap_pvt_thread_yield );
return 0;
}
{
struct bdb_info *bdb;
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_init: Initializing BDB database\n",
+ 0, 0, 0 );
+
/* allocate backend-database-specific stuff */
bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
int rc, i;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
u_int32_t flags;
+
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_open: opening database for %s\n",
+ be->be_suffix[0], 0, 0 );
+
/* we should check existance of dbenv_home and db_directory */
rc = db_env_create( &bdb->bi_dbenv, 0 );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: db_env_create failed: %s (%d)\n",
+ "bdb_db_open: db_env_create failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
return rc;
}
rc = bdb->bi_dbenv->set_tmp_dir( bdb->bi_dbenv, dir );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
+ "bdb_db_open: set_tmp_dir(%s) failed: %s (%d)\n",
dir, db_strerror(rc), rc );
return rc;
}
rc = bdb->bi_dbenv->set_data_dir( bdb->bi_dbenv, dir );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: set_data_dir(%s) failed: %s (%d)\n",
+ "bdb_db_open: set_data_dir(%s) failed: %s (%d)\n",
dir, db_strerror(rc), rc );
return rc;
}
bdb->bi_dbenv_mode );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: dbenv_open failed: %s (%d)\n",
+ "bdb_db_open: dbenv_open failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
return rc;
}
rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: db_create(%s) failed: %s (%d)\n",
+ "bdb_db_open: db_create(%s) failed: %s (%d)\n",
bdb->bi_dbenv_home, db_strerror(rc), rc );
return rc;
}
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_open: db_open(%s) failed: %s (%d)\n",
+ "bdb_db_open: db_open(%s) failed: %s (%d)\n",
bdb->bi_dbenv_home, db_strerror(rc), rc );
return rc;
}
rc = txn_checkpoint( bdb->bi_dbenv, 0, 0, DB_FORCE );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_destroy: txn_checkpoint failed: %s (%d)\n",
+ "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
return rc;
}
bdb->bi_dbenv = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
- "bi_back_db_destroy: close failed: %s (%d)\n",
+ "bdb_db_destroy: close failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
return rc;
}
version, 0, 0 );
}
+#if 0
+ db_env_set_func_malloc( ch_malloc );
+ db_env_set_func_realloc( ch_realloc );
+ db_env_set_func_free( ch_free );
+ db_env_set_func_yield( ldap_pvt_thread_yield );
+#endif
+
bi->bi_controls = controls;
bi->bi_open = bdb_open;