andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From e9faf2091c545c8967db41961ef3d14f449e6c8a Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz <lkrispen@redhat.com>
Date: Thu, 18 Jun 2015 15:22:54 +0200
Subject: [PATCH 85/86] Ticket 48195 - Slow replication when deleting large
 quantities of multi-valued attributes

https://fedorahosted.org/389/ticket/48195

In update resoultion for entry deletion, there is still use of valuearray_find() to find an existingvalue to update its csn.
with the fix for ticket #346 there exists slapi_valueset_find() which uses the possibility to do a binary search on the
values.
Fix: do not use valuearray_find

Review: Rich, Thanks
(cherry picked from commit 09ab8c799fc3d87db7a5b3aa07eccf9b41ea43d5)
(cherry picked from commit a980b795ac03200fd01a2d05ce568691681d50ef)
(cherry picked from commit 229ee77872d34acd53707e92c4d0861fa80b3d1f)
---
 ldap/servers/slapd/valueset.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 1378bd1..9d77b0c 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -1440,12 +1440,12 @@ valueset_update_csn_for_valuearray_ext(Slapi_ValueSet *vs, const Slapi_Attr *a,
 		int del_index = -1, del_count = 0;
 		for (i=0;valuestoupdate[i]!=NULL;++i)
 		{
-			int index= valuearray_find(a, vs->va, valuestoupdate[i]);
-			if(index!=-1)
+			Slapi_Value *v = slapi_valueset_find(a, vs, valuestoupdate[i]);
+			if(v)
 			{
-				value_update_csn(vs->va[index],t,csn);
+				value_update_csn(v,t,csn);
 				if (csnref_updated)
-					valuestoupdate[i]->v_csnset = (CSNSet *)value_get_csnset(vs->va[index]);
+					valuestoupdate[i]->v_csnset = (CSNSet *)value_get_csnset(v);
 				valuearrayfast_add_value_passin(&vaf_valuesupdated,valuestoupdate[i]);
 				valuestoupdate[i]= NULL;
 				del_count++;
-- 
1.9.3