andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From a9af6ebde8c9c16bdb46fb398e83a3273701e435 Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Fri, 7 Feb 2014 16:02:37 -0700
dc8c34
Subject: [PATCH 164/225] Ticket #47692 single valued attribute replicated ADD
dc8c34
 does not work
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47692
dc8c34
Reviewed by: nhosoi,lkrispenz (Thanks!)
dc8c34
Branch: 389-ds-base-1.2.11
dc8c34
Fix Description: Add special corner case handling for the case where
dc8c34
- attr is deleted with vdcsn and adcsn CSN1
dc8c34
- attr vucsn is NULL
dc8c34
- incoming mod/add has CSN2 where CSN2 > CSN1
dc8c34
in this case, just keep the new mod/add value as the present value.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: no
dc8c34
(cherry picked from commit 59941ea23b6f288617ba1e6ce58238fa59266c9f)
dc8c34
(cherry picked from commit 01a112121e80505021d0a18afa899b5c46180797)
dc8c34
(cherry picked from commit a4a46424d59a189552c1d17eed1d52218f3a95b8)
dc8c34
(cherry picked from commit dad08c10826896dc4e8772ec400d60e3eb0ebbb6)
dc8c34
(cherry picked from commit 86fb13764f4dda2efc8b869377b2e90314466362)
dc8c34
---
dc8c34
 ldap/servers/slapd/entrywsi.c | 28 ++++++++++++++++++++++++++++
dc8c34
 1 file changed, 28 insertions(+)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
dc8c34
index 6c37f45..cca615d 100644
dc8c34
--- a/ldap/servers/slapd/entrywsi.c
dc8c34
+++ b/ldap/servers/slapd/entrywsi.c
dc8c34
@@ -1148,6 +1148,34 @@ resolve_attribute_state_single_valued(Slapi_Entry *e, Slapi_Attr *a, int attribu
dc8c34
 		entry_deleted_value_to_zapped_value(a,pending_value);
dc8c34
 		pending_value = NULL;
dc8c34
 	}
dc8c34
+	else if (current_value && pending_value && !new_value && adcsn &&
dc8c34
+			 (attribute_state == ATTRIBUTE_DELETED) &&
dc8c34
+			 current_value_vucsn && !pending_value_vucsn && pending_value_vdcsn &&
dc8c34
+			 (csn_compare(current_value_vucsn, pending_value_vdcsn) > 0) &&
dc8c34
+			 (csn_compare(adcsn, pending_value_vdcsn) == 0))
dc8c34
+	{
dc8c34
+		/* in the case of the following:
dc8c34
+		 * beginning attr state is a deleted value
dc8c34
+		 * incoming operation is
dc8c34
+		 * add: newvalue
dc8c34
+		 * attribute_state is ATTRIBUTE_DELETED
dc8c34
+		 * so we have both a current_value and a pending_value
dc8c34
+		 * new_value is NULL
dc8c34
+		 * current_value_vucsn is CSN1
dc8c34
+		 * pending_value_vucsn is NULL
dc8c34
+		 * pending_value_vdcsn is CSN2
dc8c34
+		 * adcsn is CSN2 == pending_value_vdcsn
dc8c34
+		 * CSN1 > CSN2
dc8c34
+		 * since the pending_value is deleted, and the current_value has
dc8c34
+		 * a greater CSN, we should keep the current_value and zap
dc8c34
+		 * the pending_value
dc8c34
+		 */
dc8c34
+		/* just remove the deleted value */
dc8c34
+		entry_deleted_value_to_zapped_value(a,pending_value);
dc8c34
+		pending_value = NULL;
dc8c34
+		attr_set_deletion_csn(a,NULL);
dc8c34
+		return; /* we are done - we are keeping the present value */
dc8c34
+	}
dc8c34
 	else if(new_value==NULL)
dc8c34
 	{
dc8c34
 		/* check if the pending value should become the current value */
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34