Tuesday, September 6, 2016

[389-commits] ldap/servers

ldap/servers/plugins/replication/repl5_replica_config.c | 33 +++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 11a5b1e412cb77a752366e352cb9d203c52b108e
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Tue Sep 6 10:39:46 2016 -0400

Ticket 48414 - cleanAllRUV should clean the agreement RUV

Bug Description: After running cleanAllRUV the RUV attributes in the
replication agreements are not updated until the
server is restarted. This can cause confusion about
the success of the task.

Fix Description: At the end of the task, stop the agreement, clean it,
and start it back up.

https://fedorahosted.org/389/ticket/48414

Reviewed by: nhosoi(Thanks!)

diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 25adacd..bbaf574 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -83,6 +83,7 @@ static multimaster_mtnode_extension * _replica_config_get_mtnode_ext (const Slap
static void replica_cleanall_ruv_destructor(Slapi_Task *task);
static void replica_cleanall_ruv_abort_destructor(Slapi_Task *task);
static void remove_keep_alive_entry(Slapi_Task *task, ReplicaId rid, const char *repl_root);
+static void clean_agmts(cleanruv_data *data);

/*
* Note: internal add/modify/delete operations should not be run while
@@ -1987,13 +1988,15 @@ done:
* Delete the cleaned rid config.
* Make sure all the replicas have been "pre_cleaned"
* Remove the keep alive entry if present
+ * Clean the agreements' RUV
* Remove the rid from the internal clean list
*/
delete_cleaned_rid_config(data);
check_replicas_are_done_cleaning(data);
remove_keep_alive_entry(data->task, data->rid, data->repl_root);
- cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
+ clean_agmts(data);
remove_cleaned_rid(data->rid);
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Successfully cleaned rid(%d).", data->rid);
} else {
/*
* Shutdown or abort
@@ -2027,6 +2030,34 @@ done:
}

/*
+ * Clean the RUV attributes from all the agreements
+ */
+static void
+clean_agmts(cleanruv_data *data)
+{
+ Object *agmt_obj = NULL;
+ Repl_Agmt *agmt = NULL;
+
+ agmt_obj = agmtlist_get_first_agreement_for_replica (data->replica);
+ if(agmt_obj == NULL){
+ return;
+ }
+ while (agmt_obj && !slapi_is_shutting_down()){
+ agmt = (Repl_Agmt*)object_get_data (agmt_obj);
+ if(!agmt_is_enabled(agmt) || get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS){
+ agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
+ continue;
+ }
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Cleaning agmt...");
+ agmt_stop(agmt);
+ agmt_update_consumer_ruv(agmt);
+ agmt_start(agmt);
+ agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
+ }
+ cleanruv_log(data->task, data->rid, CLEANALLRUV_ID, "Cleaned replication agreements.");
+}
+
+/*
* Remove the "Keep-Alive" replication entry.
*/
static void

--
389-commits mailing list
389-commits@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/389-commits@lists.fedoraproject.org

No comments:

Post a Comment