andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 30144a9dabfe221cdded349078eaedf91cb53e88 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Sat, 14 Dec 2013 07:38:12 -0500
Subject: [PATCH 77/78] Ticket 47627 - Fix replication logging

We printed the same CSN for the missing CSN and the supplier min CSN because
we reused the same CSN pointer.

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

Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 20cccf58108099cead2412a979e70e4f5972b806)
(cherry picked from commit ae3daa16783bab18f202a71b81177f4407dccdcd)
---
 ldap/servers/plugins/replication/cl5_api.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 064a628..abcc39a 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -5081,6 +5081,7 @@ static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consum
     int i;
     CSN **csns = NULL;
     CSN *startCSN = NULL;
+    CSN *minCSN = NULL;
     char csnStr [CSN_STRSIZE];
     int rc = CL5_SUCCESS;
     Object *supplierRuvObj = NULL;
@@ -5170,20 +5171,24 @@ static int _cl5PositionCursorForReplay (ReplicaId consumerRID, const RUV *consum
 		*/
         if ((rc == DB_NOTFOUND) && !ruv_has_csns(file->purgeRUV))
         {
+            char mincsnStr[CSN_STRSIZE];
+
             /* use the supplier min csn for the buffer start csn - we know
                this csn is in our changelog */
-            if ((RUV_SUCCESS == ruv_get_min_csn_ext(supplierRuv, &startCSN, 1 /* ignore cleaned rids */)) &&
-                startCSN)
+            if ((RUV_SUCCESS == ruv_get_min_csn_ext(supplierRuv, &minCSN, 1 /* ignore cleaned rids */)) &&
+                minCSN)
             { /* must now free startCSN */
                 if (slapi_is_loglevel_set(SLAPI_LOG_REPL)) {
-                    csn_as_string(startCSN, PR_FALSE, csnStr); 
+                    csn_as_string(startCSN, PR_FALSE, csnStr);
+                    csn_as_string(minCSN, PR_FALSE, mincsnStr);
                     slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
                                     "%s: CSN %s not found and no purging, probably a reinit\n",
                                     agmt_name, csnStr);
                     slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, 
                                     "%s: Will try to use supplier min CSN %s to load changelog\n",
-                                    agmt_name, csnStr);
+                                    agmt_name, mincsnStr);
                 }
+                startCSN = minCSN;
                 rc = clcache_load_buffer (clcache, startCSN, DB_SET);
             }
             else
-- 
1.8.1.4