Blame SOURCES/0026-Ticket-49439-cleanallruv-is-not-logging-information.patch

081b2d
From 403c5b61efb5aca3cbea31170d13dfba190ef355 Mon Sep 17 00:00:00 2001
081b2d
From: Mark Reynolds <mreynolds@redhat.com>
081b2d
Date: Thu, 2 Nov 2017 12:55:11 -0400
081b2d
Subject: [PATCH] Ticket 49439 - cleanallruv is not logging information
081b2d
081b2d
Bug Description:  During the logging refector effro from ticket 48978
081b2d
                  a mistake was made and cleanruv_log() was using
081b2d
                  LOG_NOTICE (which is not a true log level), it was
081b2d
                  supposed to be SLAPI_LOG_NOTICE.
081b2d
081b2d
                  We also use DEBUG defines to contorl the logging for
081b2d
                  debug builds
081b2d
081b2d
Fix Description:  Remove the LDAP_DEBUG defines in cleanruv_log, and set
081b2d
                  the correct logging severity level.
081b2d
081b2d
https://pagure.io/389-ds-base/issue/49439
081b2d
081b2d
Reviewed by: firstyear(Thanks!)
081b2d
081b2d
(cherry picked from commit e1f866a5e3ccce8e061e361c0e3dd11175a8acf2)
081b2d
---
081b2d
 .../plugins/replication/repl5_replica_config.c     | 30 ++++++++++------------
081b2d
 1 file changed, 14 insertions(+), 16 deletions(-)
081b2d
081b2d
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
081b2d
index 9c3c75458..9c8d6adbb 100644
081b2d
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
081b2d
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
081b2d
@@ -1783,7 +1783,7 @@ replica_cleanallruv_thread(void *arg)
081b2d
         /*
081b2d
          *  need to sleep between passes
081b2d
          */
081b2d
-        cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Not all replicas have received the "
081b2d
+        cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Not all replicas have received the "
081b2d
                                                                         "cleanallruv extended op, retrying in %d seconds",
081b2d
                      interval);
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
@@ -1825,7 +1825,7 @@ replica_cleanallruv_thread(void *arg)
081b2d
                 found_dirty_rid = 0;
081b2d
             } else {
081b2d
                 found_dirty_rid = 1;
081b2d
-                cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Replica is not cleaned yet (%s)",
081b2d
+                cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Replica is not cleaned yet (%s)",
081b2d
                              agmt_get_long_name(agmt));
081b2d
                 break;
081b2d
             }
081b2d
@@ -1843,7 +1843,7 @@ replica_cleanallruv_thread(void *arg)
081b2d
          * Need to sleep between passes unless we are shutting down
081b2d
          */
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
-            cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Replicas have not been cleaned yet, "
081b2d
+            cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Replicas have not been cleaned yet, "
081b2d
                                                                             "retrying in %d seconds",
081b2d
                          interval);
081b2d
             PR_Lock(notify_lock);
081b2d
@@ -1883,10 +1883,10 @@ done:
081b2d
          *  Shutdown or abort
081b2d
          */
081b2d
         if (!is_task_aborted(data->rid) || slapi_is_shutting_down()) {
081b2d
-            cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+            cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                          "Server shutting down.  Process will resume at server startup");
081b2d
         } else {
081b2d
-            cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Task aborted for rid(%d).", data->rid);
081b2d
+            cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Task aborted for rid(%d).", data->rid);
081b2d
             delete_cleaned_rid_config(data);
081b2d
             remove_cleaned_rid(data->rid);
081b2d
         }
081b2d
@@ -2053,7 +2053,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data)
081b2d
             break;
081b2d
         }
081b2d
 
081b2d
-        cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+        cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                      "Not all replicas finished cleaning, retrying in %d seconds",
081b2d
                      interval);
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
@@ -2163,7 +2163,7 @@ check_replicas_are_done_aborting(cleanruv_data *data)
081b2d
         if (not_all_aborted == 0) {
081b2d
             break;
081b2d
         }
081b2d
-        cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+        cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                      "Not all replicas finished aborting, retrying in %d seconds", interval);
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
             PR_Lock(notify_lock);
