From 84193320ad8bb1d1567ea5c573c966118469646a Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Fri, 7 Mar 2014 14:44:40 -0800
Subject: [PATCH 175/225] Ticket #47737 - Under heavy stress, failure of
turning a tombstone into glue makes the server hung
Description: Turning a tombstone entry to a glue entry is done in a
while loop (create_glue_entry:urp_glue.c) Unless the transformation
is successful (or LDAP_NO_SUCH_OBJECT), it cannot exit from the loop.
But under a stress, there could be a tombstone and a conflict entry
coexist, and do_create_glue_entry keeps returning LDAP_ALREADY_EXISTS.
In such a case, we need to give up creating a glue.
https://fedorahosted.org/389/ticket/47737
Reviewed by rmeggins@redhat.com (Thank you, Rich!)
(cherry picked from commit a84dab5923de59cfda9bd4e78813d0c22bab35ae)
(cherry picked from commit 97fa6d25159bcdbc6701c4696d675683bed34761)
(cherry picked from commit b92eb1ad96039df4bea35f6e318912adf0d63014)
(cherry picked from commit 2786adb5d6c6257762bf28ceb8decd229bec1676)
---
ldap/servers/plugins/replication/urp_glue.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/ldap/servers/plugins/replication/urp_glue.c b/ldap/servers/plugins/replication/urp_glue.c
index 369363d..6eeb826 100644
--- a/ldap/servers/plugins/replication/urp_glue.c
+++ b/ldap/servers/plugins/replication/urp_glue.c
@@ -169,7 +169,6 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha
sdn = slapi_sdn_new_dn_byval(slapi_sdn_get_ndn(superiordn));
slapi_sdn_add_rdn(sdn,rdn);
-
/* must take care of multi-valued rdn: split rdn into different lines introducing
* '\n' between each type/value pair.
*/
@@ -187,8 +186,7 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha
rdnstr = slapi_ch_realloc(rdnstr, alloc_len);
rdnpair = &rdnstr[rdnstr_len];
}
- slapi_ldif_put_type_and_value_with_options(&rdnpair, rdntype,
- rdnval, rdnval_len, LDIF_OPT_NOWRAP);
+ slapi_ldif_put_type_and_value_with_options(&rdnpair, rdntype, rdnval, rdnval_len, LDIF_OPT_NOWRAP);
*rdnpair = '\0';
}
estr= slapi_ch_smprintf(glue_entry, slapi_sdn_get_ndn(sdn), rdnstr, uniqueid,
@@ -247,6 +245,12 @@ create_glue_entry ( Slapi_PBlock *pb, char *sessionid, Slapi_DN *dn, const char
sessionid, dnstr, uniqueid);
done= 1;
break;
+ case LDAP_ALREADY_EXISTS:
+ slapi_log_error ( SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Skipped creating glue entry %s uniqueid=%s reason Entry Already Exists\n",
+ sessionid, dnstr, uniqueid);
+ done= 1;
+ break;
case LDAP_NO_SUCH_OBJECT:
/* The parent is missing */
{
--
1.8.1.4