1
0
Эх сурвалжийг харах

Ticket #47912 - Proper handling of "No original_tombstone for changenumber" errors

Bug Description: As analyzed by Ludwig Krispen in
  https://fedorahosted.org/389/ticket/47912#comment:1,
an error message "No original_tombstone for ..." is always logged
if original_tombstone does not exist.  It should be just for the
case create_tombstone_entry.

Fix Description: This patch place the original_tombstone handling
in "if (create_tombstone_entry)" clause.

https://fedorahosted.org/389/ticket/47912

Reviewed by [email protected] (Thank you, Ludwig!!)
Noriko Hosoi 11 жил өмнө
parent
commit
36381c1207

+ 24 - 24
ldap/servers/slapd/back-ldbm/ldbm_delete.c

@@ -225,33 +225,33 @@ ldbm_back_delete( Slapi_PBlock *pb )
 			free_delete_existing_entry = 1; /* must free the dup */
 			if (create_tombstone_entry) {
 				slapi_sdn_set_ndn_byval(&nscpEntrySDN, slapi_sdn_get_ndn(slapi_entry_get_sdn(e->ep_entry)));
-			}
 
-			/* reset tombstone entry */
-			if (original_tombstone) {
-				/* must duplicate tombstone before returning it to cache,
-				 * which could free the entry. */
-				if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
-					ldap_result_code= LDAP_OPERATIONS_ERROR;
-					goto error_return;
-				}
-				if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
-					CACHE_REMOVE(&inst->inst_cache, tombstone);
-				}
-				CACHE_RETURN(&inst->inst_cache, &tombstone);
-				if (tombstone) {
+				/* reset tombstone entry */
+				if (original_tombstone) {
+					/* must duplicate tombstone before returning it to cache,
+					 * which could free the entry. */
+					if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
+						ldap_result_code= LDAP_OPERATIONS_ERROR;
+						goto error_return;
+					}
+					if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
+						CACHE_REMOVE(&inst->inst_cache, tombstone);
+					}
+					CACHE_RETURN(&inst->inst_cache, &tombstone);
+					if (tombstone) {
+						slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete", 
+						                "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
+						                conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
+						                tombstone->ep_refcnt, tombstone->ep_state);
+					}
+					tombstone = original_tombstone;
+					original_tombstone = tmptombstone;
+					tmptombstone = NULL;
+				} else {
 					slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete", 
-					                "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
-					                conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
-					                tombstone->ep_refcnt, tombstone->ep_state);
+					                "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
+					                conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
 				}
-				tombstone = original_tombstone;
-				original_tombstone = tmptombstone;
-				tmptombstone = NULL;
-			} else {
-				slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete", 
-				                "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
-				                conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
 			}
 			if (ruv_c_init) {
 				/* reset the ruv txn stuff */