You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vi...@apache.org on 2012/06/05 23:28:29 UTC

svn commit: r1346601 - in /incubator/ambari/branches/ambari-186: CHANGES.txt hmc/php/orchestrator/Cluster.php

Author: vikram
Date: Tue Jun  5 21:28:29 2012
New Revision: 1346601

URL: http://svn.apache.org/viewvc?rev=1346601&view=rev
Log:
AMBARI-320. Reconfiguring a stopped service starts it incorrectly (Contributed by Hitesh)

Modified:
    incubator/ambari/branches/ambari-186/CHANGES.txt
    incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php

Modified: incubator/ambari/branches/ambari-186/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/CHANGES.txt?rev=1346601&r1=1346600&r2=1346601&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/CHANGES.txt (original)
+++ incubator/ambari/branches/ambari-186/CHANGES.txt Tue Jun  5 21:28:29 2012
@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-320. Reconfiguring a stopped service starts it incorrectly (Hitesh via Vikram)
+
   AMBARI-340. Info logs for PuppetInvoker (Jitendra via Vikram)
 
   AMBARI-337. Parallelize puppet kick --ping during bootstrap (Hitesh via Vikram)

Modified: incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php?rev=1346601&r1=1346600&r2=1346601&view=diff
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php (original)
+++ incubator/ambari/branches/ambari-186/hmc/php/orchestrator/Cluster.php Tue Jun  5 21:28:29 2012
@@ -803,6 +803,7 @@ class Cluster {
   private function _reconfigureServices($transaction, $serviceNames, $dryRun) {
     $serviceList = implode($serviceNames, ",");
     $this->currentAction = "Reconfigure";
+
     $this->logger->log_debug("reconfigureServices for ($serviceList) DRYRUN=$dryRun");
     $result = $this->getServices($serviceNames);
     if ($result["result"] != 0) {
@@ -812,6 +813,13 @@ class Cluster {
 
     $services = $result["services"];
 
+    $svcsToStart = array();
+    foreach ($services as $svcObj) {
+      if ($svcObj->state == STATE::STARTED || $svcObj->state == STATE::STARTING) {
+        array_push($svcsToStart, $svcObj->name);
+      }
+    }
+
     // get all dependents recursively for all the services that will be
     // reconfigured
     $dependents = array();
@@ -823,12 +831,11 @@ class Cluster {
       $dependents = array_merge($dependents, $svcDeps);
     }
     $dependents = array_unique($dependents);
-    $depsToStart = array();
     foreach ($dependents as $serviceName) {
       $svc = $this->db->getService($serviceName);
       if ($svc !== FALSE) {
         if ($svc->state == STATE::STARTED || $svc->state == STATE::STARTING) {
-          array_push($depsToStart, $serviceName);
+          array_push($svcsToStart, $serviceName);
         }
       }
     }
@@ -860,19 +867,14 @@ class Cluster {
       return $result;
     }
 
+    $serviceToStartList = implode(",", $svcsToStart);
+
     // Start the services
-    $this->logger->log_debug("reconfigureServices: Starting services ($serviceList) dryRun=$dryRun");
-    foreach ($services as $service) {
-      $result = $this->startService($transaction->createSubTransaction(), $service, $dryRun);
-      if ($result['result'] !== 0) {
-        $this->logger->log_error("Failed to start service $service->name with " . $result["error"]);
-        return $result;
-      }
-    }
+    $this->logger->log_debug("reconfigureServices: Starting services ($serviceToStartList) dryRun=$dryRun");
 
-    // Start any dependent services which were in a started state initially
-    // that would have been stopped as a result of reconfiguring a dependency
-    foreach ($depsToStart as $serviceName) {
+    // Start all services and dependents which were in a started state initially
+    // that would have been stopped as a result of reconfiguration
+    foreach ($svcsToStart as $serviceName) {
       $service = $this->db->getService($serviceName);
       $result = $this->startService($transaction->createSubTransaction(), $service, $dryRun);
       if ($result['result'] !== 0) {