081b2d
@@ -2210,7 +2210,7 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
081b2d
                 not_all_caughtup = 0;
081b2d
             } else {
081b2d
                 not_all_caughtup = 1;
081b2d
-                cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+                cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                              "Replica not caught up (%s)", agmt_get_long_name(agmt));
081b2d
                 break;
081b2d
             }
081b2d
@@ -2220,7 +2220,7 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
081b2d
         if (not_all_caughtup == 0 || is_task_aborted(data->rid)) {
081b2d
             break;
081b2d
         }
081b2d
-        cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+        cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                      "Not all replicas caught up, retrying in %d seconds", interval);
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
             PR_Lock(notify_lock);
081b2d
@@ -2270,7 +2270,7 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
081b2d
                 not_all_alive = 0;
081b2d
             } else {
081b2d
                 not_all_alive = 1;
081b2d
-                cleanruv_log(task, rid, CLEANALLRUV_ID, LOG_NOTICE, "Replica not online (%s)",
081b2d
+                cleanruv_log(task, rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Replica not online (%s)",
081b2d
                              agmt_get_long_name(agmt));
081b2d
                 break;
081b2d
             }
081b2d
@@ -2280,7 +2280,7 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
081b2d
         if (not_all_alive == 0 || is_task_aborted(rid)) {
081b2d
             break;
081b2d
         }
081b2d
-        cleanruv_log(task, rid, CLEANALLRUV_ID, LOG_NOTICE, "Not all replicas online, retrying in %d seconds...",
081b2d
+        cleanruv_log(task, rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Not all replicas online, retrying in %d seconds...",
081b2d
                      interval);
081b2d
 
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
@@ -3063,7 +3063,7 @@ replica_abort_task_thread(void *arg)
081b2d
          *  Need to sleep between passes. unless we are shutting down
081b2d
          */
081b2d
         if (!slapi_is_shutting_down()) {
081b2d
-            cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, LOG_NOTICE, "Retrying in %d seconds", interval);
081b2d
+            cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Retrying in %d seconds", interval);
081b2d
             PR_Lock(notify_lock);
081b2d
             PR_WaitCondVar(notify_cvar, PR_SecondsToInterval(interval));
081b2d
             PR_Unlock(notify_lock);
081b2d
@@ -3184,7 +3184,7 @@ replica_cleanallruv_send_extop(Repl_Agmt *ra, cleanruv_data *clean_data, int che
081b2d
                     /* extop was accepted */
081b2d
                     rc = 0;
081b2d
                 } else {
081b2d
-                    cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+                    cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                                  "Replica %s does not support the CLEANALLRUV task.  "
081b2d
                                  "Sending replica CLEANRUV task...",
081b2d
                                  slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
081b2d
@@ -3352,7 +3352,7 @@ replica_cleanallruv_check_maxcsn(Repl_Agmt *agmt, char *basedn, char *rid_text,
081b2d
                     csn_init_by_string(repl_max, remote_maxcsn);
081b2d
                     if (csn_compare(repl_max, max) < 0) {
081b2d
                         /* we are not caught up yet, free, and return */
081b2d
-                        cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID, LOG_NOTICE,
081b2d
+                        cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
081b2d
                                      "Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
081b2d
                                      remote_maxcsn, maxcsn);
081b2d
                         rc = -1;
081b2d
@@ -3525,7 +3525,6 @@ stop_ruv_cleaning()
081b2d
 void
081b2d
 cleanruv_log(Slapi_Task *task, int rid, char *task_type, int sev_level, char *fmt, ...)
081b2d
 {
081b2d
-#ifdef LDAP_DEBUG
081b2d
     va_list ap1;
081b2d
     va_list ap2;
081b2d
     va_list ap3;
081b2d
@@ -3550,7 +3549,6 @@ cleanruv_log(Slapi_Task *task, int rid, char *task_type, int sev_level, char *fm
081b2d
     va_end(ap2);
081b2d
     va_end(ap3);
081b2d
     va_end(ap4);
081b2d
-#endif
081b2d
 }
081b2d
 
081b2d
 char *
081b2d
-- 
081b2d
2.13.6
081b2d