andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 8 months ago
Clone

Blame 0220-Ticket-47809-find-a-way-to-remove-replication-plugin.patch

dc8c34
From 5c1be98f1c032fee3b82495d1d56a4c1495d08f8 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Wed, 11 Jun 2014 10:15:25 -0700
dc8c34
Subject: [PATCH 220/225] Ticket #47809 - find a way to remove replication
dc8c34
 plugin errors messages "changelog iteration code returned a dummy entry with
dc8c34
 csn %s, skipping ..."
dc8c34
dc8c34
Description:
dc8c34
1) Can't locate CSN %s in the changelog (DB rc=%d).
dc8c34
   Print the message once per one missing CSN.
dc8c34
2) changelog iteration code returned a dummy entry with csn %s, skipping ...
dc8c34
   Downgrade the log level to replication log level (SLAPI_LOG_REPL).
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47809
dc8c34
dc8c34
Reviewed by rmeggins@redhat.com (Thanks, Rich!)
dc8c34
(cherry picked from commit 6a1b10db6d41be9e3aadf6f7cbb18aaf4d00e87b)
dc8c34
(cherry picked from commit ddca54d9d8e8d7f3f8b1cd431cbf6381361f323e)
dc8c34
(cherry picked from commit e50653fffab5036e2027f99f9d2b2bf70f498e2e)
dc8c34
(cherry picked from commit b4248f87124e2e3a62eb82a9b196c01b6aa41892)
dc8c34
---
dc8c34
 ldap/servers/plugins/replication/cl5_clcache.c        | 11 ++++++++---
dc8c34
 ldap/servers/plugins/replication/repl5_inc_protocol.c | 16 ++++++++--------
dc8c34
 2 files changed, 16 insertions(+), 11 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c
dc8c34
index d86620f..60f288e 100644
dc8c34
--- a/ldap/servers/plugins/replication/cl5_clcache.c
dc8c34
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
dc8c34
@@ -111,6 +111,7 @@ struct clc_buffer {
dc8c34
 	DBT			 buf_data;			/* data retrived from db */
dc8c34
 	void		*buf_record_ptr;	/* ptr to the current record in data */
dc8c34
 	CSN			*buf_missing_csn;	/* used to detect persistent missing of CSN */
dc8c34
+	CSN			*buf_prev_missing_csn;	/* used to surpress the repeated messages */
dc8c34
 
dc8c34
 	/* fields for control the CSN sequence sent to the consumer */
dc8c34
 	struct csn_seq_ctrl_block **buf_cscbs;
dc8c34
@@ -376,9 +377,12 @@ clcache_load_buffer ( CLC_Buffer *buf, CSN *anchorcsn, int flag )
dc8c34
 		else if ( anchorcsn ) {
dc8c34
 			/* Report error only when the missing is persistent */
dc8c34
 			if ( buf->buf_missing_csn && csn_compare (buf->buf_missing_csn, anchorcsn) == 0 ) {
dc8c34
-				slapi_log_error ( SLAPI_LOG_FATAL, buf->buf_agmt_name,
dc8c34
-					"Can't locate CSN %s in the changelog (DB rc=%d). The consumer may need to be reinitialized.\n",
dc8c34
-					(char*)buf->buf_key.data, rc );
dc8c34
+				if (!buf->buf_prev_missing_csn || csn_compare (buf->buf_prev_missing_csn, anchorcsn)) {
dc8c34
+					slapi_log_error ( SLAPI_LOG_FATAL, buf->buf_agmt_name,
dc8c34
+						"Can't locate CSN %s in the changelog (DB rc=%d). If replication stops, the consumer may need to be reinitialized.\n",
dc8c34
+						(char*)buf->buf_key.data, rc );
dc8c34
+					csn_dup_or_init_by_csn (&buf->buf_prev_missing_csn, anchorcsn);
dc8c34
+				}
dc8c34
 			}
dc8c34
 			else {
dc8c34
 				csn_dup_or_init_by_csn (&buf->buf_missing_csn, anchorcsn);
dc8c34
@@ -915,6 +919,7 @@ clcache_delete_buffer ( CLC_Buffer **buf )
dc8c34
 		slapi_ch_free (&( (*buf)->buf_data.data ));
dc8c34
 		csn_free (&( (*buf)->buf_current_csn ));
dc8c34
 		csn_free (&( (*buf)->buf_missing_csn ));
dc8c34
+		csn_free (&( (*buf)->buf_prev_missing_csn ));
dc8c34
 		slapi_ch_free ( (void **) buf );
dc8c34
 	}
dc8c34
 }
dc8c34
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
dc8c34
index 6a2179a..5d3e143 100644
dc8c34
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
dc8c34
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
dc8c34
@@ -1694,15 +1694,15 @@ send_updates(Private_Repl_Protocol *prp, RUV *remote_update_vector, PRUint32 *nu
dc8c34
 			switch (rc)
dc8c34
 			{
dc8c34
 			case CL5_SUCCESS:
dc8c34
-                /* check that we don't return dummy entries */
dc8c34
-                if (is_dummy_operation (entry.op))
dc8c34
-                {
dc8c34
-                    slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, 
dc8c34
-                        "%s: changelog iteration code returned a dummy entry with csn %s, "
dc8c34
-                        "skipping ...\n",
dc8c34
+				/* check that we don't return dummy entries */
dc8c34
+				if (is_dummy_operation (entry.op))
dc8c34
+				{
dc8c34
+					slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, 
dc8c34
+						"%s: changelog iteration code returned a dummy entry with csn %s, "
dc8c34
+						"skipping ...\n",
dc8c34
 						agmt_get_long_name(prp->agmt), csn_as_string(entry.op->csn, PR_FALSE, csn_str));
dc8c34
-				    continue;
dc8c34
-                }
dc8c34
+					continue;
dc8c34
+				}
dc8c34
 				replay_crc = replay_update(prp, entry.op, &message_id);
dc8c34
 				if (message_id) 
dc8c34
 				{
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34