|
|
dc8c34 |
From b28cb726b667120c7bb685c025f01a03832e137b Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
dc8c34 |
Date: Tue, 21 Apr 2015 10:33:49 -0400
|
|
|
dc8c34 |
Subject: [PATCH 321/323] Ticket 48151 - Improve CleanAllRUV logging
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug Description: It is very difficult to troubleshoot cleanAllRUV issues
|
|
|
dc8c34 |
when there are multiple clean tasks running.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix Description: Add the replica ID to each logging statement.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/48151
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by: rmeggins(Thanks!)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit 33330c355ace8f3d351ea1db94cf2e8faf12f19f)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Conflicts:
|
|
|
dc8c34 |
ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit 6b873e6bdf736bacc16f832686cae1d64175f675)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/plugins/replication/repl5.h | 2 +-
|
|
|
dc8c34 |
.../plugins/replication/repl5_replica_config.c | 183 +++++++++++----------
|
|
|
dc8c34 |
2 files changed, 99 insertions(+), 86 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
|
|
|
dc8c34 |
index 231daf5..10c0869 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/replication/repl5.h
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/replication/repl5.h
|
|
|
dc8c34 |
@@ -646,7 +646,7 @@ int is_task_aborted(ReplicaId rid);
|
|
|
dc8c34 |
void delete_aborted_rid(Replica *replica, ReplicaId rid, char *repl_root, int skip);
|
|
|
dc8c34 |
int is_pre_cleaned_rid(ReplicaId rid);
|
|
|
dc8c34 |
void set_cleaned_rid(ReplicaId rid);
|
|
|
dc8c34 |
-void cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...);
|
|
|
dc8c34 |
+void cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...);
|
|
|
dc8c34 |
char * replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
#define CLEANRIDSIZ 4 /* maximum number for concurrent CLEANALLRUV tasks */
|
|
|
dc8c34 |
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
dc8c34 |
index daefc03..9f9197e 100644
|
|
|
dc8c34 |
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
dc8c34 |
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
dc8c34 |
@@ -1262,27 +1262,27 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Get our task settings
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
|
|
|
dc8c34 |
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
|
|
|
dc8c34 |
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
|
|
|
dc8c34 |
+ cleanruv_log(task, -1, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
|
|
|
dc8c34 |
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-id attribute");
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ rid = atoi(rid_str);
|
|
|
dc8c34 |
+ if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
|
|
|
dc8c34 |
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing replica-base-dn attribute");
|
|
|
dc8c34 |
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
if ((force_cleaning = fetch_attr(e, "replica-force-cleaning", 0)) != NULL){
|
|
|
dc8c34 |
if(strcasecmp(force_cleaning,"yes") != 0 && strcasecmp(force_cleaning,"no") != 0){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for replica-force-cleaning "
|
|
|
dc8c34 |
"(%s). Value must be \"yes\" or \"no\" for task - (%s)",
|
|
|
dc8c34 |
force_cleaning, slapi_sdn_get_dn(task_dn));
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, (int)rid, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -1293,11 +1293,10 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Check the rid
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- rid = atoi(rid_str);
|
|
|
dc8c34 |
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
|
|
|
dc8c34 |
rid, slapi_sdn_get_dn(task_dn));
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -1305,7 +1304,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
|
|
|
dc8c34 |
if(is_cleaned_rid(rid)){
|
|
|
dc8c34 |
/* we are already cleaning this rid */
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being cleaned", rid);
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -1316,7 +1315,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
|
|
|
dc8c34 |
dn = slapi_sdn_new_dn_byval(base_dn);
|
|
|
dc8c34 |
if((r = replica_get_replica_from_dn(dn)) == NULL){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Could not find replica from dn(%s)",slapi_sdn_get_dn(dn));
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -1327,7 +1326,7 @@ replica_cleanall_ruv_task(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
|
|
|
dc8c34 |
|
|
|
dc8c34 |
out:
|
|
|
dc8c34 |
if(rc){
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "Task failed...(%d)", rc);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Task failed...(%d)", rc);
|
|
|
dc8c34 |
slapi_task_finish(task, *returncode);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_OK;
|
|
|
dc8c34 |
@@ -1359,11 +1358,11 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
char *basedn = NULL;
|
|
|
dc8c34 |
int rc = 0;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,"Initiating CleanAllRUV Task...");
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if(get_cleanruv_task_count() >= CLEANRIDSIZ){
|
|
|
dc8c34 |
/* we are already running the maximum number of tasks */
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
"Exceeded maximum number of active CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
|
|
|
dc8c34 |
return LDAP_UNWILLING_TO_PERFORM;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1373,7 +1372,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
if(r){
|
|
|
dc8c34 |
replica = (Replica*)object_get_data (r);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Replica object is NULL, aborting task");
|
|
|
dc8c34 |
return -1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
@@ -1381,7 +1380,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
if(replica_get_type(replica) == REPLICA_TYPE_READONLY){
|
|
|
dc8c34 |
/* this is a consumer, send error */
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d), task can not be run on a consumer",rid);
|
|
|
dc8c34 |
if(task){
|
|
|
dc8c34 |
rc = -1;
|
|
|
dc8c34 |
slapi_task_finish(task, rc);
|
|
|
dc8c34 |
@@ -1391,7 +1390,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Grab the max csn of the deleted replica
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Retrieving maxcsn...");
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Retrieving maxcsn...");
|
|
|
dc8c34 |
basedn = (char *)slapi_sdn_get_dn(replica_get_root(replica));
|
|
|
dc8c34 |
maxcsn = replica_cleanallruv_find_maxcsn(replica, rid, basedn);
|
|
|
dc8c34 |
if(maxcsn == NULL || csn_get_replicaid(maxcsn) == 0){
|
|
|
dc8c34 |
@@ -1404,7 +1403,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
csn_init_by_string(maxcsn, "");
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
csn_as_string(maxcsn, PR_FALSE, csnstr);
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Found maxcsn (%s)",csnstr);
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Create payload
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
@@ -1413,7 +1412,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
slapi_ch_free_string(&ridstr);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if(payload == NULL){
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
|
|
|
dc8c34 |
rc = -1;
|
|
|
dc8c34 |
goto fail;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1423,7 +1422,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
|
|
|
dc8c34 |
if (data == NULL) {
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to allocate cleanruv_data. Aborting task.");
|
|
|
dc8c34 |
rc = -1;
|
|
|
dc8c34 |
goto fail;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1450,7 +1449,7 @@ replica_execute_cleanall_ruv_task (Object *r, ReplicaId rid, Slapi_Task *task, c
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
fail:
|
|
|
dc8c34 |
- cleanruv_log(pre_task, CLEANALLRUV_ID, "Failed to clean rid (%d)",rid);
|
|
|
dc8c34 |
+ cleanruv_log(pre_task, rid, CLEANALLRUV_ID, "Failed to clean rid (%d)", rid);
|
|
|
dc8c34 |
if(task){
|
|
|
dc8c34 |
slapi_task_finish(task, rc);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1516,9 +1515,9 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
PR_Unlock( notify_lock );
|
|
|
dc8c34 |
data->repl_obj = replica_get_replica_from_dn(data->sdn);
|
|
|
dc8c34 |
if(data->repl_obj == NULL){
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
|
|
|
dc8c34 |
- aborted = 1;
|
|
|
dc8c34 |
- goto done;
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to retrieve repl object from dn(%s).", data->sdn);
|
|
|
dc8c34 |
+ aborted = 1;
|
|
|
dc8c34 |
+ goto done;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
data->replica = (Replica*)object_get_data(data->repl_obj);
|
|
|
dc8c34 |
free_obj = 1;
|
|
|
dc8c34 |
@@ -1530,9 +1529,9 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
/* verify we have set our repl objects */
|
|
|
dc8c34 |
if(data->repl_obj == NULL || data->replica == NULL){
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Unable to set the replica objects.");
|
|
|
dc8c34 |
- aborted = 1;
|
|
|
dc8c34 |
- goto done;
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Unable to set the replica objects.");
|
|
|
dc8c34 |
+ aborted = 1;
|
|
|
dc8c34 |
+ goto done;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if(data->repl_root == NULL){
|
|
|
dc8c34 |
/* we must have resumed from start up, fill in the repl root */
|
|
|
dc8c34 |
@@ -1552,11 +1551,11 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
* Add the cleanallruv task to the repl config - so we can handle restarts
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
add_cleaned_rid(data->rid, data->replica, csnstr, data->force); /* marks config that we started cleaning a rid */
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Cleaning rid (%d)...", data->rid);
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* First, wait for the maxcsn to be covered
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting to process all the updates from the deleted replica...");
|
|
|
dc8c34 |
ruv_obj = replica_get_ruv(data->replica);
|
|
|
dc8c34 |
ruv = object_get_data (ruv_obj);
|
|
|
dc8c34 |
while(data->maxcsn && !is_task_aborted(data->rid) && !is_cleaned_rid(data->rid) && !slapi_is_shutting_down()){
|
|
|
dc8c34 |
@@ -1574,7 +1573,7 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
*
|
|
|
dc8c34 |
* Even if we are forcing the cleaning, the replicas still need to be up
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to be online...");
|
|
|
dc8c34 |
if(check_agmts_are_alive(data->replica, data->rid, data->task)){
|
|
|
dc8c34 |
/* error, aborted or shutdown */
|
|
|
dc8c34 |
aborted = 1;
|
|
|
dc8c34 |
@@ -1583,7 +1582,7 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Make sure all the replicas have seen the max csn
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Waiting for all the replicas to receive all the deleted replica updates...");
|
|
|
dc8c34 |
if(strcasecmp(data->force,"no") == 0 && check_agmts_are_caught_up(data, csnstr)){
|
|
|
dc8c34 |
/* error, aborted or shutdown */
|
|
|
dc8c34 |
aborted = 1;
|
|
|
dc8c34 |
@@ -1597,7 +1596,7 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Now send the cleanruv extended op to all the agreements
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Sending cleanAllRUV task to all the replicas...");
|
|
|
dc8c34 |
while(agmt_not_notified && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
|
|
|
dc8c34 |
agmt_obj = agmtlist_get_first_agreement_for_replica (data->replica);
|
|
|
dc8c34 |
if(agmt_obj == NULL){
|
|
|
dc8c34 |
@@ -1615,7 +1614,7 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
agmt_not_notified = 0;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
agmt_not_notified = 1;
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Failed to send task to replica (%s)",agmt_get_long_name(agmt));
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
|
|
|
dc8c34 |
@@ -1631,7 +1630,7 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* need to sleep between passes
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas have received the "
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas have received the "
|
|
|
dc8c34 |
"cleanallruv extended op, retrying in %d seconds",interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
@@ -1646,12 +1645,13 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Run the CLEANRUV task
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Cleaning local ruv's...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Cleaning local ruv's...");
|
|
|
dc8c34 |
replica_execute_cleanruv_task (data->repl_obj, data->rid, returntext);
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Wait for all the replicas to be cleaned
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Waiting for all the replicas to be cleaned...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "Waiting for all the replicas to be cleaned...");
|
|
|
dc8c34 |
|
|
|
dc8c34 |
interval = 10;
|
|
|
dc8c34 |
while(found_dirty_rid && !is_task_aborted(data->rid) && !slapi_is_shutting_down()){
|
|
|
dc8c34 |
@@ -1670,7 +1670,8 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
found_dirty_rid = 0;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
found_dirty_rid = 1;
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",agmt_get_long_name(agmt));
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Replica is not cleaned yet (%s)",
|
|
|
dc8c34 |
+ agmt_get_long_name(agmt));
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
|
|
|
dc8c34 |
@@ -1686,7 +1687,7 @@ replica_cleanallruv_thread(void *arg)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* need to sleep between passes
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replicas have not been cleaned yet, "
|
|
|
dc8c34 |
"retrying in %d seconds", interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
@@ -1708,16 +1709,16 @@ done:
|
|
|
dc8c34 |
delete_cleaned_rid_config(data);
|
|
|
dc8c34 |
/* make sure all the replicas have been "pre_cleaned" before finishing */
|
|
|
dc8c34 |
check_replicas_are_done_cleaning(data);
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
|
|
|
dc8c34 |
remove_cleaned_rid(data->rid);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Shutdown or abort
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
if(!is_task_aborted(data->rid)){
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Server shutting down. Process will resume at server startup");
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,"Task aborted for rid(%d).",data->rid);
|
|
|
dc8c34 |
delete_cleaned_rid_config(data);
|
|
|
dc8c34 |
remove_cleaned_rid(data->rid);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1753,7 +1754,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
|
|
|
dc8c34 |
int not_all_cleaned = 1;
|
|
|
dc8c34 |
int interval = 10;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Waiting for all the replicas to finish cleaning...");
|
|
|
dc8c34 |
|
|
|
dc8c34 |
csn_as_string(data->maxcsn, PR_FALSE, csnstr);
|
|
|
dc8c34 |
filter = PR_smprintf("(%s=%d:%s:%s)", type_replicaCleanRUV,(int)data->rid, csnstr, data->force);
|
|
|
dc8c34 |
@@ -1781,7 +1782,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
|
|
|
dc8c34 |
if(not_all_cleaned == 0 || is_task_aborted(data->rid) ){
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Not all replicas finished cleaning, retrying in %d seconds",interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
PR_Unlock( notify_lock );
|
|
|
dc8c34 |
@@ -1856,7 +1857,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
|
|
|
dc8c34 |
int not_all_aborted = 1;
|
|
|
dc8c34 |
int interval = 10;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Waiting for all the replicas to finish aborting...");
|
|
|
dc8c34 |
|
|
|
dc8c34 |
filter = PR_smprintf("(%s=%d:%s)", type_replicaAbortCleanRUV, data->rid, data->repl_root);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -1884,7 +1885,7 @@ check_replicas_are_done_aborting(cleanruv_data *data )
|
|
|
dc8c34 |
if(not_all_aborted == 0){
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Not all replicas finished aborting, retrying in %d seconds",interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
PR_Unlock( notify_lock );
|
|
|
dc8c34 |
@@ -1928,7 +1929,7 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
|
|
|
dc8c34 |
not_all_caughtup = 0;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
not_all_caughtup = 1;
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Replica not caught up (%s)",agmt_get_long_name(agmt));
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
|
|
|
dc8c34 |
@@ -1937,7 +1938,8 @@ check_agmts_are_caught_up(cleanruv_data *data, char *maxcsn)
|
|
|
dc8c34 |
if(not_all_caughtup == 0 || is_task_aborted(data->rid) ){
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- cleanruv_log(data->task, CLEANALLRUV_ID, "Not all replicas caught up, retrying in %d seconds",interval);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "Not all replicas caught up, retrying in %d seconds",interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
PR_Unlock( notify_lock );
|
|
|
dc8c34 |
@@ -1985,7 +1987,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
|
|
|
dc8c34 |
not_all_alive = 0;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
not_all_alive = 1;
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "Replica not online (%s)",agmt_get_long_name(agmt));
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Replica not online (%s)",
|
|
|
dc8c34 |
+ agmt_get_long_name(agmt));
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
|
|
|
dc8c34 |
@@ -1994,7 +1997,8 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
|
|
|
dc8c34 |
if(not_all_alive == 0 || is_task_aborted(rid)){
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",interval);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, CLEANALLRUV_ID, "Not all replicas online, retrying in %d seconds...",
|
|
|
dc8c34 |
+ interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
PR_Unlock( notify_lock );
|
|
|
dc8c34 |
@@ -2098,8 +2102,9 @@ replica_send_cleanruv_task(Repl_Agmt *agmt, cleanruv_data *clean_data)
|
|
|
dc8c34 |
if(rc != LDAP_SUCCESS){
|
|
|
dc8c34 |
char *hostname = agmt_get_hostname(agmt);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "Failed to add CLEANRUV task (%s) to replica "
|
|
|
dc8c34 |
- "(%s). You will need to manually run the CLEANRUV task on this replica (%s) error (%d)",
|
|
|
dc8c34 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "Failed to add CLEANRUV task (%s) to replica (%s). You will need "
|
|
|
dc8c34 |
+ "to manually run the CLEANRUV task on this replica (%s) error (%d)",
|
|
|
dc8c34 |
repl_dn, agmt_get_long_name(agmt), hostname, rc);
|
|
|
dc8c34 |
slapi_ch_free_string(&hostname);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2371,7 +2376,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
|
|
|
dc8c34 |
int rc = -1, ret, rid;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if(clean_data == NULL){
|
|
|
dc8c34 |
- cleanruv_log(NULL, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
|
|
|
dc8c34 |
+ cleanruv_log(NULL, clean_data->rid, CLEANALLRUV_ID, "delete_cleaned_rid_config: cleanruv data is NULL, "
|
|
|
dc8c34 |
"failed to clean the config.");
|
|
|
dc8c34 |
return;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2391,7 +2396,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
|
|
|
dc8c34 |
slapi_search_internal_pb(pb);
|
|
|
dc8c34 |
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret;;
|
|
|
dc8c34 |
if (ret != LDAP_SUCCESS){
|
|
|
dc8c34 |
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: internal search failed(%d).",ret);
|
|
|
dc8c34 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "delete_cleaned_rid_config: internal search failed(%d).",ret);
|
|
|
dc8c34 |
goto bail;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
|
|
|
dc8c34 |
@@ -2399,7 +2405,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* No matching entries!
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"delete_cleaned_rid_config: failed to find any "
|
|
|
dc8c34 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "delete_cleaned_rid_config: failed to find any "
|
|
|
dc8c34 |
"entries with nsds5ReplicaCleanRUV under (%s)", dn);
|
|
|
dc8c34 |
goto bail;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
@@ -2450,7 +2457,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
|
|
|
dc8c34 |
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove task data "
|
|
|
dc8c34 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "delete_cleaned_rid_config: failed to remove task data "
|
|
|
dc8c34 |
"from (%s) error (%d), rid (%d)", edn, rc, clean_data->rid);
|
|
|
dc8c34 |
goto bail;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2460,7 +2468,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
bail:
|
|
|
dc8c34 |
if (rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT){
|
|
|
dc8c34 |
- cleanruv_log(clean_data->task, CLEANALLRUV_ID, "delete_cleaned_rid_config: failed to remove replica config "
|
|
|
dc8c34 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "delete_cleaned_rid_config: failed to remove replica config "
|
|
|
dc8c34 |
"(%d), rid (%d)", rc, clean_data->rid);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
slapi_free_search_results_internal(pb);
|
|
|
dc8c34 |
@@ -2518,8 +2527,10 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if(get_abort_cleanruv_task_count() >= CLEANRIDSIZ){
|
|
|
dc8c34 |
/* we are already running the maximum number of tasks */
|
|
|
dc8c34 |
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",CLEANRIDSIZ);
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
dc8c34 |
+ "Exceeded maximum number of active ABORT CLEANALLRUV tasks(%d)",
|
|
|
dc8c34 |
+ CLEANRIDSIZ);
|
|
|
dc8c34 |
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -2531,7 +2542,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
if ((rid_str = fetch_attr(e, "replica-id", 0)) == NULL){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-id\"");
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, -1, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2544,14 +2555,14 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
if (rid <= 0 || rid >= READ_ONLY_REPLICA_ID){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid replica id (%d) for task - (%s)",
|
|
|
dc8c34 |
rid, slapi_sdn_get_dn(slapi_entry_get_sdn(e)));
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if ((base_dn = fetch_attr(e, "replica-base-dn", 0)) == NULL){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Missing required attr \"replica-base-dn\"");
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OBJECT_CLASS_VIOLATION;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2559,7 +2570,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
if(!is_cleaned_rid(rid) && !is_pre_cleaned_rid(rid)){
|
|
|
dc8c34 |
/* we are not cleaning this rid */
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is not being cleaned, nothing to abort.", rid);
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2567,7 +2578,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
if(is_task_aborted(rid)){
|
|
|
dc8c34 |
/* we are already aborting this rid */
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Replica id (%d) is already being aborted", rid);
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2578,7 +2589,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
sdn = slapi_sdn_new_dn_byval(base_dn);
|
|
|
dc8c34 |
if((r = replica_get_replica_from_dn(sdn)) == NULL){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Failed to find replica from dn(%s)", base_dn);
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2590,7 +2601,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
if(strcasecmp(certify_all,"yes") && strcasecmp(certify_all,"no")){
|
|
|
dc8c34 |
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Invalid value for \"replica-certify-all\", the value "
|
|
|
dc8c34 |
"must be \"yes\" or \"no\".");
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "%s", returntext);
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2611,7 +2622,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
payload = create_cleanruv_payload(ridstr);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if(payload == NULL){
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Failed to create extended op payload, aborting task");
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2627,7 +2638,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
data = (cleanruv_data*)slapi_ch_calloc(1, sizeof(cleanruv_data));
|
|
|
dc8c34 |
if (data == NULL) {
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Failed to allocate abort_cleanruv_data. Aborting task.");
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
goto out;
|
|
|
dc8c34 |
@@ -2646,7 +2657,7 @@ replica_cleanall_ruv_abort(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter
|
|
|
dc8c34 |
PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
|
|
|
dc8c34 |
if (thread == NULL) {
|
|
|
dc8c34 |
object_release(r);
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID,"Unable to create abort thread. Aborting task.");
|
|
|
dc8c34 |
*returncode = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
slapi_ch_free_string(&data->certify);
|
|
|
dc8c34 |
rc = SLAPI_DSE_CALLBACK_ERROR;
|
|
|
dc8c34 |
@@ -2657,7 +2668,7 @@ out:
|
|
|
dc8c34 |
slapi_sdn_free(&sdn;;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if(rc != SLAPI_DSE_CALLBACK_OK){
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
|
|
|
dc8c34 |
+ cleanruv_log(task, rid, ABORT_CLEANALLRUV_ID, "Abort Task failed (%d)", rc);
|
|
|
dc8c34 |
slapi_task_finish(task, rc);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -2678,7 +2689,7 @@ replica_abort_task_thread(void *arg)
|
|
|
dc8c34 |
int release_it = 0;
|
|
|
dc8c34 |
int count = 0, rc = 0;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Aborting task for rid(%d)...",data->rid);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Need to build the replica from the dn
|
|
|
dc8c34 |
@@ -2689,7 +2700,7 @@ replica_abort_task_thread(void *arg)
|
|
|
dc8c34 |
* to timing issues, we need to wait to grab the replica obj until we get here.
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
if((data->repl_obj = replica_get_replica_from_dn(data->sdn)) == NULL){
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to get replica object from dn (%s).", slapi_sdn_get_dn(data->sdn));
|
|
|
dc8c34 |
goto done;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
if(data->replica == NULL && data->repl_obj){
|
|
|
dc8c34 |
@@ -2737,7 +2748,7 @@ replica_abort_task_thread(void *arg)
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* need to sleep between passes
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Retrying in %d seconds",interval);
|
|
|
dc8c34 |
PR_Lock( notify_lock );
|
|
|
dc8c34 |
PR_WaitCondVar( notify_cvar, PR_SecondsToInterval(interval) );
|
|
|
dc8c34 |
PR_Unlock( notify_lock );
|
|
|
dc8c34 |
@@ -2752,17 +2763,17 @@ replica_abort_task_thread(void *arg)
|
|
|
dc8c34 |
done:
|
|
|
dc8c34 |
if(agmt_not_notified){
|
|
|
dc8c34 |
/* failure */
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Wait for this server to stop its cleanallruv task(which removes the rid from the cleaned list)
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Waiting for CleanAllRUV task to abort...");
|
|
|
dc8c34 |
while(is_cleaned_rid(data->rid)){
|
|
|
dc8c34 |
DS_Sleep(PR_SecondsToInterval(1));
|
|
|
dc8c34 |
count++;
|
|
|
dc8c34 |
if(count == 60){ /* it should not take this long */
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "CleanAllRUV task failed to abort. You might need to "
|
|
|
dc8c34 |
"rerun the task.");
|
|
|
dc8c34 |
rc = -1;
|
|
|
dc8c34 |
break;
|
|
|
dc8c34 |
@@ -2777,9 +2788,9 @@ done:
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
delete_aborted_rid(data->replica, data->rid, data->repl_root, 0); /* remove the in-memory aborted rid */
|
|
|
dc8c34 |
if(rc == 0){
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Successfully aborted task for rid(%d)", data->rid);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- cleanruv_log(data->task, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
|
|
|
dc8c34 |
+ cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID, "Failed to abort task for rid(%d)",data->rid);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -2815,10 +2826,12 @@ replica_cleanallruv_send_abort_extop(Repl_Agmt *ra, Slapi_Task *task, struct ber
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
rc = crc;
|
|
|
dc8c34 |
if(rc){
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
|
|
|
dc8c34 |
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "Failed to send extop to replica(%s).", agmt_get_long_name(ra));
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- cleanruv_log(task, ABORT_CLEANALLRUV_ID, "Failed to connect to replica(%s).", agmt_get_long_name(ra));
|
|
|
dc8c34 |
+ cleanruv_log(task, agmt_get_consumer_rid(ra, conn), ABORT_CLEANALLRUV_ID,
|
|
|
dc8c34 |
+ "Failed to connect to replica(%s).", agmt_get_long_name(ra));
|
|
|
dc8c34 |
rc = -1;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
conn_delete_internal_ext(conn);
|
|
|
dc8c34 |
@@ -2853,7 +2866,7 @@ replica_cleanallruv_send_extop(Repl_Agmt *ra, cleanruv_data *clean_data, int che
|
|
|
dc8c34 |
/* extop was accepted */
|
|
|
dc8c34 |
rc = 0;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
- cleanruv_log(clean_data->task, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
|
|
|
dc8c34 |
+ cleanruv_log(clean_data->task, clean_data->rid, CLEANALLRUV_ID,"Replica %s does not support the CLEANALLRUV task. "
|
|
|
dc8c34 |
"Sending replica CLEANRUV task...", slapi_sdn_get_dn(agmt_get_dn_byref(ra)));
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Ok, this replica doesn't know about CLEANALLRUV, so just manually
|
|
|
dc8c34 |
@@ -3019,7 +3032,7 @@ replica_cleanallruv_check_maxcsn(Repl_Agmt *agmt, char *basedn, char *rid_text,
|
|
|
dc8c34 |
csn_init_by_string(repl_max, remote_maxcsn);
|
|
|
dc8c34 |
if(csn_compare (repl_max, max) < 0){
|
|
|
dc8c34 |
/* we are not caught up yet, free, and return */
|
|
|
dc8c34 |
- cleanruv_log(task, CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
|
|
|
dc8c34 |
+ cleanruv_log(task, atoi(rid_text), CLEANALLRUV_ID,"Replica maxcsn (%s) is not caught up with deleted replica's maxcsn(%s)",
|
|
|
dc8c34 |
remote_maxcsn, maxcsn);
|
|
|
dc8c34 |
rc = -1;
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
@@ -3181,7 +3194,7 @@ stop_ruv_cleaning()
|
|
|
dc8c34 |
* Write our logging to the task and error log
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
void
|
|
|
dc8c34 |
-cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
|
|
|
dc8c34 |
+cleanruv_log(Slapi_Task *task, int rid, char *task_type, char *fmt, ...)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
va_list ap1;
|
|
|
dc8c34 |
va_list ap2;
|
|
|
dc8c34 |
@@ -3199,7 +3212,7 @@ cleanruv_log(Slapi_Task *task, char *task_type, char *fmt, ...)
|
|
|
dc8c34 |
slapi_task_log_status_ext(task, fmt, ap2);
|
|
|
dc8c34 |
slapi_task_inc_progress(task);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
- errlog_fmt = PR_smprintf("%s: %s\n",task_type, fmt);
|
|
|
dc8c34 |
+ errlog_fmt = PR_smprintf("%s (rid %d): %s \n",task_type, rid, fmt);
|
|
|
dc8c34 |
slapi_log_error_ext(SLAPI_LOG_FATAL, repl_plugin_name, errlog_fmt, ap3, ap4);
|
|
|
dc8c34 |
slapi_ch_free_string(&errlog_fmt);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
@@ -3261,7 +3274,7 @@ replica_cleanallruv_get_local_maxcsn(ReplicaId rid, char *base_dn)
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
/* internal search failed */
|
|
|
dc8c34 |
- cleanruv_log(NULL, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
|
|
|
dc8c34 |
+ cleanruv_log(NULL, (int)rid, CLEANALLRUV_ID, "replica_cleanallruv_get_local_maxcsn: internal search failed (%d)\n", res);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
slapi_free_search_results_internal(search_pb);
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.9.3
|
|
|
dc8c34 |
|