ldap/servers/slapd/entry.c | 2 +-
ldap/servers/slapd/valueset.c | 10 ++--------
2 files changed, 3 insertions(+), 9 deletions(-)
New commits:
commit 136fa64f95263ffcaca5e855b771b5d377e3de52
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Apr 16 15:04:36 2014 -0700
Ticket #346 - Slow ldapmodify operation time for large quantities of multi-valued
attribute values
Description: slapi_entry_add_value is used to add values for sorting,
which did not pass the attribute syntax info and the fallback compare
algorithm was used. It sometimes different from the attribute syntax
based sorting and failed to find out an attribute. This patch passes
an attribute syntax info for sorting.
Plus, featuring slapi_berval_cmp for the fallback compare algorithm.
It is closer to the syntax based sorting.
https://fedorahosted.org/389/ticket/346
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 72ece66..adf7860 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2818,7 +2818,7 @@ slapi_entry_add_value (Slapi_Entry *e, const char *type, const
Slapi_Value *valu
Slapi_Attr **a= NULL;
attrlist_find_or_create(&e->e_attrs, type, &a);
if(value != (Slapi_Value *) NULL) {
- slapi_valueset_add_value ( &(*a)->a_present_values, value);
+ slapi_valueset_add_attr_value_ext(*a, &(*a)->a_present_values,
(Slapi_Value *)value, 0);
}
return 0;
}
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 0740c38..1378bd1 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -926,16 +926,10 @@ valueset_value_syntax_cmp( const Slapi_Attr *a, const Slapi_Value
*v1, const Sla
"slapi_attr_values2keys_sv failed for type %s\n",
a->a_type, 0, 0 );
} else {
- struct berval *bv1, *bv2;
+ const struct berval *bv1, *bv2;
bv1 = &keyvals[0]->bv;
bv2 = &keyvals[1]->bv;
- if ( bv1->bv_len < bv2->bv_len ) {
- rc = -1;
- } else if ( bv1->bv_len > bv2->bv_len ) {
- rc = 1;
- } else {
- rc = memcmp( bv1->bv_val, bv2->bv_val, bv1->bv_len );
- }
+ rc = slapi_berval_cmp (bv1, bv2);
}
if (keyvals != NULL)
valuearray_free( &keyvals );