1 /* init.c - initialize bdb backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2000-2005 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #include <ac/string.h>
21 #include <ac/unistd.h>
22 #include <ac/stdlib.h>
30 static const struct bdbi_database {
35 } bdbi_databases[] = {
36 { "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 },
37 { "dn2id" BDB_SUFFIX, "dn2id", DB_BTREE, 0 },
41 typedef void * db_malloc(size_t);
42 typedef void * db_realloc(void *, size_t);
45 bdb_db_init( BackendDB *be )
49 Debug( LDAP_DEBUG_TRACE,
50 LDAP_XSTRING(bdb_db_init) ": Initializing " BDB_UCTYPE " database\n",
53 /* allocate backend-database-specific stuff */
54 bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
56 /* DBEnv parameters */
57 bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
58 bdb->bi_dbenv_xflags = 0;
59 bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
61 bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
63 bdb->bi_lock_detect = DB_LOCK_DEFAULT;
64 bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
65 bdb->bi_search_stack = NULL;
67 ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
68 ldap_pvt_thread_mutex_init( &bdb->bi_lastid_mutex );
70 ldap_pvt_thread_mutex_init( &bdb->bi_modrdns_mutex );
72 ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
73 ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
74 ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
75 ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
76 ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
79 be->be_cf_ocs = be->bd_info->bi_cf_ocs;
85 bdb_db_close( BackendDB *be );
88 bdb_db_open( BackendDB *be )
91 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
92 struct stat stat1, stat2;
94 char path[MAXPATHLEN];
96 int do_recover = 0, do_alock_recover = 0, open_env = 1, got_env = 0;
98 if ( be->be_suffix == NULL ) {
99 Debug( LDAP_DEBUG_ANY,
100 "bdb_db_open: need suffix\n",
105 Debug( LDAP_DEBUG_ARGS,
107 be->be_suffix[0].bv_val, 0, 0 );
109 #ifndef BDB_MULTIPLE_SUFFIXES
110 if ( be->be_suffix[1].bv_val ) {
111 Debug( LDAP_DEBUG_ANY,
112 "bdb_db_open: only one suffix allowed\n", 0, 0, 0 );
117 /* Check existence of dbenv_home. Any error means trouble */
118 rc = stat( bdb->bi_dbenv_home, &stat1 );
120 Debug( LDAP_DEBUG_ANY,
121 "bdb_db_open: Cannot access database directory %s (%d)\n",
122 bdb->bi_dbenv_home, errno, 0 );
126 /* Perform database use arbitration/recovery logic */
127 rc = alock_open( &bdb->bi_alock_info,
130 slapMode & SLAP_TOOL_READONLY ?
131 ALOCK_LOCKED : ALOCK_UNIQUE );
133 if( rc == ALOCK_RECOVER ) {
134 Debug( LDAP_DEBUG_ANY,
135 "bdb_db_open: unclean shutdown detected;"
136 " attempting recovery.\n",
138 do_alock_recover = 1;
140 } else if( rc == ALOCK_BUSY ) {
141 Debug( LDAP_DEBUG_ANY,
142 "bdb_db_open: database already in use\n",
145 } else if( rc != ALOCK_CLEAN ) {
146 Debug( LDAP_DEBUG_ANY,
147 "bdb_db_open: alock package is unstable\n",
153 * The DB_CONFIG file may have changed. If so, recover the
154 * database so that new settings are put into effect. Also
155 * note the possible absence of DB_CONFIG in the log.
157 if( stat( bdb->bi_db_config_path, &stat1 ) == 0 ) {
159 char *ptr = lutil_strcopy(path, bdb->bi_dbenv_home);
160 *ptr++ = LDAP_DIRSEP[0];
161 strcpy( ptr, "__db.001" );
162 if( stat( path, &stat2 ) == 0 ) {
163 if( stat2.st_mtime <= stat1.st_mtime ) {
164 Debug( LDAP_DEBUG_ANY,
165 "bdb_db_open: DB_CONFIG for suffix %s has changed.\n"
166 "Performing database recovery to activate new settings.\n",
167 be->be_suffix[0].bv_val, 0, 0 );
174 Debug( LDAP_DEBUG_ANY,
175 "bdb_db_open: Warning - No DB_CONFIG file found "
176 "in directory %s: (%d)\n"
177 "Expect poor performance for suffix %s.\n",
178 bdb->bi_dbenv_home, errno, be->be_suffix[0].bv_val );
181 rc = db_env_create( &bdb->bi_dbenv, 0 );
183 Debug( LDAP_DEBUG_ANY,
184 "bdb_db_open: db_env_create failed: %s (%d)\n",
185 db_strerror(rc), rc, 0 );
189 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
190 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
192 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
194 /* One long-lived TXN per thread, two TXNs per write op */
195 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
197 if( bdb->bi_dbenv_xflags != 0 ) {
198 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
199 bdb->bi_dbenv_xflags, 1);
201 Debug( LDAP_DEBUG_ANY,
202 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
203 db_strerror(rc), rc, 0 );
208 #define BDB_TXN_FLAGS (DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN)
211 strcpy( path, bdb->bi_dbenv_home );
215 dbhome = bdb->bi_dbenv_home;
218 Debug( LDAP_DEBUG_TRACE,
219 "bdb_db_open: dbenv_open(%s)\n",
220 bdb->bi_dbenv_home, 0, 0);
222 /* Check if there is a usable existing environment */
223 flags = DB_JOINENV | DB_THREAD;
225 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
226 flags, bdb->bi_dbenv_mode );
232 rc = bdb->bi_dbenv->get_open_flags( bdb->bi_dbenv, &flags );
234 int flag2 = flags & BDB_TXN_FLAGS;
236 /* In quick mode, none of these flags are allowed */
237 if ( slapMode & SLAP_TOOL_QUICK ) {
241 /* In normal mode, all of these flags are required */
242 if ( flag2 == BDB_TXN_FLAGS )
247 /* In Quick mode, we cannot Recover... */
248 if ( slapMode & SLAP_TOOL_QUICK ) {
249 /* If we need to recover but we had no TXNs, just fail */
250 if ( do_recover && flags_ok ) {
251 Debug( LDAP_DEBUG_ANY,
252 "bdb_db_open: Database cannot be recovered. "
253 "Restore from backup!\n", 0, 0, 0);
257 /* We need to recover, and we had TXN support before:
258 * Close this env, open a new one with recovery flags.
261 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
262 bdb->bi_dbenv = NULL;
263 rc = db_env_create( &bdb->bi_dbenv, 0 );
265 Debug( LDAP_DEBUG_ANY,
266 "bdb_db_open: db_env_create failed: %s (%d)\n",
267 db_strerror(rc), rc, 0 );
270 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv,
271 be->be_suffix[0].bv_val );
272 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
273 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
274 flags | DB_RECOVER, bdb->bi_dbenv_mode );
276 Debug( LDAP_DEBUG_ANY,
277 "bdb_db_open: recovery failed: %s (%d)\n",
278 db_strerror(rc), rc, 0 );
283 /* Prev environment had TXN support, get rid of it */
285 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
286 bdb->bi_dbenv = NULL;
287 rc = db_env_create( &bdb->bi_dbenv, 0 );
289 Debug( LDAP_DEBUG_ANY,
290 "bdb_db_open: db_env_create failed: %s (%d)\n",
291 db_strerror(rc), rc, 0 );
294 bdb->bi_dbenv->remove( bdb->bi_dbenv, dbhome, 0 );
295 bdb->bi_dbenv = NULL;
297 /* Normal TXN mode */
299 /* If we need to recover but we had no TXNs, just fail */
300 if ( do_recover && !flags_ok ) {
301 Debug( LDAP_DEBUG_ANY,
302 "bdb_db_open: Database cannot be recovered. "
303 "Restore from backup!\n", 0, 0, 0);
307 /* Prev environment had no TXN support, close it */
309 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
310 bdb->bi_dbenv = NULL;
315 if ( flags_ok && !do_recover ) {
316 /* This environment is fine, don't reopen it */
319 /* Create a new env that can take the desired settings */
320 if ( bdb->bi_dbenv != NULL ) {
321 bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
322 bdb->bi_dbenv = NULL;
324 rc = db_env_create( &bdb->bi_dbenv, 0 );
326 Debug( LDAP_DEBUG_ANY,
327 "bdb_db_open: db_env_create failed: %s (%d)\n",
328 db_strerror(rc), rc, 0 );
332 bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
333 bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
334 bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
336 /* One long-lived TXN per thread, two TXNs per write op */
337 bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
339 if( bdb->bi_dbenv_xflags != 0 ) {
340 rc = bdb->bi_dbenv->set_flags( bdb->bi_dbenv,
341 bdb->bi_dbenv_xflags, 1);
343 Debug( LDAP_DEBUG_ANY,
344 "bdb_db_open: dbenv_set_flags failed: %s (%d)\n",
345 db_strerror(rc), rc, 0 );
352 /* If we need to recover but there was no existing environment,
353 * then we assume that someone has already manually recovered using
354 * db_recover. Just ignore it.
356 if ( do_recover && !got_env ) {
358 Debug( LDAP_DEBUG_TRACE,
359 "bdb_db_open: Recovery needed but environment is missing - "
360 "assuming recovery was done manually...\n", 0, 0, 0 );
364 flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE;
365 if ( !( slapMode & SLAP_TOOL_QUICK ))
366 flags |= BDB_TXN_FLAGS;
371 /* If a key was set, use shared memory for the BDB environment */
372 if ( bdb->bi_shm_key ) {
373 bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
374 flags |= DB_SYSTEM_MEM;
377 rc = bdb->bi_dbenv->open( bdb->bi_dbenv, dbhome,
378 flags, bdb->bi_dbenv_mode );
380 Debug( LDAP_DEBUG_ANY,
381 "bdb_db_open: dbenv_open failed: %s (%d)\n",
382 db_strerror(rc), rc, 0 );
387 if ( do_alock_recover && alock_recover (&bdb->bi_alock_info) != 0 ) {
388 Debug( LDAP_DEBUG_ANY,
389 "bdb_db_open: alock_recover failed\n",
395 #ifdef SLAP_ZONE_ALLOC
396 if ( bdb->bi_cache.c_maxsize ) {
397 bdb->bi_cache.c_zctx = slap_zn_mem_create(
405 if ( bdb->bi_idl_cache_max_size ) {
406 bdb->bi_idl_tree = NULL;
407 bdb->bi_idl_cache_size = 0;
410 flags = DB_THREAD | bdb->bi_db_opflags;
412 #ifdef DB_AUTO_COMMIT
413 if ( !( slapMode & SLAP_TOOL_QUICK ))
414 flags |= DB_AUTO_COMMIT;
417 bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
418 BDB_INDICES * sizeof(struct bdb_db_info *) );
420 /* open (and create) main database */
421 for( i = 0; bdbi_databases[i].name; i++ ) {
422 struct bdb_db_info *db;
424 db = (struct bdb_db_info *) ch_calloc(1, sizeof(struct bdb_db_info));
426 rc = db_create( &db->bdi_db, bdb->bi_dbenv, 0 );
428 Debug( LDAP_DEBUG_ANY,
429 "bdb_db_open: db_create(%s) failed: %s (%d)\n",
430 bdb->bi_dbenv_home, db_strerror(rc), rc );
434 if( i == BDB_ID2ENTRY ) {
435 if ( slapMode & SLAP_TOOL_MODE )
436 db->bdi_db->mpf->set_priority( db->bdi_db->mpf,
437 DB_PRIORITY_VERY_LOW );
439 rc = db->bdi_db->set_pagesize( db->bdi_db,
440 BDB_ID2ENTRY_PAGESIZE );
441 if ( slapMode & SLAP_TOOL_READMAIN ) {
447 rc = db->bdi_db->set_flags( db->bdi_db,
448 DB_DUP | DB_DUPSORT );
450 if ( slapMode & SLAP_TOOL_READONLY ) {
456 if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
462 rc = db->bdi_db->set_pagesize( db->bdi_db,
467 strcpy( path, bdbi_databases[i].file );
469 rc = DB_OPEN( db->bdi_db,
471 /* bdbi_databases[i].name, */ NULL,
472 bdbi_databases[i].type,
473 bdbi_databases[i].flags | flags,
474 bdb->bi_dbenv_mode );
476 rc = DB_OPEN( db->bdi_db,
477 bdbi_databases[i].file,
478 /* bdbi_databases[i].name, */ NULL,
479 bdbi_databases[i].type,
480 bdbi_databases[i].flags | flags,
481 bdb->bi_dbenv_mode );
485 char buf[SLAP_TEXT_BUFLEN];
487 snprintf( buf, sizeof(buf), "%s/%s",
488 bdb->bi_dbenv_home, bdbi_databases[i].file );
489 Debug( LDAP_DEBUG_ANY,
490 "bdb_db_open: db_open(%s) failed: %s (%d)\n",
491 buf, db_strerror(rc), rc );
492 db->bdi_db->close( db->bdi_db, 0 );
496 flags &= ~(DB_CREATE | DB_RDONLY);
497 db->bdi_name = bdbi_databases[i].name;
498 bdb->bi_databases[i] = db;
501 bdb->bi_databases[i] = NULL;
502 bdb->bi_ndatabases = i;
505 rc = bdb_last_id( be, NULL );
507 Debug( LDAP_DEBUG_ANY,
508 "bdb_db_open: last_id(%s) failed: %s (%d)\n",
509 bdb->bi_dbenv_home, db_strerror(rc), rc );
513 if ( !( slapMode & SLAP_TOOL_QUICK )) {
514 XLOCK_ID(bdb->bi_dbenv, &bdb->bi_cache.c_locker);
517 bdb->bi_flags |= BDB_IS_OPEN;
527 bdb_db_close( BackendDB *be )
530 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
531 struct bdb_db_info *db;
532 bdb_idl_cache_entry_t *entry, *next_entry;
534 bdb->bi_flags &= ~BDB_IS_OPEN;
536 ber_bvarray_free( bdb->bi_db_config );
537 bdb->bi_db_config = NULL;
539 while( bdb->bi_databases && bdb->bi_ndatabases-- ) {
540 db = bdb->bi_databases[bdb->bi_ndatabases];
541 rc = db->bdi_db->close( db->bdi_db, 0 );
542 /* Lower numbered names are not strdup'd */
543 if( bdb->bi_ndatabases >= BDB_NDB )
544 free( db->bdi_name );
547 free( bdb->bi_databases );
548 bdb->bi_databases = NULL;
550 bdb_cache_release_all (&bdb->bi_cache);
552 if ( bdb->bi_idl_cache_max_size ) {
553 avl_free( bdb->bi_idl_tree, NULL );
554 bdb->bi_idl_tree = NULL;
555 entry = bdb->bi_idl_lru_head;
556 while ( entry != NULL ) {
557 next_entry = entry->idl_lru_next;
560 free( entry->kstr.bv_val );
564 bdb->bi_idl_lru_head = bdb->bi_idl_lru_tail = NULL;
567 if ( !( slapMode & SLAP_TOOL_QUICK ) && bdb->bi_dbenv ) {
568 XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
569 bdb->bi_cache.c_locker = 0;
572 /* close db environment */
573 if( bdb->bi_dbenv ) {
574 /* force a checkpoint, but not if we were ReadOnly,
575 * and not in Quick mode since there are no transactions there.
577 if ( !( slapMode & ( SLAP_TOOL_QUICK|SLAP_TOOL_READONLY ))) {
578 rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE );
580 Debug( LDAP_DEBUG_ANY,
581 "bdb_db_close: txn_checkpoint failed: %s (%d)\n",
582 db_strerror(rc), rc, 0 );
586 rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
587 bdb->bi_dbenv = NULL;
589 Debug( LDAP_DEBUG_ANY,
590 "bdb_db_close: close failed: %s (%d)\n",
591 db_strerror(rc), rc, 0 );
596 rc = alock_close( &bdb->bi_alock_info );
598 Debug( LDAP_DEBUG_ANY,
599 "bdb_db_close: alock_close failed\n", 0, 0, 0 );
607 bdb_db_destroy( BackendDB *be )
609 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
611 if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
612 if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
614 bdb_attr_index_destroy( bdb );
616 ldap_pvt_thread_rdwr_destroy ( &bdb->bi_cache.c_rwlock );
617 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.lru_mutex );
618 ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
620 ldap_pvt_thread_mutex_destroy( &bdb->bi_modrdns_mutex );
622 ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
623 ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
624 ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
625 ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
628 be->be_private = NULL;
639 static char *controls[] = {
641 LDAP_CONTROL_MANAGEDSAIT,
643 LDAP_CONTROL_PAGEDRESULTS,
644 #ifdef LDAP_CONTROL_SUBENTRIES
645 LDAP_CONTROL_SUBENTRIES,
647 #ifdef LDAP_CONTROL_X_PERMISSIVE_MODIFY
648 LDAP_CONTROL_X_PERMISSIVE_MODIFY,
653 /* initialize the underlying database system */
654 Debug( LDAP_DEBUG_TRACE,
655 LDAP_XSTRING(bdb_back_initialize) ": initialize "
656 BDB_UCTYPE " backend\n", 0, 0, 0 );
659 SLAP_BFLAG_INCREMENT |
660 #ifdef BDB_SUBENTRIES
661 SLAP_BFLAG_SUBENTRIES |
664 SLAP_BFLAG_REFERRALS;
666 bi->bi_controls = controls;
668 { /* version check */
669 int major, minor, patch, ver;
670 char *version = db_version( &major, &minor, &patch );
674 /* All our stdio does an ASCII to EBCDIC conversion on
675 * the output. Strings from the BDB library are already
676 * in EBCDIC; we have to go back and forth...
678 strcpy( v2, version );
683 ver = (major << 24) | (minor << 16) | patch;
684 if( ver != DB_VERSION_FULL ) {
685 /* fail if a versions don't match */
686 Debug( LDAP_DEBUG_ANY,
687 LDAP_XSTRING(bdb_back_initialize) ": "
688 "BDB library version mismatch:"
689 " expected " DB_VERSION_STRING ","
690 " got %s\n", version, 0, 0 );
694 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_back_initialize)
695 ": %s\n", version, 0, 0 );
698 db_env_set_func_free( ber_memfree );
699 db_env_set_func_malloc( (db_malloc *)ber_memalloc );
700 db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
702 /* This is a no-op on a NO_THREAD build. Leave the default
703 * alone so that BDB will sleep on interprocess conflicts.
705 db_env_set_func_yield( ldap_pvt_thread_yield );
713 bi->bi_db_init = bdb_db_init;
714 bi->bi_db_config = config_generic_wrapper;
715 bi->bi_db_open = bdb_db_open;
716 bi->bi_db_close = bdb_db_close;
717 bi->bi_db_destroy = bdb_db_destroy;
719 bi->bi_op_add = bdb_add;
720 bi->bi_op_bind = bdb_bind;
721 bi->bi_op_compare = bdb_compare;
722 bi->bi_op_delete = bdb_delete;
723 bi->bi_op_modify = bdb_modify;
724 bi->bi_op_modrdn = bdb_modrdn;
725 bi->bi_op_search = bdb_search;
727 bi->bi_op_unbind = 0;
729 bi->bi_extended = bdb_extended;
731 bi->bi_chk_referrals = bdb_referrals;
732 bi->bi_operational = bdb_operational;
733 bi->bi_has_subordinates = bdb_hasSubordinates;
734 bi->bi_entry_release_rw = bdb_entry_release;
735 bi->bi_entry_get_rw = bdb_entry_get;
738 * hooks for slap tools
740 bi->bi_tool_entry_open = bdb_tool_entry_open;
741 bi->bi_tool_entry_close = bdb_tool_entry_close;
742 bi->bi_tool_entry_first = bdb_tool_entry_next;
743 bi->bi_tool_entry_next = bdb_tool_entry_next;
744 bi->bi_tool_entry_get = bdb_tool_entry_get;
745 bi->bi_tool_entry_put = bdb_tool_entry_put;
746 bi->bi_tool_entry_reindex = bdb_tool_entry_reindex;
747 bi->bi_tool_sync = 0;
748 bi->bi_tool_dn2id_get = bdb_tool_dn2id_get;
749 bi->bi_tool_id2entry_get = bdb_tool_id2entry_get;
750 bi->bi_tool_entry_modify = bdb_tool_entry_modify;
752 bi->bi_connection_init = 0;
753 bi->bi_connection_destroy = 0;
755 rc = bdb_back_init_cf( bi );
760 #if (SLAPD_BDB == SLAPD_MOD_DYNAMIC && !defined(BDB_HIER)) || \
761 (SLAPD_HDB == SLAPD_MOD_DYNAMIC && defined(BDB_HIER))
763 /* conditionally define the init_module() function */
765 SLAP_BACKEND_INIT_MODULE( hdb )
766 #else /* !BDB_HIER */
767 SLAP_BACKEND_INIT_MODULE( bdb )
768 #endif /* !BDB_HIER */
770 #endif /* SLAPD_[BH]DB == SLAPD_MOD_DYNAMIC */