typedef void * db_malloc(size_t);
typedef void * db_realloc(void *, size_t);
+#if 0
static int
bdb_open( BackendInfo *bi )
{
return 0;
}
-#if 0
static int
bdb_destroy( BackendInfo *bi )
{
bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
-#ifndef NO_THREADS
-#if 0
- bdb->bi_lock_detect = DB_LOCK_NORUN;
-#else
bdb->bi_lock_detect = DB_LOCK_DEFAULT;
-#endif
+ bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
+ bdb->bi_search_stack = NULL;
+
+#ifdef LDAP_CLIENT_UPDATE
+ LDAP_LIST_INIT (&bdb->psearch_list);
#endif
ldap_pvt_thread_mutex_init( &bdb->bi_database_mutex );
#endif
be->be_private = bdb;
- return 0;
-}
-
-#if 0 /* ifndef NO_THREADS */
-static void *lock_detect_task( void *arg )
-{
- struct bdb_info *bdb = (struct bdb_info *) arg;
-
- while( bdb->bi_dbenv != NULL ) {
- int rc;
- int aborted;
- sleep( bdb->bi_lock_detect_seconds );
- rc = LOCK_DETECT( bdb->bi_dbenv, 0,
- bdb->bi_lock_detect, &aborted );
-
- if( rc != 0 ) {
- break;
- }
-
-#ifdef NEW_LOGGING
- LDAP_LOG( BACK_BDB, ERR, "bdb_db_init: aborted %d locks\n",
- aborted, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "bdb_lock_detect: aborted %d locks\n",
- aborted, 0, 0 );
-#endif
- }
-
- return NULL;
+ return 0;
}
-#endif
int
bdb_bt_compare(
)
{
unsigned char *u, *c;
- int i;
+ int i, x;
u = usrkey->data;
c = curkey->data;
for( i = sizeof(ID)-1; i >= 0; i--)
#endif
{
- if( u[i] - c[i] )
- return u[i] - c[i];
+ x = u[i] - c[i];
+ if( x ) return x;
}
+
return 0;
}
be->be_suffix[0].bv_val, 0, 0 );
#endif
- db_env_set_func_free( ber_memfree );
- db_env_set_func_malloc( ber_memalloc );
- db_env_set_func_realloc( ber_memrealloc );
-
/* we should check existance of dbenv_home and db_directory */
rc = db_env_create( &bdb->bi_dbenv, 0 );
bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
-#ifndef NO_THREADS
bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
+
+#ifdef SLAP_IDL_CACHE
+ if ( bdb->bi_idl_cache_max_size ) {
+ ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_mutex );
+ bdb->bi_idl_cache_size = 0;
+ }
#endif
#ifdef BDB_SUBDIRS
#ifdef BDB_HIER
rc = bdb_build_tree( be );
#endif
-
-#if 0 /* ifndef NO_THREADS */
- if( bdb->bi_lock_detect != DB_LOCK_NORUN ) {
- /* listener as a separate THREAD */
- rc = ldap_pvt_thread_create( &bdb->bi_lock_detect_tid,
- 1, lock_detect_task, bdb );
- }
-#endif
return 0;
}
int rc;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
struct bdb_db_info *db;
+#ifdef SLAP_IDL_CACHE
+ bdb_idl_cache_entry_t *entry, *next_entry;
+#endif
while( bdb->bi_ndatabases-- ) {
db = bdb->bi_databases[bdb->bi_ndatabases];
bdb_cache_release_all (&bdb->bi_cache);
+#ifdef SLAP_IDL_CACHE
+ ldap_pvt_thread_mutex_lock ( &bdb->bi_idl_tree_mutex );
+ entry = bdb->bi_idl_lru_head;
+ while ( entry != NULL ) {
+ next_entry = entry->idl_lru_next;
+ free( entry->idl );
+ free( entry->kstr.bv_val );
+ free( entry );
+ entry = next_entry;
+ }
+ ldap_pvt_thread_mutex_unlock ( &bdb->bi_idl_tree_mutex );
+#endif
+
return 0;
}
{
static char *controls[] = {
LDAP_CONTROL_MANAGEDSAIT,
-#ifdef LDAP_CONTROL_SUBENTRIES
- LDAP_CONTROL_SUBENTRIES,
-#endif
-#ifdef LDAP_CONTROL_NOOP
LDAP_CONTROL_NOOP,
-#endif
-#ifdef LDAP_CONTROL_VALUESRETURNFILTER
+ LDAP_CONTROL_PAGEDRESULTS,
LDAP_CONTROL_VALUESRETURNFILTER,
+#ifdef LDAP_CONTROL_SUBENTRIES
+ LDAP_CONTROL_SUBENTRIES,
#endif
#ifdef LDAP_CLIENT_UPDATE
LDAP_CONTROL_CLIENT_UPDATE,
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_initialize\n", 0, 0, 0 );
#else
- Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
+ Debug( LDAP_DEBUG_TRACE, "bdb_initialize: initialize BDB backend\n",
0, 0, 0 );
#endif
"\texpected: %s \tgot: %s\n", DB_VERSION_STRING, version, 0 );
#else
Debug( LDAP_DEBUG_ANY,
- "bdb_open: version mismatch\n"
+ "bdb_initialize: version mismatch\n"
"\texpected: " DB_VERSION_STRING "\n"
"\tgot: %s \n", version, 0, 0 );
#endif
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, DETAIL1,
- "bdb_db_initialize: bdb_open: %s\n", version, 0, 0 );
+ "bdb_db_initialize: %s\n", version, 0, 0 );
#else
- Debug( LDAP_DEBUG_ANY, "bdb_open: %s\n",
+ Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n",
version, 0, 0 );
#endif
}
-#if 0
- db_env_set_func_malloc( ch_malloc );
- db_env_set_func_realloc( ch_realloc );
- db_env_set_func_free( ch_free );
-#endif
-
+ db_env_set_func_free( ber_memfree );
+ db_env_set_func_malloc( (db_malloc *)ber_memalloc );
+ db_env_set_func_realloc( (db_realloc *)ber_memrealloc );
+#ifndef NO_THREAD
+ /* This is a no-op on a NO_THREAD build. Leave the default
+ * alone so that BDB will sleep on interprocess conflicts.
+ */
db_env_set_func_yield( ldap_pvt_thread_yield );
+#endif
{
static char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
bi->bi_chk_referrals = bdb_referrals;
bi->bi_operational = bdb_operational;
+ bi->bi_has_subordinates = bdb_hasSubordinates;
bi->bi_entry_release_rw = bdb_entry_release;
/*