浏览代码

Ticket #47692 single valued attribute replicated ADD does not work

https://fedorahosted.org/389/ticket/47692
Reviewed by: nhosoi,lkrispenz (Thanks!)
Branch: master
Fix Description: Add special corner case handling for the case where
- attr is deleted with vdcsn and adcsn CSN1
- attr vucsn is NULL
- incoming mod/add has CSN2 where CSN2 > CSN1
in this case, just keep the new mod/add value as the present value.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 11 年之前
父节点
当前提交
59941ea23b
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      ldap/servers/slapd/entrywsi.c

+ 28 - 0
ldap/servers/slapd/entrywsi.c

@@ -1378,6 +1378,34 @@ resolve_attribute_state_single_valued(Slapi_Entry *e, Slapi_Attr *a, int attribu
 		entry_deleted_value_to_zapped_value(a,pending_value);
 		pending_value = NULL;
 	}
+	else if (current_value && pending_value && !new_value && adcsn &&
+			 (attribute_state == ATTRIBUTE_DELETED) &&
+			 current_value_vucsn && !pending_value_vucsn && pending_value_vdcsn &&
+			 (csn_compare(current_value_vucsn, pending_value_vdcsn) > 0) &&
+			 (csn_compare(adcsn, pending_value_vdcsn) == 0))
+	{
+		/* in the case of the following:
+		 * beginning attr state is a deleted value
+		 * incoming operation is
+		 * add: newvalue
+		 * attribute_state is ATTRIBUTE_DELETED
+		 * so we have both a current_value and a pending_value
+		 * new_value is NULL
+		 * current_value_vucsn is CSN1
+		 * pending_value_vucsn is NULL
+		 * pending_value_vdcsn is CSN2
+		 * adcsn is CSN2 == pending_value_vdcsn
+		 * CSN1 > CSN2
+		 * since the pending_value is deleted, and the current_value has
+		 * a greater CSN, we should keep the current_value and zap
+		 * the pending_value
+		 */
+		/* just remove the deleted value */
+		entry_deleted_value_to_zapped_value(a,pending_value);
+		pending_value = NULL;
+		attr_set_deletion_csn(a,NULL);
+		return; /* we are done - we are keeping the present value */
+	}
 	else if(new_value==NULL)
 	{
 		/* check if the pending value should become the current value */