ldap/servers/slapd/entry.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
New commits:
commit ca02529c797903139c56bd9b8b90e8cd5bd0c3f4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jun 13 18:22:21 2013 -0700
Ticket #569 - examine replication code to reduce amount of stored state information
Description: commit c7f6f161f4967635d6f02b029be571d88ec61961
made this change:
In case the deleted value list in an attribute is empty:
* this means the entry is deleted and has no more attributes,
* when writing the attr to disk we would loose the AD-csn.
* Add an empty value to the set of deleted values. This will
* never be seen by any client. It will never be moved to the
* present values and is only used to preserve the AD-csn.
The AD-csn size was not counted for the buffer size to allocate.
This patch adds the size.
https://fedorahosted.org/389/ticket/569
Reviewed by Nathan (Thanks!!)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index ea86fcc..f730ae0 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -1559,7 +1559,17 @@ entry2str_internal_size_attrlist( const Slapi_Attr *attrlist, int
entry2str_ctrl
/* ";adcsn-" + a->a_deletioncsn */
if ( a->a_deletioncsn )
{
- elen+= 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
+ elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
+ }
+ if ( valueset_isempty(&a->a_deleted_values)) {
+ /* this means the entry is deleted and has no more attributes,
+ * when writing the attr to disk we would loose the AD-csn.
+ * Add an empty value to the set of deleted values. This will
+ * never be seen by any client. It will never be moved to the
+ * present values and is only used to preserve the AD-csn
+ * We need to add the size for that.
+ */
+ elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
}
}
}
@@ -1731,7 +1741,7 @@ entry2str_internal_put_attrlist( const Slapi_Attr *attrlist, int
attr_state, int
* present values and is only used to preserve the AD-csn
*/
valueset_add_string ((Slapi_ValueSet *)&a->a_deleted_values, "",
CSN_TYPE_VALUE_DELETED, a->a_deletioncsn);
- }
+ }
entry2str_internal_put_valueset(a->a_type, a->a_deletioncsn,
CSN_TYPE_ATTRIBUTE_DELETED, attr_state, &a->a_deleted_values, VALUE_DELETED, ecur,
typebuf, typebuf_len, entry2str_ctrl);
}