ldap/servers/plugins/replication/repl5_replica_config.c | 8 +++++---
ldap/servers/plugins/replication/repl_extop.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
New commits:
commit df3a0a2675fba52ec8bb5b9548b326f714814b56
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Aug 14 19:03:31 2012 -0400
Ticket 403 - CLEANALLRUV amendment
Bug Description: If the replica the task is run on doesn't have any agmts, it
doesn't
correctly finish the task. Also, on a second pass, if the rid was
already cleaned, you could get stuck in a loop(waiting for all the
deleted replica's changes to be applied).
Fix Description: Check how many agmts we process, if its zero, exit correctly. To
fix
the loop use ruv_covers_csn_strict - this correctly handles
rid's
that have already been cleaned.
https://fedorahosted.org/389/ticket/403
Reviewed by: Noriko!
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c
b/ldap/servers/plugins/replication/repl5_replica_config.c
index a03740b..65b060b 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1448,8 +1448,9 @@ replica_cleanallruv_thread(void *arg)
char csnstr[CSN_STRSIZE];
char *returntext = NULL;
char *rid_text = NULL;
- int found_dirty_rid = 1;
int agmt_not_notified = 1;
+ int found_dirty_rid = 1;
+ int agmt_count = 0;
int interval = 10;
int free_obj = 0;
int rc = 0;
@@ -1491,7 +1492,7 @@ replica_cleanallruv_thread(void *arg)
ruv_obj = replica_get_ruv(data->replica);
ruv = object_get_data (ruv_obj);
while(data->maxcsn && !is_task_aborted(data->rid) &&
!is_cleaned_rid(data->rid) && !slapi_is_shutting_down()){
- if(csn_get_replicaid(data->maxcsn) == 0 ||
ruv_covers_csn(ruv,data->maxcsn)){
+ if(csn_get_replicaid(data->maxcsn) == 0 ||
ruv_covers_csn_strict(ruv,data->maxcsn)){
/* We are caught up, now we can clean the ruv's */
break;
}
@@ -1587,6 +1588,7 @@ replica_cleanallruv_thread(void *arg)
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica,
agmt_obj);
continue;
}
+ agmt_count++;
if(replica_cleanallruv_check_ruv(agmt, rid_text, data->task) == 0){
found_dirty_rid = 0;
} else {
@@ -1622,7 +1624,7 @@ done:
/*
* If the replicas are cleaned, release the rid, and trim the changelog
*/
- if(!found_dirty_rid){
+ if(!found_dirty_rid || agmt_count == 0){
trigger_cl_trimming(data->rid);
delete_cleaned_rid(data->replica, data->rid, data->maxcsn);
cleanruv_log(data->task, CLEANALLRUV_ID, "Successfully cleaned
rid(%d).", data->rid);
diff --git a/ldap/servers/plugins/replication/repl_extop.c
b/ldap/servers/plugins/replication/repl_extop.c
index db94ba7..ecf1f93 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -1618,7 +1618,7 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
break;
}
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: checking if
we're caught up...\n");
- if(ruv_covers_csn(ruv,maxcsn) || csn_get_replicaid(maxcsn) == 0){
+ if(ruv_covers_csn_strict(ruv,maxcsn) || csn_get_replicaid(maxcsn) == 0){
/* We are caught up */
break;
} else {