mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-31 14:50:34 +08:00
ITS#9753 back-mdb: Fix index updating for replace ops
This commit is contained in:
parent
f476a06391
commit
739081f217
@ -27,11 +27,14 @@ static struct berval scbva[] = {
|
||||
BER_BVNULL
|
||||
};
|
||||
|
||||
#define CHECK_ADD 1
|
||||
#define CHECK_DEL 2
|
||||
|
||||
static void
|
||||
mdb_modify_idxflags(
|
||||
Operation *op,
|
||||
AttributeDescription *desc,
|
||||
int got_delete,
|
||||
int ixcheck,
|
||||
Attribute *newattrs,
|
||||
Attribute *oldattrs )
|
||||
{
|
||||
@ -42,7 +45,7 @@ mdb_modify_idxflags(
|
||||
* but not in case of NOOP... */
|
||||
ai = mdb_index_mask( op->o_bd, desc, &ix_at );
|
||||
if ( ai ) {
|
||||
if ( got_delete ) {
|
||||
if ( ixcheck & CHECK_DEL ) {
|
||||
Attribute *ap;
|
||||
struct berval ix2;
|
||||
|
||||
@ -65,7 +68,8 @@ mdb_modify_idxflags(
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
if ( ixcheck & CHECK_ADD ) {
|
||||
Attribute *ap;
|
||||
|
||||
ap = attr_find( newattrs, desc );
|
||||
@ -91,7 +95,7 @@ int mdb_modify_internal(
|
||||
Attribute *ap, *aold, *anew;
|
||||
int glue_attr_delete = 0;
|
||||
int softop, chkpresent;
|
||||
int got_delete;
|
||||
int ixcheck;
|
||||
int a_flags;
|
||||
MDB_cursor *mvc = NULL;
|
||||
|
||||
@ -140,7 +144,7 @@ int mdb_modify_internal(
|
||||
|
||||
for ( ml = modlist; ml != NULL; ml = ml->sml_next ) {
|
||||
mod = &ml->sml_mod;
|
||||
got_delete = 0;
|
||||
ixcheck = 0;
|
||||
|
||||
aold = attr_find( e->e_attrs, mod->sm_desc );
|
||||
if (aold)
|
||||
@ -207,6 +211,7 @@ mval_fail: strncpy( textbuf, mdb_strerror( err ), textlen );
|
||||
if ( err )
|
||||
goto mval_fail;
|
||||
}
|
||||
ixcheck |= CHECK_ADD;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -237,7 +242,7 @@ do_del:
|
||||
err, *text );
|
||||
} else {
|
||||
if (softop != 2)
|
||||
got_delete = 1;
|
||||
ixcheck |= CHECK_DEL;
|
||||
/* check for big multivalued attrs */
|
||||
if (a_flags & SLAP_ATTR_BIG_MULTI) {
|
||||
Attribute a_dummy;
|
||||
@ -285,7 +290,9 @@ do_del:
|
||||
err, *text );
|
||||
} else {
|
||||
unsigned hi;
|
||||
got_delete = 1;
|
||||
ixcheck = CHECK_DEL;
|
||||
if ( mod->sm_numvals )
|
||||
ixcheck |= CHECK_ADD;
|
||||
if (a_flags & SLAP_ATTR_BIG_MULTI) {
|
||||
Attribute a_dummy;
|
||||
if (!mvc) {
|
||||
@ -331,7 +338,7 @@ do_del:
|
||||
"mdb_modify_internal: %d %s\n",
|
||||
err, *text );
|
||||
} else {
|
||||
got_delete = 1;
|
||||
ixcheck = CHECK_ADD|CHECK_DEL;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -403,7 +410,7 @@ do_del:
|
||||
/* check if modified attribute was indexed
|
||||
* but not in case of NOOP... */
|
||||
if ( !op->o_noop ) {
|
||||
mdb_modify_idxflags( op, mod->sm_desc, got_delete, e->e_attrs, save_attrs );
|
||||
mdb_modify_idxflags( op, mod->sm_desc, ixcheck, e->e_attrs, save_attrs );
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,7 +441,7 @@ do_del:
|
||||
assert( ap->a_desc == slap_schema.si_ad_structuralObjectClass );
|
||||
if ( !op->o_noop ) {
|
||||
mdb_modify_idxflags( op, slap_schema.si_ad_structuralObjectClass,
|
||||
1, e->e_attrs, save_attrs );
|
||||
CHECK_ADD|CHECK_DEL, e->e_attrs, save_attrs );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user