andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From ac98944372376a0d41a33dfe84a99bfaa151699f Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 18 Sep 2015 11:56:29 -0400
Subject: [PATCH 59/61] Ticket 48217 - cleanallruv - fix regression with server
 shutdown

Bug Description:  Recent checks for server shutdown were added to cleanallruv task,
                  but we did not properly check for "shutdown" at the end of the task.
                  This caused the server to think the task successfully finished,
                  when in fact it did not.

Fix Description:  Properly check for shutdown at the end of the task, and handler it
                  appropriately.

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

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit c41d36de0ca438bf23e4e810bfec0fd59cbc790b)
(cherry picked from commit d9f03f5fddfc8ba7009c9dcc584686e43d6339e8)
---
 ldap/servers/plugins/replication/repl5_replica_config.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 446da3f..8d3c481 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1948,7 +1948,7 @@ done:
     /*
      *  If the replicas are cleaned, release the rid
      */
-    if(!aborted){
+    if(!aborted && !slapi_is_shutting_down()){
         delete_cleaned_rid_config(data);
         /* make sure all the replicas have been "pre_cleaned" before finishing */
         check_replicas_are_done_cleaning(data);
@@ -3005,7 +3005,7 @@ replica_abort_task_thread(void *arg)
     }
 
     /*
-     *  Now send the cleanruv extended op to all the agreements
+     *  Now send the abort cleanruv extended op to all the agreements
      */
     while(agmt_not_notified && !slapi_is_shutting_down()){
         agmt_obj = agmtlist_get_first_agreement_for_replica (data->replica);
@@ -3013,7 +3013,7 @@ replica_abort_task_thread(void *arg)
         	agmt_not_notified = 0;
         	break;
         }
-        while (agmt_obj){
+        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);
@@ -3058,7 +3058,7 @@ replica_abort_task_thread(void *arg)
     } /* while */
 
 done:
-    if(agmt_not_notified){
+    if(agmt_not_notified || slapi_is_shutting_down()){
         /* failure */
         cleanruv_log(data->task, data->rid, ABORT_CLEANALLRUV_ID,"Abort task failed, will resume the task at the next server startup.");
     } else {
-- 
1.9.3