Initial idl fetch code, undef BDB_INDEX for now, other cleanup

This commit is contained in:
Kurt Zeilenga 2001-10-05 01:19:58 +00:00
parent 5160da05e5
commit 96e0038832
8 changed files with 78 additions and 37 deletions

View file

@ -15,7 +15,7 @@
LDAP_BEGIN_DECL
#define BDB_INDEX 1
/* #define BDB_INDEX 1 */
/* #define BDB_REINDEX 1 */
/* #define BDB_FILTER_INDICES 1 */
#define BDB_CONFIG_INDICES 1

View file

@ -1,4 +1,4 @@
/* config.c - ldbm backend configuration file routine */
/* config.c - bdb backend configuration file routine */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.

View file

@ -1,4 +1,4 @@
/* delete.c - ldbm backend delete routine */
/* delete.c - bdb backend delete routine */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.

View file

@ -1,4 +1,4 @@
/* extended.c - ldbm backend extended routines */
/* extended.c - bdb backend extended routines */
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
@ -49,4 +49,5 @@ bdb_extended(
*text = "not supported within naming context";
return LDAP_OPERATIONS_ERROR;
}
}

View file

@ -310,15 +310,15 @@ equality_candidates(
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates: (%s%s) MR filter failed (%d)\n",
"", "", rc );
"<= bdb_equality_candidates: MR filter failed (%d)\n",
rc, 0, 0 );
return 0;
}
if( keys == NULL ) {
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates: no keys (%s%s)\n",
"", "", 0 );
"<= bdb_equality_candidates: no keys\n",
0, 0, 0 );
return 0;
}
@ -417,22 +417,22 @@ approx_candidates(
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"<= approx_candidates: (%s%s) MR filter failed (%d)\n",
dbname, LDBM_SUFFIX, rc );
"<= approx_candidates: (%s) MR filter failed (%d)\n",
dbname, rc, 0 );
return idl;
}
if( keys == NULL ) {
Debug( LDAP_DEBUG_TRACE,
"<= approx_candidates: no keys (%s%s)\n",
dbname, LDBM_SUFFIX, 0 );
"<= approx_candidates: no keys (%s)\n",
dbname, 0, 0 );
return idl;
}
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= approx_candidates db open failed (%s%s)\n",
dbname, LDBM_SUFFIX, 0 );
"<= approx_candidates db open failed (%s)\n",
dbname, 0, 0 );
return idl;
}
@ -537,24 +537,24 @@ substring_candidates(
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
"<= substrings_candidates: (%s%s) MR filter failed (%d)\n",
dbname, LDBM_SUFFIX, rc );
"<= substrings_candidates: (%s) MR filter failed (%d)\n",
dbname, rc, 0 );
return idl;
}
if( keys == NULL ) {
Debug( LDAP_DEBUG_TRACE,
"<= substrings_candidates: (0x%04lx) no keys (%s%s)\n",
mask, dbname, LDBM_SUFFIX );
"<= substrings_candidates: (0x%04lx) no keys (%s)\n",
mask, dbname, 0 );
return idl;
}
db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_READER );
rc = bdb_db_cache( be, dbname, &db );
if ( db == NULL ) {
Debug( LDAP_DEBUG_ANY,
"<= substrings_candidates db open failed (%s%s)\n",
dbname, LDBM_SUFFIX, 0 );
"<= substrings_candidates db open failed (%s)\n",
dbname, 0, 0 );
return idl;
}

View file

@ -211,6 +211,30 @@ static int idl_delete( ID *ids, ID id )
return 0;
}
int
bdb_idl_fetch_key(
BackendDB *be,
DB *db,
DB_TXN *tid,
DBT *key,
ID *ids )
{
int rc;
DBT data;
assert( ids != NULL );
DBTzero( &data );
data.data = ids;
data.ulen = BDB_IDL_SIZE * sizeof( ID );
data.flags = DB_DBT_USERMEM;
/* fetch it */
rc = db->get( db, tid, key, &data, 0 );
return rc;
}
int
bdb_idl_insert_key(
BackendDB *be,

View file

@ -23,36 +23,45 @@ bdb_key_read(
DB *db,
DB_TXN *txn,
struct berval *k,
ID **idout
ID *ids
)
{
Datum key;
ID_BLOCK *idl;
DBT key;
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
"key_read: enter\n" ));
"key_read: enter\n" ));
#else
Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
#endif
ldbm_datum_init( key );
key.dptr = k->bv_val;
key.dsize = k->bv_len;
DBzero( &key );
key.data = k->bv_val;
key.size = k->bv_len;
rc = bdb_idl_fetch_key( be, db, key, idl );
rc = bdb_idl_fetch_key( be, db, txn, key, ids );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
"key_read: %ld candidates\n",
idl ? ID_BLOCK_NIDS(idl) : 0 ));
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
"bdb_key_read: failed (%d)\n",
rc ));
#else
Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read: failed (%d)\n",
rc, 0, 0 );
#endif
} else {
#ifdef NEW_LOGGING
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
"bdb_key_read: %ld candidates\n",
idl ? ID_BLOCK_NIDS(idl) : 0 ));
#else
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
#endif
}
*idout = idl;
return LDAP_SUCCESS;
return rc;
}
#endif

View file

@ -142,6 +142,13 @@ int bdb_id2entry(
*/
unsigned bdb_idl_search( ID *ids, ID id );
int bdb_idl_fetch_key(
BackendDB *be,
DB *db,
DB_TXN *txn,
DBT *key,
ID *ids );
int bdb_idl_insert_key(
BackendDB *be,
DB *db,