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/07/12 01:47:23 UTC

svn commit: r1360479 - in /incubator/ambari/trunk: CHANGES.txt hmc/php/frontend/uninstallCleanup.php

Author: yusaku
Date: Wed Jul 11 23:47:22 2012
New Revision: 1360479

URL: http://svn.apache.org/viewvc?rev=1360479&view=rev
Log:
AMBARI-629. Upgrading Hadoop stack - uninstall for upgrade should preserve cluster information (Contributed by yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/hmc/php/frontend/uninstallCleanup.php

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1360479&r1=1360478&r2=1360479&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Jul 11 23:47:22 2012
@@ -50,6 +50,9 @@ Trunk (unreleased changes)
 
   BUG FIXES
 
+    AMBARI-629. Upgrading Hadoop stack - uninstall for upgrade should preserve
+    cluster information (yusaku) 
+
     AMBARI-624. Make hadoop-client/templeton/pig/sqoop also use 64-bit only packages
     (hitesh)
 

Modified: incubator/ambari/trunk/hmc/php/frontend/uninstallCleanup.php
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/hmc/php/frontend/uninstallCleanup.php?rev=1360479&r1=1360478&r2=1360479&view=diff
==============================================================================
--- incubator/ambari/trunk/hmc/php/frontend/uninstallCleanup.php (original)
+++ incubator/ambari/trunk/hmc/php/frontend/uninstallCleanup.php Wed Jul 11 23:47:22 2012
@@ -43,6 +43,8 @@ function deBootStrap ($clusterName, $dep
 {
   global $logger, $dbAccessor, $stagesInfo;
 
+  // $logger->log_debug('progressInfo='.print_r($progressInfo, 1));
+
   $txnStatus = !($progressInfo['encounteredError']);
 
   // do not go ahead with the cleanup. 
@@ -159,21 +161,32 @@ function deBootStrap ($clusterName, $dep
   if ($result != 0) {
     return array('result' => $result, 'error' => $error);
   }
-  // need to cleanup db for this cluster
-  $dbAccessor->cleanupCluster($clusterName);
 
+  // clean up db for this cluster if uninstalling cluster.
+  // if this is uninstall as part of upgrade, do not clean up the db.
   LockAcquire(HMC_CLUSTER_STATE_LOCK_FILE_SUFFIX);
   $clusterStateResponse = $dbAccessor->getClusterState($clusterName);
   if ($clusterStateResponse['result'] != 0) {
-    LockRelease(HMC_CLUSTER_STATE_LOCK_FILE_SUFFIX); return $clusterStateResponse;
+    LockRelease(HMC_CLUSTER_STATE_LOCK_FILE_SUFFIX);
+    return $clusterStateResponse;
   }
 
   $clusterState = json_decode($clusterStateResponse['state'], true);
 
+  $newState = null;
+  $newDisplayName = null;
+
+  if ($clusterState['state'] == 'UPGRADE_STACK_UNINSTALL_IN_PROGRESS') {
+    $newState = 'UPGRADE_STACK_UNINSTALLED';
+    $newDisplayName = 'Upgrade Stack - Uninstall succeeded';
+  } else {
+    $newState = 'NOT_CONFIGURED';
+    $newDisplayName = 'Uninstall succeeded';
+    $dbAccessor->cleanupCluster($clusterName);
+  }
+
   // set cluster state to not configured
-  $state = "NOT_CONFIGURED";
-  $displayName = "Uninstall succeeded";
-  $retval = updateClusterState($clusterName, $state, $displayName, $clusterState['context']);
+  $retval = updateClusterState($clusterName, $newState, $newDisplayName, $clusterState['context']);
   LockRelease(HMC_CLUSTER_STATE_LOCK_FILE_SUFFIX);
   return $retval;
 }