|
|
6f51e1 |
From 8031684255007b42df3d08b80e674aefb0ebfb2d Mon Sep 17 00:00:00 2001
|
|
|
6f51e1 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
6f51e1 |
Date: Thu, 2 Nov 2017 12:55:11 -0400
|
|
|
6f51e1 |
Subject: [PATCH] Ticket 49439 - cleanallruv is not logging information
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Bug Description: During the logging refector effro from ticket 48978
|
|
|
6f51e1 |
a mistake was made and cleanruv_log() was using
|
|
|
6f51e1 |
LOG_NOTICE (which is not a true log level), it was
|
|
|
6f51e1 |
supposed to be SLAPI_LOG_NOTICE.
|
|
|
6f51e1 |
|
|
|
6f51e1 |
We also use DEBUG defines to contorl the logging for
|
|
|
6f51e1 |
debug builds
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Fix Description: Remove the LDAP_DEBUG defines in cleanruv_log, and set
|
|
|
6f51e1 |
the correct logging severity level.
|
|
|
6f51e1 |
|
|
|
6f51e1 |
https://pagure.io/389-ds-base/issue/49439
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Reviewed by: firstyear(Thanks!)
|
|
|
6f51e1 |
|
|
|
6f51e1 |
(cherry picked from commit e1f866a5e3ccce8e061e361c0e3dd11175a8acf2)
|
|
|
6f51e1 |
---
|
|
|
6f51e1 |
.../plugins/replication/repl5_replica_config.c | 101 +++++++++++----------
|
|
|
6f51e1 |
1 file changed, 51 insertions(+), 50 deletions(-)
|
|
|
6f51e1 |
|
|
|
6f51e1 |
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
6f51e1 |
index 053103bd0..814f1cac0 100644
|
|
|
6f51e1 |
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
6f51e1 |
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
6f51e1 |
@@ -1911,12 +1911,13 @@ replica_cleanallruv_thread(void *arg)
|
|
|
6f51e1 |
/*
|
|
|
6f51e1 |
* need to sleep between passes
|
|
|
6f51e1 |
*/
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Not all replicas have received the "
|
|
|
6f51e1 |
- "cleanallruv extended op, retrying in %d seconds",interval);
|
|
|
6f51e1 |
- if(!slapi_is_shutting_down()){
|
|
|
6f51e1 |
- PR_Lock( notify_lock );
|
|
|
6f51e1 |
- PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
6f51e1 |
- PR_Unlock( notify_lock );
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Not all replicas have received the "
|
|
|
6f51e1 |
+ "cleanallruv extended op, retrying in %d seconds",
|
|
|
6f51e1 |
+ interval);
|
|
|
6f51e1 |
+ if (!slapi_is_shutting_down()) {
|
|
|
6f51e1 |
+ PR_Lock(notify_lock);
|
|
|
6f51e1 |
+ PR_WaitCondVar(notify_cvar, PR_SecondsToInterval(interval));
|
|
|
6f51e1 |
+ PR_Unlock(notify_lock);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
if(interval < 14400){ /* 4 hour max */
|
|
|
6f51e1 |
interval = interval * 2;
|
|
|
6f51e1 |
@@ -1952,8 +1953,8 @@ replica_cleanallruv_thread(void *arg)
|
|
|
6f51e1 |
found_dirty_rid = 0;
|
|
|
6f51e1 |
} else {
|
|
|
6f51e1 |
found_dirty_rid = 1;
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Replica is not cleaned yet (%s)",
|
|
|
6f51e1 |
- agmt_get_long_name(agmt));
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Replica is not cleaned yet (%s)",
|
|
|
6f51e1 |
+ agmt_get_long_name(agmt));
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
|
|
|
6f51e1 |
@@ -1969,12 +1970,13 @@ replica_cleanallruv_thread(void *arg)
|
|
|
6f51e1 |
/*
|
|
|
6f51e1 |
* Need to sleep between passes unless we are shutting down
|
|
|
6f51e1 |
*/
|
|
|
6f51e1 |
- if (!slapi_is_shutting_down()){
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Replicas have not been cleaned yet, "
|
|
|
6f51e1 |
- "retrying in %d seconds", interval);
|
|
|
6f51e1 |
- PR_Lock( notify_lock );
|
|
|
6f51e1 |
- PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
6f51e1 |
- PR_Unlock( notify_lock );
|
|
|
6f51e1 |
+ if (!slapi_is_shutting_down()) {
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Replicas have not been cleaned yet, "
|
|
|
6f51e1 |
+ "retrying in %d seconds",
|
|
|
6f51e1 |
+ interval);
|
|
|
6f51e1 |
+ PR_Lock(notify_lock);
|
|
|
6f51e1 |
+ PR_WaitCondVar(notify_cvar, PR_SecondsToInterval(interval));
|
|
|
6f51e1 |
+ PR_Unlock(notify_lock);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
|
|
|
6f51e1 |
if(interval < 14400){ /* 4 hour max */
|
|
|
6f51e1 |
@@ -2008,11 +2010,11 @@ done:
|
|
|
6f51e1 |
/*
|
|
|
6f51e1 |
* Shutdown or abort
|
|
|
6f51e1 |
*/
|
|
|
6f51e1 |
- if(!is_task_aborted(data->rid) || slapi_is_shutting_down()){
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
- "Server shutting down. Process will resume at server startup");
|
|
|
6f51e1 |
+ if (!is_task_aborted(data->rid) || slapi_is_shutting_down()) {
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
+ "Server shutting down. Process will resume at server startup");
|
|
|
6f51e1 |
} else {
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE, "Task aborted for rid(%d).",data->rid);
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Task aborted for rid(%d).", data->rid);
|
|
|
6f51e1 |
delete_cleaned_rid_config(data);
|
|
|
6f51e1 |
remove_cleaned_rid(data->rid);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
@@ -2180,7 +2182,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
"Not all replicas finished cleaning, retrying in %d seconds",
|
|
|
6f51e1 |
interval);
|
|
|
6f51e1 |
if(!slapi_is_shutting_down()){
|
|
|
6f51e1 |
@@ -2289,12 +2291,12 @@ check_replicas_are_done_aborting(cleanruv_data *data )
|
|
|
6f51e1 |
if(not_all_aborted == 0){
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
- "Not all replicas finished aborting, retrying in %d seconds",interval);
|
|
|
6f51e1 |
- if(!slapi_is_shutting_down()){
|
|
|
6f51e1 |
- PR_Lock( notify_lock );
|
|
|
6f51e1 |
- PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
6f51e1 |
- PR_Unlock( notify_lock );
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
+ "Not all replicas finished aborting, retrying in %d seconds", interval);
|
|
|
6f51e1 |
+ if (!slapi_is_shutting_down()) {
|
|
|
6f51e1 |
+ PR_Lock(notify_lock);
|
|
|
6f51e1 |
+ PR_WaitCondVar(notify_cvar, PR_SecondsToInterval(interval));
|
|
|
6f51e1 |
+ PR_Unlock(notify_lock);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
if(interval < 14400){ /* 4 hour max */
|
|
|
6f51e1 |
interval = interval * 2;
|
|
|
6f51e1 |
@@ -2336,8 +2338,8 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
|
|
|
6f51e1 |
not_all_caughtup = 0;
|
|
|
6f51e1 |
} else {
|
|
|
6f51e1 |
not_all_caughtup = 1;
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
- "Replica not caught up (%s)",agmt_get_long_name(agmt));
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
+ "Replica not caught up (%s)", agmt_get_long_name(agmt));
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
|
|
|
6f51e1 |
@@ -2346,12 +2348,12 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
|
|
|
6f51e1 |
if(not_all_caughtup == 0 || is_task_aborted(data->rid) ){
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
- "Not all replicas caught up, retrying in %d seconds",interval);
|
|
|
6f51e1 |
- if(!slapi_is_shutting_down()){
|
|
|
6f51e1 |
- PR_Lock( notify_lock );
|
|
|
6f51e1 |
- PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
6f51e1 |
- PR_Unlock( notify_lock );
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
+ "Not all replicas caught up, retrying in %d seconds", interval);
|
|
|
6f51e1 |
+ if (!slapi_is_shutting_down()) {
|
|
|
6f51e1 |
+ PR_Lock(notify_lock);
|
|
|
6f51e1 |
+ PR_WaitCondVar(notify_cvar, PR_SecondsToInterval(interval));
|
|
|
6f51e1 |
+ PR_Unlock(notify_lock);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
if(interval < 14400){ /* 4 hour max */
|
|
|
6f51e1 |
interval = interval * 2;
|
|
|
6f51e1 |
@@ -2396,8 +2398,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
|
|
|
6f51e1 |
not_all_alive = 0;
|
|
|
6f51e1 |
} else {
|
|
|
6f51e1 |
not_all_alive = 1;
|
|
|
6f51e1 |
- cleanruv_log(task, rid, CLEANALLRUV_ID, LOG_NOTICE, "Replica not online (%s)",
|
|
|
6f51e1 |
- agmt_get_long_name(agmt));
|
|
|
6f51e1 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Replica not online (%s)",
|
|
|
6f51e1 |
+ agmt_get_long_name(agmt));
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
|
|
|
6f51e1 |
@@ -2406,8 +2408,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
|
|
|
6f51e1 |
if(not_all_alive == 0 || is_task_aborted(rid)){
|
|
|
6f51e1 |
break;
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
- cleanruv_log(task, rid, CLEANALLRUV_ID, LOG_NOTICE, "Not all replicas online, retrying in %d seconds...",
|
|
|
6f51e1 |
- interval);
|
|
|
6f51e1 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Not all replicas online, retrying in %d seconds...",
|
|
|
6f51e1 |
+ interval);
|
|
|
6f51e1 |
|
|
|
6f51e1 |
if(!slapi_is_shutting_down()){
|
|
|
6f51e1 |
PR_Lock( notify_lock );
|
|
|
6f51e1 |
@@ -3174,11 +3176,11 @@ replica_abort_task_thread(void *arg)
|
|
|
6f51e1 |
/*
|
|
|
6f51e1 |
* Need to sleep between passes. unless we are shutting down
|
|
|
6f51e1 |
*/
|
|
|
6f51e1 |
- if (!slapi_is_shutting_down()){
|
|
|
6f51e1 |
- cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, LOG_NOTICE, "Retrying in %d seconds",interval);
|
|
|
6f51e1 |
- PR_Lock( notify_lock );
|
|
|
6f51e1 |
- PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
6f51e1 |
- PR_Unlock( notify_lock );
|
|
|
6f51e1 |
+ if (!slapi_is_shutting_down()) {
|
|
|
6f51e1 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, SLAPI_LOG_NOTICE, "Retrying in %d seconds", interval);
|
|
|
6f51e1 |
+ PR_Lock(notify_lock);
|
|
|
6f51e1 |
+ PR_WaitCondVar(notify_cvar, PR_SecondsToInterval(interval));
|
|
|
6f51e1 |
+ PR_Unlock(notify_lock);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
|
|
|
6f51e1 |
if(interval < 14400){ /* 4 hour max */
|
|
|
6f51e1 |
@@ -3296,9 +3298,10 @@ replica_cleanallruv_send_extop(Repl_Agmt *ra, cleanruv_data *clean_data, int che
|
|
|
6f51e1 |
/* extop was accepted */
|
|
|
6f51e1 |
rc = 0;
|
|
|
6f51e1 |
} else {
|
|
|
6f51e1 |
- cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
- "Replica %s does not support the CLEANALLRUV task. "
|
|
|
6f51e1 |
- "Sending replica CLEANRUV task...", slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
|
|
|
6f51e1 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
+ "Replica %s does not support the CLEANALLRUV task. "
|
|
|
6f51e1 |
+ "Sending replica CLEANRUV task...",
|
|
|
6f51e1 |
+ slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
|
|
|
6f51e1 |
/*
|
|
|
6f51e1 |
* Ok, this replica doesn't know about CLEANALLRUV, so just manually
|
|
|
6f51e1 |
* add the CLEANRUV task to the replica.
|
|
|
6f51e1 |
@@ -3463,9 +3466,9 @@ replica_cleanallruv_check_maxcsn(Repl_Agmt *agmt, char *basedn, char *rid_text,
|
|
|
6f51e1 |
csn_init_by_string(repl_max, remote_maxcsn);
|
|
|
6f51e1 |
if(csn_compare (repl_max, max) < 0){
|
|
|
6f51e1 |
/* we are not caught up yet, free, and return */
|
|
|
6f51e1 |
- cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID, LOG_NOTICE,
|
|
|
6f51e1 |
- "Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
|
|
|
6f51e1 |
- remote_maxcsn, maxcsn);
|
|
|
6f51e1 |
+ cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID, SLAPI_LOG_NOTICE,
|
|
|
6f51e1 |
+ "Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
|
|
|
6f51e1 |
+ remote_maxcsn, maxcsn);
|
|
|
6f51e1 |
rc = -1;
|
|
|
6f51e1 |
} else {
|
|
|
6f51e1 |
/* ok this replica is caught up */
|
|
|
6f51e1 |
@@ -3636,7 +3639,6 @@ stop_ruv_cleaning()
|
|
|
6f51e1 |
void
|
|
|
6f51e1 |
cleanruv_log(Slapi_Task *task, int rid, char *task_type, int sev_level, char *fmt, ...)
|
|
|
6f51e1 |
{
|
|
|
6f51e1 |
-#ifdef LDAP_DEBUG
|
|
|
6f51e1 |
va_list ap1;
|
|
|
6f51e1 |
va_list ap2;
|
|
|
6f51e1 |
va_list ap3;
|
|
|
6f51e1 |
@@ -3661,7 +3663,6 @@ cleanruv_log(Slapi_Task *task, int rid, char *task_type, int sev_level, char *fm
|
|
|
6f51e1 |
va_end(ap2);
|
|
|
6f51e1 |
va_end(ap3);
|
|
|
6f51e1 |
va_end(ap4);
|
|
|
6f51e1 |
-#endif
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
|
|
|
6f51e1 |
char *
|
|
|
6f51e1 |
--
|
|
|
6f51e1 |
2.13.6
|
|
|
6f51e1 |
|