You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/08/21 22:55:09 UTC
svn commit: r1375787 - in /incubator/ambari/trunk: CHANGES.txt
hmc/php/db/HMCDBAccessor.php hmc/php/util/selectNodes.php
Author: yusaku
Date: Tue Aug 21 20:55:08 2012
New Revision: 1375787
URL: http://svn.apache.org/viewvc?rev=1375787&view=rev
Log:
AMBARI-673. Going back to step 3 from step 5 in UI breaks DB (Contributed by Jaimin Jetly)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/hmc/php/db/HMCDBAccessor.php
incubator/ambari/trunk/hmc/php/util/selectNodes.php
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1375787&r1=1375786&r2=1375787&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Aug 21 20:55:08 2012
@@ -86,6 +86,9 @@ Trunk (unreleased changes)
BUG FIXES
+ AMBARI-673. Going back to step 3 from step 5 in UI breaks DB
+ (Jaimin Jetly via yusaku)
+
AMBARI-671. Mapred child java opts set to a too large of a value for
heapsize. (jitendra)
Modified: incubator/ambari/trunk/hmc/php/db/HMCDBAccessor.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/db/HMCDBAccessor.php?rev=1375787&r1=1375786&r2=1375787&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/db/HMCDBAccessor.php (original)
+++ incubator/ambari/trunk/hmc/php/db/HMCDBAccessor.php Tue Aug 21 20:55:08 2012
@@ -3736,6 +3736,27 @@ class HMCDBAccessor {
$this->cleanupHosts($clusterName);
}
+public function cleanAllHostRoles($clusterName) {
+ LockAcquire();
+
+ $response = array ("result" => 0, "error" => "");
+ $query = "DELETE from " . HostRoles. " WHERE cluster_name = "
+ . $this->dbHandle->quote($clusterName);
+ $this->logger->log_trace("Running query: $query");
+ $pdoStmt = $this->dbHandle->query($query);
+ if ($pdoStmt == FALSE) {
+ $error = $this->getLastDBErrorAsString();
+ $this->logger->log_error("Error when executing query"
+ . ", query=".$query
+ . ", error=".$error);
+ $response["result"] = 1;
+ $response["error"] = $error;
+ LockRelease(); return $response;
+ }
+ LockRelease(); return $response;
+
+}
+
public function wipeOutClusters () {
$this->deleteAllInTable("Clusters");
$this->deleteAllInTable("ServiceComponentInfo");
Modified: incubator/ambari/trunk/hmc/php/util/selectNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/util/selectNodes.php?rev=1375787&r1=1375786&r2=1375787&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/util/selectNodes.php (original)
+++ incubator/ambari/trunk/hmc/php/util/selectNodes.php Tue Aug 21 20:55:08 2012
@@ -277,6 +277,24 @@ class SelectNodes {
}
$services_tmp = $servicesDBInfo["services"];
$services = $this->filterEnabledServices($services_tmp);
+ $clusterInfo = $db->getClusterState($clusterName);
+ if ($clusterInfo["result"] != 0) {
+ $this->logger->log_error("Error getting cluster state ". $clusterInfo["error"]);
+ $return["result"] = $clusterInfo["result"];
+ $return["error"] = $clusterInfo["error"];
+ return $return;
+ }
+ $clusterState = json_decode($clusterInfo[state],true);
+ if($clusterState[state] == "CONFIGURATION_IN_PROGRESS") {
+ $hostRolesResult = $db->cleanAllHostRoles($clusterName);
+ if ($hostRolesResult["result"] != 0) {
+ $this->logger->log_error("Issue cleaning all host roles ".$hostRolesResult["error"]);
+ $return["result"] = $hostRolesResult["result"];
+ $return["error"] = $hostRolesResult["error"];
+ return $return;
+ }
+ }
+
$allHosts = $this->convertHostInfoToList($allHosts_t);
foreach($masterToHost as $componentName=>$hostNames) {
$this->logger->log_info("For cluster $clusterName setting $componentName to host \n". print_r($hostNames, true));