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:52:27 UTC
svn commit: r1375785 - in /incubator/ambari/branches/branch-0.9: CHANGES.txt
hmc/php/db/HMCDBAccessor.php hmc/php/util/selectNodes.php
Author: yusaku
Date: Tue Aug 21 20:52:27 2012
New Revision: 1375785
URL: http://svn.apache.org/viewvc?rev=1375785&view=rev
Log:
AMBARI-673. Going back to step 3 from step 5 in UI breaks DB (Contributed by Jaimin Jetly)
Modified:
incubator/ambari/branches/branch-0.9/CHANGES.txt
incubator/ambari/branches/branch-0.9/hmc/php/db/HMCDBAccessor.php
incubator/ambari/branches/branch-0.9/hmc/php/util/selectNodes.php
Modified: incubator/ambari/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/CHANGES.txt?rev=1375785&r1=1375784&r2=1375785&view=diff
==============================================================================
--- incubator/ambari/branches/branch-0.9/CHANGES.txt (original)
+++ incubator/ambari/branches/branch-0.9/CHANGES.txt Tue Aug 21 20:52:27 2012
@@ -6,6 +6,9 @@ characters wide.
Release 0.9.0 - unreleased
+ AMBARI-673. Going back to step 3 from step 5 in UI breaks DB
+ (Jaimin Jetly via yusaku)
+
AMBARI-672. Hardcoded -Xmn value for hbase causes region servers to fail to start in
machines with less memory (hitesh)
Modified: incubator/ambari/branches/branch-0.9/hmc/php/db/HMCDBAccessor.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/hmc/php/db/HMCDBAccessor.php?rev=1375785&r1=1375784&r2=1375785&view=diff
==============================================================================
--- incubator/ambari/branches/branch-0.9/hmc/php/db/HMCDBAccessor.php (original)
+++ incubator/ambari/branches/branch-0.9/hmc/php/db/HMCDBAccessor.php Tue Aug 21 20:52:27 2012
@@ -3344,6 +3344,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/branches/branch-0.9/hmc/php/util/selectNodes.php
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.9/hmc/php/util/selectNodes.php?rev=1375785&r1=1375784&r2=1375785&view=diff
==============================================================================
--- incubator/ambari/branches/branch-0.9/hmc/php/util/selectNodes.php (original)
+++ incubator/ambari/branches/branch-0.9/hmc/php/util/selectNodes.php Tue Aug 21 20:52:27 2012
@@ -263,6 +263,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));