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

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