Browse Source

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 [email protected] (Thank you, Rich!)
Noriko Hosoi 11 years ago
parent
commit
a84dab5923
1 changed files with 7 additions and 3 deletions
  1. 7 3
      ldap/servers/plugins/replication/urp_glue.c

+ 7 - 3
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 */
 					{