Fix redundant index lookups from component matching

This commit is contained in:
Howard Chu 2005-01-24 12:25:37 +00:00
parent c6b6d2a5ec
commit fc337704c5
3 changed files with 35 additions and 11 deletions

View File

@ -67,6 +67,24 @@ bdb_attr_comp_ref(
*cr = a != NULL ? a->ai_cr : 0 ;
}
void
bdb_attr_mask_cr(
struct bdb_info *bdb,
AttributeDescription *desc,
slap_mask_t *indexmask,
ComponentReference** cr )
{
AttrInfo *a;
a = (AttrInfo *) avl_find( bdb->bi_attrs, desc, ainfo_type_cmp );
if ( a ) {
*indexmask = a->ai_indexmask;
*cr = a->ai_cr;
} else {
*indexmask = NULL;
*cr = NULL;
}
}
#endif
void

View File

@ -283,20 +283,21 @@ static int index_at_values(
if( rc ) return rc;
}
#ifdef LDAP_COMP_MATCH
/* component indexing */
bdb_attr_comp_ref ( op->o_bd->be_private, type->sat_ad, &cr_list );
if ( cr_list ) {
for( cr = cr_list ; cr ; cr = cr->cr_next ) {
rc = indexer( op, txn, cr->cr_ad, &type->sat_cname,
cr->cr_nvals, id, opid,
cr->cr_indexmask );
}
}
#endif
/* If this type has no AD, we've never used it before */
if( type->sat_ad ) {
#ifdef LDAP_COMP_MATCH
/* component indexing */
bdb_attr_mask_cr( op->o_bd->be_private, type->sat_ad, &mask, &cr_list );
if ( cr_list ) {
for( cr = cr_list ; cr ; cr = cr->cr_next ) {
rc = indexer( op, txn, cr->cr_ad, &type->sat_cname,
cr->cr_nvals, id, opid,
cr->cr_indexmask );
}
}
#else
bdb_attr_mask( op->o_bd->be_private, type->sat_ad, &mask );
#endif
ad = type->sat_ad;
}

View File

@ -36,9 +36,14 @@ LDAP_BEGIN_DECL
#ifdef LDAP_COMP_MATCH
#define bdb_attr_comp_ref BDB_SYMBOL(attr_comp_ref)
#define bdb_attr_mask_cr BDB_SYMBOL(attr_mask_cr)
void bdb_attr_comp_ref( struct bdb_info *bdb,
AttributeDescription *desc,
ComponentReference **cr );
void bdb_attr_mask_cr( struct bdb_info *bdb,
AttributeDescription *desc,
slap_mask_t *indexmask,
ComponentReference **cr );
#endif
void bdb_attr_mask( struct bdb_info *bdb,