andykimpe / rpms / 389-ds-base

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