From 708ca68d8feb9814643bb09de29fee5614c06b7c Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Fri, 7 Feb 2014 16:02:37 -0700 Subject: [PATCH] Ticket #47692 single valued attribute replicated ADD does not work https://fedorahosted.org/389/ticket/47692 Reviewed by: ??? 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 --- ldap/servers/slapd/entrywsi.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c index f4f6481..7a25489 100644 --- a/ldap/servers/slapd/entrywsi.c +++ b/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 */ -- 1.7.1