mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-05 06:31:11 -05:00
BDB updates... haven't had a chance to work on this for a while,
committin what I have so that someone else might be able to work it.
This commit is contained in:
parent
5e7336fcf1
commit
d6730e5f50
15 changed files with 163 additions and 103 deletions
|
|
@ -3,12 +3,12 @@
|
|||
SRCS = init.c tools.c config.c \
|
||||
add.c bind.c compare.c delete.c modify.c modrdn.c search.c \
|
||||
extended.c passwd.c referral.c \
|
||||
attr.c index.c key.c dbcache.c \
|
||||
attr.c index.c key.c dbcache.c filterindex.c \
|
||||
dn2entry.c dn2id.c error.c id2entry.c idl.c nextid.c
|
||||
OBJS = init.lo tools.lo config.lo \
|
||||
add.lo bind.lo compare.lo delete.lo modify.lo modrdn.lo search.lo \
|
||||
extended.lo passwd.lo referral.lo \
|
||||
attr.lo index.lo key.lo dbcache.lo \
|
||||
attr.lo index.lo key.lo dbcache.lo filterindex.lo \
|
||||
dn2entry.lo dn2id.lo error.lo id2entry.lo idl.lo nextid.lo
|
||||
|
||||
LDAP_INCDIR= ../../../include
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ LDAP_BEGIN_DECL
|
|||
|
||||
#define BDB_SUFFIX ".bdb"
|
||||
#define BDB_NEXTID 0
|
||||
#define BDB_DN2ID 1
|
||||
#define BDB_ID2ENTRY 2
|
||||
#define BDB_ID2ENTRY 1
|
||||
#define BDB_DN2ID 2
|
||||
#define BDB_NDB 3
|
||||
|
||||
#define BDB_INDICES 128
|
||||
|
|
|
|||
|
|
@ -230,6 +230,22 @@ retry: /* transaction retry */
|
|||
goto return_results;
|
||||
}
|
||||
|
||||
/* delete indices for old attributes */
|
||||
rc = bdb_index_entry_del( be, ltid, e, e->e_attrs );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
switch( rc ) {
|
||||
case DB_LOCK_DEADLOCK:
|
||||
case DB_LOCK_NOTGRANTED:
|
||||
goto retry;
|
||||
default:
|
||||
rc = LDAP_OTHER;
|
||||
}
|
||||
Debug( LDAP_DEBUG_ANY, "entry index delete failed!\n",
|
||||
0, 0, 0 );
|
||||
text = "entry index delete failed";
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
/* delete from id2entry */
|
||||
if ( bdb_id2entry_delete( be, ltid, e->e_id ) != 0 ) {
|
||||
switch( rc ) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ bdb_dn2id_add(
|
|||
DB *db = bdb->bi_dn2id->bdi_db;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_add( \"%s\", 0x%08lx )\n",
|
||||
dn, id, 0 );
|
||||
dn, (long) id, 0 );
|
||||
assert( id != NOID );
|
||||
|
||||
DBTzero( &key );
|
||||
|
|
@ -294,7 +294,7 @@ bdb_dn2id_matched(
|
|||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= bdb_dn2id_matched: id=0x%08lx: %s %s\n",
|
||||
*id, *matchedDN == NULL ? "entry" : "matched", dn );
|
||||
(long) *id, *matchedDN == NULL ? "entry" : "matched", dn );
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
|
@ -382,13 +382,14 @@ bdb_dn2idl(
|
|||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= bdb_dn2idl: get failed: %s (%d)\n",
|
||||
db_strerror( rc ), rc, 0 );
|
||||
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= bdb_dn2idl: id=%ld first=%ld last=%ld\n",
|
||||
ids[0], BDB_IDL_FIRST( ids ), BDB_IDL_LAST( ids ) );
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST( ids ), (long) BDB_IDL_LAST( ids ) );
|
||||
}
|
||||
|
||||
ch_free( key.data );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ bdb_filter_candidates(
|
|||
break;
|
||||
|
||||
case LDAP_FILTER_NOT: {
|
||||
ID tmp[BDB_IDL_SIZE];
|
||||
ID tmp[BDB_IDL_UM_SIZE];
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
|
||||
rc = bdb_filter_candidates( be, range, f->f_not, tmp );
|
||||
|
|
@ -130,8 +130,9 @@ bdb_filter_candidates(
|
|||
|
||||
Debug( LDAP_DEBUG_FILTER,
|
||||
"<= bdb_filter_candidates: id=%ld first=%ld last=%ld\n",
|
||||
ids[0], ids[1],
|
||||
BDB_IDL_IS_RANGE( ids ) ? ids[2] : ids[ids[0]] );
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST( ids ),
|
||||
(long) BDB_IDL_LAST( ids ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -156,8 +157,8 @@ list_candidates(
|
|||
}
|
||||
|
||||
for ( f = flist; f != NULL; f = f->f_next ) {
|
||||
ID tmp[BDB_IDL_SIZE];
|
||||
ID result[BDB_IDL_SIZE];
|
||||
ID tmp[BDB_IDL_UM_SIZE];
|
||||
ID result[BDB_IDL_UM_SIZE];
|
||||
rc = bdb_filter_candidates( be, range, f, tmp );
|
||||
|
||||
if ( rc != 0 ) {
|
||||
|
|
@ -189,7 +190,9 @@ list_candidates(
|
|||
|
||||
Debug( LDAP_DEBUG_FILTER,
|
||||
"<= bdb_list_candidates: id=%ld first=%ld last=%ld\n",
|
||||
ids[0], BDB_IDL_FIRST(ids), BDB_IDL_LAST(ids) );
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST(ids),
|
||||
(long) BDB_IDL_LAST(ids) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +252,9 @@ presence_candidates(
|
|||
|
||||
Debug(LDAP_DEBUG_TRACE,
|
||||
"<= bdb_presence_candidates: id=%ld first=%ld last=%ld\n",
|
||||
ids[0], BDB_IDL_FIRST(ids), BDB_IDL_LAST(ids) );
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST(ids),
|
||||
(long) BDB_IDL_LAST(ids) );
|
||||
|
||||
done:
|
||||
ber_bvfree( prefix );
|
||||
|
|
@ -323,8 +328,8 @@ equality_candidates(
|
|||
}
|
||||
|
||||
for ( i= 0; keys[i] != NULL; i++ ) {
|
||||
ID save[BDB_IDL_SIZE];
|
||||
ID tmp[BDB_IDL_SIZE];
|
||||
ID save[BDB_IDL_UM_SIZE];
|
||||
ID tmp[BDB_IDL_UM_SIZE];
|
||||
|
||||
rc = bdb_key_read( be, db, keys[i], tmp );
|
||||
|
||||
|
|
@ -353,8 +358,10 @@ equality_candidates(
|
|||
ber_bvecfree( keys );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= bdb_equality_candidates %ld\n",
|
||||
ids[0], BDB_IDL_FIRST(ids), BDB_IDL_LAST(ids) );
|
||||
"<= bdb_equality_candidates id=%ld, first=%ld, last=%ld\n",
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST(ids),
|
||||
(long) BDB_IDL_LAST(ids) );
|
||||
return( idl );
|
||||
}
|
||||
|
||||
|
|
@ -467,8 +474,10 @@ approx_candidates(
|
|||
|
||||
ber_bvecfree( keys );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %ld\n",
|
||||
ids[0], BDB_IDL_FIRST(ids), BDB_IDL_LAST(ids) );
|
||||
Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %ld, first=%ld, last=%ld\n",
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST(ids),
|
||||
(long) BDB_IDL_LAST(ids) );
|
||||
|
||||
return( idl );
|
||||
}
|
||||
|
|
@ -589,8 +598,10 @@ substring_candidates(
|
|||
|
||||
ber_bvecfree( keys );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "<= substrings_candidates %ld\n",
|
||||
ids[0], BDB_IDL_FIRST(ids), BDB_IDL_LAST(ids) );
|
||||
Debug( LDAP_DEBUG_TRACE, "<= substrings_candidates %ld, first=%ld, last=%ld\n",
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST(ids),
|
||||
(long) BDB_IDL_LAST(ids) );
|
||||
|
||||
return( idl );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
static void idl_check( ID *ids )
|
||||
{
|
||||
if( BDB_IDL_IS_RANGE( ids ) ) {
|
||||
assert( ids[1] <= ids[2] );
|
||||
assert( BDB_IDL_RANGE_FIRST(ids) <= BDB_IDL_RANGE_LAST(ids) );
|
||||
} else {
|
||||
ID i;
|
||||
for( i=1; i < ids[0]; i++ ) {
|
||||
|
|
@ -41,8 +41,9 @@ static void idl_dump( ID *ids )
|
|||
{
|
||||
if( BDB_IDL_IS_RANGE( ids ) ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"IDL: range %ld - %ld\n",
|
||||
(long) ids[1], (long) idl[2], 0 );
|
||||
"IDL: range ( %ld - %ld )\n",
|
||||
(long) BDB_IDL_RANGE_FIRST( ids ),
|
||||
(long) BDB_IDL_RANGE_LAST( ids ) );
|
||||
|
||||
} else {
|
||||
ID i;
|
||||
|
|
@ -52,7 +53,7 @@ static void idl_dump( ID *ids )
|
|||
if( i % 16 == 1 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "\n", 0, 0, 0 );
|
||||
}
|
||||
Debug( LDAP_DEBUG_ANY, " %02lx", ids[i], 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, " %02lx", (long) ids[i], 0, 0 );
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "\n", 0, 0, 0 );
|
||||
|
|
@ -127,7 +128,7 @@ static int idl_insert( ID *ids, ID id )
|
|||
unsigned x = bdb_idl_search( ids, id );
|
||||
|
||||
#if IDL_DEBUG > 1
|
||||
Debug( LDAP_DEBUG_ANY, "insert: %04lx at %d\n", id, x, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "insert: %04lx at %d\n", (long) id, x, 0 );
|
||||
idl_dump( ids );
|
||||
#elif IDL_DEBUG > 0
|
||||
idl_check( ids );
|
||||
|
|
@ -176,7 +177,7 @@ static int idl_delete( ID *ids, ID id )
|
|||
unsigned x = bdb_idl_search( ids, id );
|
||||
|
||||
#if IDL_DEBUG > 1
|
||||
Debug( LDAP_DEBUG_ANY, "delete: %04lx at %d\n", id, x, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "delete: %04lx at %d\n", (long) id, x, 0 );
|
||||
idl_dump( ids );
|
||||
#elif IDL_DEBUG > 0
|
||||
idl_check( ids );
|
||||
|
|
@ -226,12 +227,36 @@ bdb_idl_fetch_key(
|
|||
|
||||
DBTzero( &data );
|
||||
data.data = ids;
|
||||
data.ulen = BDB_IDL_SIZE * sizeof( ID );
|
||||
data.ulen = BDB_IDL_UM_SIZEOF;
|
||||
data.flags = DB_DBT_USERMEM;
|
||||
|
||||
/* fetch it */
|
||||
rc = db->get( db, tid, key, &data, 0 );
|
||||
|
||||
if( rc == DB_NOTFOUND ) {
|
||||
return rc;
|
||||
|
||||
} else if( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
|
||||
"get failed: %s (%d)\n",
|
||||
db_strerror(rc), rc, 0 );
|
||||
return rc;
|
||||
|
||||
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
|
||||
/* size not multiple of ID size */
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
|
||||
"odd size: expected %ld multiple, got %ld\n",
|
||||
(long) sizeof( ID ), (long) data.size, 0 );
|
||||
return -1;
|
||||
|
||||
} else if ( data.size != BDB_IDL_SIZEOF(ids) ) {
|
||||
/* size mismatch */
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: "
|
||||
"get size mismatch: expected %ld, got %ld\n",
|
||||
(long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +280,7 @@ bdb_idl_insert_key(
|
|||
assert( id != NOID );
|
||||
|
||||
data.data = ids;
|
||||
data.ulen = sizeof( ids );
|
||||
data.ulen = sizeof ids;
|
||||
data.flags = DB_DBT_USERMEM;
|
||||
|
||||
/* fetch the key for read/modify/write */
|
||||
|
|
@ -267,18 +292,25 @@ bdb_idl_insert_key(
|
|||
data.size = 2 * sizeof( ID );
|
||||
|
||||
} else if ( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_insert_key: get failed: %s (%d)\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
|
||||
"get failed: %s (%d)\n",
|
||||
db_strerror(rc), rc, 0 );
|
||||
return rc;
|
||||
|
||||
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
|
||||
/* size not multiple of ID size */
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_insert_key: odd size: expected %ld multiple, got %ld\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
|
||||
"odd size: expected %ld multiple, got %ld\n",
|
||||
(long) sizeof( ID ), (long) data.size, 0 );
|
||||
return -1;
|
||||
|
||||
} else if ( data.size != BDB_IDL_SIZEOF(ids) ) {
|
||||
/* size mismatch */
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
|
||||
"get size mismatch: expected %ld, got %ld\n",
|
||||
(long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
|
||||
return -1;
|
||||
|
||||
} else if ( BDB_IDL_IS_RANGE(ids) ) {
|
||||
if( id < ids[1] ) {
|
||||
ids[1] = id;
|
||||
|
|
@ -288,36 +320,25 @@ bdb_idl_insert_key(
|
|||
return 0;
|
||||
}
|
||||
|
||||
} else if ( data.size != (1 + ids[0]) * sizeof( ID ) ) {
|
||||
/* size mismatch */
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_insert_key: get size mismatch: expected %ld, got %ld\n",
|
||||
(long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
|
||||
return -1;
|
||||
|
||||
} else {
|
||||
rc = idl_insert( ids, id );
|
||||
|
||||
if( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_insert_key: idl_insert failed (%d)\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
|
||||
"idl_insert failed (%d)\n",
|
||||
rc, 0, 0 );
|
||||
return rc;
|
||||
}
|
||||
|
||||
if( BDB_IDL_IS_RANGE( ids ) ) {
|
||||
data.size = BDB_IDL_RANGE_SIZE;
|
||||
} else {
|
||||
data.size = (ids[0]+1) * sizeof( ID );
|
||||
}
|
||||
data.size = BDB_IDL_SIZEOF( ids );
|
||||
}
|
||||
|
||||
/* store the key */
|
||||
rc = db->put( db, tid, key, &data, 0 );
|
||||
|
||||
if( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_insert_key: get failed: %s (%d)\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_insert_key: "
|
||||
"put failed: %s (%d)\n",
|
||||
db_strerror(rc), rc, 0 );
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -350,15 +371,15 @@ bdb_idl_delete_key(
|
|||
rc = db->get( db, tid, key, &data, DB_RMW );
|
||||
|
||||
if ( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_delete_key: get failed: %s (%d)\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
|
||||
"get failed: %s (%d)\n",
|
||||
db_strerror(rc), rc, 0 );
|
||||
return rc;
|
||||
|
||||
} else if ( data.size == 0 || data.size % sizeof( ID ) ) {
|
||||
/* size not multiple of ID size */
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_delete_key: odd size: expected %ld multiple, got %ld\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
|
||||
"odd size: expected %ld multiple, got %ld\n",
|
||||
(long) sizeof( ID ), (long) data.size, 0 );
|
||||
return -1;
|
||||
|
||||
|
|
@ -367,8 +388,8 @@ bdb_idl_delete_key(
|
|||
|
||||
} else if ( data.size != (1 + ids[0]) * sizeof( ID ) ) {
|
||||
/* size mismatch */
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_delete_key: get size mismatch: expected %ld, got %ld\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
|
||||
"get size mismatch: expected %ld, got %ld\n",
|
||||
(long) ((1 + ids[0]) * sizeof( ID )), (long) data.size, 0 );
|
||||
return -1;
|
||||
|
||||
|
|
@ -376,8 +397,8 @@ bdb_idl_delete_key(
|
|||
rc = idl_delete( ids, id );
|
||||
|
||||
if( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_delete_key: idl_delete failed (%d)\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
|
||||
"idl_delete failed (%d)\n",
|
||||
rc, 0, 0 );
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -386,8 +407,8 @@ bdb_idl_delete_key(
|
|||
/* delete the key */
|
||||
rc = db->del( db, tid, key, 0 );
|
||||
if( rc != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"=> bdb_idl_delete_key: delete failed: %s (%d)\n",
|
||||
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "
|
||||
"delete failed: %s (%d)\n",
|
||||
db_strerror(rc), rc, 0 );
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -509,7 +530,7 @@ bdb_idl_union(
|
|||
ids[0] = 0;
|
||||
|
||||
while( ida != NOID && idb != NOID ) {
|
||||
if( ++ids[0] > BDB_IDL_MAX ) {
|
||||
if( ++ids[0] > BDB_IDL_UM_MAX ) {
|
||||
ids[0] = NOID;
|
||||
ids[2] = IDL_MAX( BDB_IDL_LAST(a), BDB_IDL_LAST(b) );
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -12,20 +12,27 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
/* larger IDL sizes - likely should be even bigger */
|
||||
#define BDB_IDL_DB_SIZE (1<<16) /* 64K IDL on disk */
|
||||
#define BDB_IDL_SIZE (1<<17) /* 128K IDL in memory */
|
||||
/* IDL sizes - likely should be even bigger
|
||||
* limiting factors: sizeof(ID), thread stack size
|
||||
*/
|
||||
#define BDB_IDL_DB_SIZE (1<<16) /* 32K IDL on disk */
|
||||
#define BDB_IDL_UM_SIZE (1<<17) /* 64K IDL in memory */
|
||||
#define BDB_IDL_UM_SIZEOF (BDB_IDL_UM_SIZE * sizeof(ID))
|
||||
|
||||
#define BDB_IDL_DB_MAX (BDB_IDL_DB_SIZE-32)
|
||||
/* #define BDB_IDL_DB_ALLOC (BDB_IDL_DB_SIZE * sizeof(ID)) */
|
||||
|
||||
#define BDB_IDL_MAX (BDB_IDL_DB_SIZE-32)
|
||||
/* #define BDB_IDL_DB_ALLOC (BDB_IDL_DB_SIZE * sizeof(ID)) */
|
||||
#define BDB_IDL_UM_MAX (BDB_IDL_UM_SIZE-32)
|
||||
/* #define BDB_IDL_UM_ALLOC (BDB_IDL_UM_SIZE * sizeof(ID)) */
|
||||
|
||||
#define BDB_IDL_IS_RANGE(ids) ((ids)[0] == NOID)
|
||||
#define BDB_IDL_RANGE_SIZE (3 * sizeof(ID))
|
||||
#define BDB_IDL_SIZEOF(ids) ( BDB_IDL_IS_RANGE(ids) \
|
||||
? BDB_IDL_RANGE_SIZE : ((ids)[0]+1) * sizeof(ID) )
|
||||
#define BDB_IDL_RANGE_SIZE (3)
|
||||
#define BDB_IDL_RANGE_SIZEOF (BDB_IDL_RANGE_SIZE * sizeof(ID))
|
||||
#define BDB_IDL_SIZEOF(ids) (BDB_IDL_IS_RANGE(ids) \
|
||||
? BDB_IDL_RANGE_SIZE : ((ids)[0]+1) * sizeof(ID))
|
||||
|
||||
#define BDB_IDL_RANGE_FIRST(ids) ((ids)[1])
|
||||
#define BDB_IDL_RANGE_LAST(ids) ((ids)[2])
|
||||
|
||||
#define BDB_IDL_RANGE( ids, f, l ) \
|
||||
do { \
|
||||
|
|
@ -39,13 +46,13 @@
|
|||
(ids)[0] = 0; \
|
||||
(ids)[1] = 0; \
|
||||
(ids)[2] = 0; \
|
||||
} while(0);
|
||||
} while(0)
|
||||
|
||||
#define BDB_IDL_IS_ZERO(ids) ( (ids)[0] == 0 )
|
||||
#define BDB_IDL_IS_ALL( range, ids ) ( (ids)[0] == NOID \
|
||||
&& (ids)[1] <= (range)[1] && (range)[2] <= (ids)[2] )
|
||||
|
||||
#define BDB_IDL_CPY( dst, src ) (memcpy( dst, src, BDB_IDL_SIZEOF( src ) ))
|
||||
#define BDB_IDL_CPY( dst, src ) (AC_MEMCPY( dst, src, BDB_IDL_SIZEOF( src ) ))
|
||||
|
||||
#define BDB_IDL_ID( bdb, ids, id ) BDB_IDL_RANGE( ids, id, ((bdb)->bi_lastid) )
|
||||
#define BDB_IDL_ALL( bdb, ids ) BDB_IDL_RANGE( ids, 1, ((bdb)->bi_lastid) )
|
||||
|
|
|
|||
|
|
@ -76,11 +76,13 @@ int bdb_index_param(
|
|||
Backend *be,
|
||||
AttributeDescription *desc,
|
||||
int ftype,
|
||||
char **dbnamep,
|
||||
DB **dbp,
|
||||
slap_mask_t *maskp,
|
||||
struct berval **prefixp )
|
||||
{
|
||||
int rc;
|
||||
slap_mask_t mask;
|
||||
DB *db;
|
||||
char *dbname;
|
||||
char *atname;
|
||||
|
||||
|
|
@ -90,6 +92,12 @@ int bdb_index_param(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
rc = bdb_db_cache( be, dbname, &db );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
switch(ftype) {
|
||||
case LDAP_FILTER_PRESENT:
|
||||
if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
|
||||
|
|
@ -122,7 +130,7 @@ int bdb_index_param(
|
|||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
|
||||
done:
|
||||
*dbnamep = dbname;
|
||||
*dbp = db;
|
||||
*prefixp = ber_bvstrdup( atname );
|
||||
*maskp = mask;
|
||||
return LDAP_SUCCESS;
|
||||
|
|
@ -358,13 +366,13 @@ bdb_index_entry(
|
|||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
|
||||
"index_entry: %s (%s)%ld\n",
|
||||
"index_entry: %s (%s) %ld\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "add" : "del",
|
||||
e->e_dn, e->e_id ));
|
||||
e->e_dn, (long) e->e_id ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "add" : "del",
|
||||
e->e_id, e->e_dn );
|
||||
(long) e->e_id, e->e_dn );
|
||||
#endif
|
||||
|
||||
/* add each attribute to the indexes */
|
||||
|
|
@ -380,7 +388,7 @@ bdb_index_entry(
|
|||
Debug( LDAP_DEBUG_TRACE,
|
||||
"<= index_entry_%s( %ld, \"%s\" ) success\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "add" : "del",
|
||||
e->e_id, e->e_dn );
|
||||
(long) e->e_id, e->e_dn );
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -388,11 +396,11 @@ bdb_index_entry(
|
|||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
|
||||
"index_entry: success\n" ));
|
||||
"index_entry: success\n" ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "add" : "del",
|
||||
e->e_id, e->e_dn );
|
||||
(long) e->e_id, e->e_dn );
|
||||
#endif
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ static struct bdbi_database {
|
|||
int flags;
|
||||
} bdbi_databases[] = {
|
||||
{ "nextid" BDB_SUFFIX, "nextid", DB_BTREE, 0 },
|
||||
{ "dn2entry" BDB_SUFFIX, "dn2entry", DB_BTREE, 0 },
|
||||
{ "id2entry" BDB_SUFFIX, "id2entry", DB_BTREE, 0 },
|
||||
{ "dn2id" BDB_SUFFIX, "dn2id", DB_BTREE, 0 },
|
||||
{ NULL, NULL, 0, 0 }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ bdb_key_read(
|
|||
} else {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
|
||||
"bdb_key_read: %ld candidates\n", BDB_IDL_N(ids) );
|
||||
"bdb_key_read: %ld candidates\n", (long) BDB_IDL_N(ids) ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
|
||||
BDB_IDL_N(ids), 0, 0 );
|
||||
(long) BDB_IDL_N(ids), 0, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ bdb_key_change(
|
|||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
|
||||
"key_change: %s ID %lx\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long)id ));
|
||||
op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long) id ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
|
||||
op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ retry: /* transaction retry */
|
|||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_modrdn: wr to new parent OK np=%p, id=%ld\n",
|
||||
np, np->e_id, 0 );
|
||||
np, (long) np->e_id, 0 );
|
||||
|
||||
/* check newSuperior for "children" acl */
|
||||
if ( !access_allowed( be, conn, op, np, children, NULL, ACL_WRITE ) ) {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ void bdb_errcall( const char *pfx, char * msg );
|
|||
*/
|
||||
int bdb_filter_candidates(
|
||||
Backend *be,
|
||||
ID *range,
|
||||
Filter *f,
|
||||
ID *ids );
|
||||
|
||||
|
|
@ -197,7 +196,7 @@ bdb_index_param LDAP_P((
|
|||
Backend *be,
|
||||
AttributeDescription *desc,
|
||||
int ftype,
|
||||
char **dbname,
|
||||
DB **db,
|
||||
slap_mask_t *mask,
|
||||
struct berval **prefix ));
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ bdb_referrals(
|
|||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
|
||||
op->o_tag, dn, matched_dn );
|
||||
(long) op->o_tag, dn, matched_dn );
|
||||
|
||||
refs = is_entry_referral( matched )
|
||||
? get_entry_referrals( be, conn, op, matched )
|
||||
|
|
@ -93,7 +93,7 @@ bdb_referrals(
|
|||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
|
||||
op->o_tag, dn, e->e_dn );
|
||||
(long) op->o_tag, dn, e->e_dn );
|
||||
|
||||
if( refs != NULL ) {
|
||||
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ bdb_search(
|
|||
const char *text = NULL;
|
||||
time_t stoptime;
|
||||
ID id, cursor;
|
||||
ID candidates[BDB_IDL_SIZE];
|
||||
ID candidates[BDB_IDL_UM_SIZE];
|
||||
Entry *e = NULL;
|
||||
struct berval **v2refs = NULL;
|
||||
Entry *matched = NULL;
|
||||
|
|
@ -273,7 +273,7 @@ bdb_search(
|
|||
/* only complain for non-range IDLs */
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_search: candidate %ld not found\n",
|
||||
id, 0, 0 );
|
||||
(long) id, 0, 0 );
|
||||
}
|
||||
|
||||
goto loop_continue;
|
||||
|
|
@ -397,12 +397,12 @@ bdb_search(
|
|||
} else {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_search: %ld scope not okay\n",
|
||||
id, 0, 0 );
|
||||
(long) id, 0, 0 );
|
||||
}
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_search: %ld does match filter\n",
|
||||
id, 0, 0 );
|
||||
(long) id, 0, 0 );
|
||||
}
|
||||
|
||||
loop_continue:
|
||||
|
|
@ -501,20 +501,17 @@ static int search_candidates(
|
|||
|
||||
|
||||
#ifdef BDB_FILTER_INDICES
|
||||
{
|
||||
ID range[3];
|
||||
BDB_IDL_ID( bdb, range, e->e_id );
|
||||
rc = bdb_filter_candidates( be, range, &f, ids );
|
||||
}
|
||||
rc = bdb_filter_candidates( be, &f, ids );
|
||||
#else
|
||||
BDB_IDL_ID( bdb, ids, e->e_id );
|
||||
rc = 0;
|
||||
#endif
|
||||
|
||||
Debug(LDAP_DEBUG_TRACE,
|
||||
"search_candidates: id=%ld first=%ld last=%ld\n",
|
||||
ids[0], ids[1],
|
||||
BDB_IDL_IS_RANGE( ids ) ? ids[2] : ids[ids[0]] );
|
||||
"bdb_search_candidates: id=%ld first=%ld last=%ld\n",
|
||||
(long) ids[0],
|
||||
(long) BDB_IDL_FIRST(ids),
|
||||
(long) BDB_IDL_LAST(ids) );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ ID bdb_tool_entry_put(
|
|||
assert( slapMode & SLAP_TOOL_MODE );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_put( %ld, \"%s\" )\n",
|
||||
e->e_id, e->e_dn, 0 );
|
||||
(long) e->e_id, e->e_dn, 0 );
|
||||
|
||||
rc = txn_begin( bdb->bi_dbenv, NULL, &tid, 0 );
|
||||
if( rc != 0 ) {
|
||||
|
|
@ -222,7 +222,7 @@ int bdb_tool_entry_reindex(
|
|||
*/
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_reindex( %ld, \"%s\" )\n",
|
||||
id, e->e_dn, 0 );
|
||||
(long) id, e->e_dn, 0 );
|
||||
|
||||
rc = bdb_index_entry_add( be, tid, e, e->e_attrs );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue