Commit fc337704 authored by Howard Chu's avatar Howard Chu
Browse files

Fix redundant index lookups from component matching

parent c6b6d2a5
......@@ -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
......
......@@ -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;
}
......
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment