ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-12145 ambari-server upgrade from Ambari 2.0.1 failed (dsen)
Date Thu, 25 Jun 2015 20:09:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk dfec3f348 -> bf07a9671


AMBARI-12145 ambari-server upgrade from Ambari 2.0.1 failed (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bf07a967
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bf07a967
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bf07a967

Branch: refs/heads/trunk
Commit: bf07a967100230aec2f6ab99aae58e679012879c
Parents: dfec3f3
Author: Dmytro Sen <dsen@apache.org>
Authored: Thu Jun 25 21:06:43 2015 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Thu Jun 25 23:09:32 2015 +0300

----------------------------------------------------------------------
 .../ambari/server/upgrade/UpgradeCatalog210.java   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bf07a967/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index 1117abf..66c03fa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -766,6 +766,23 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
             }
           }
         }
+        String UPDATE_CURRENT_STACK_ID_IF_NULL_TEMPLATE =
+          "UPDATE hostcomponentstate " +
+          "SET current_stack_id={0} " +
+          "WHERE current_stack_id IS NULL " +
+          "AND cluster_id={1} ";
+        rs = statement.executeQuery("SELECT cluster_id, current_stack_id FROM clusterstate");
+        if (rs != null) {
+          while (rs.next()) {
+            // if hostcomponentstate.current_stack_id is null,
+            // set to cluster's current_stack_id
+            long clusterId = rs.getLong("cluster_id");
+            long currentStackId = rs.getLong("current_stack_id");
+            String hostComponentStateSQL = MessageFormat.format(
+              UPDATE_CURRENT_STACK_ID_IF_NULL_TEMPLATE, currentStackId, clusterId);
+            dbAccessor.executeUpdate(hostComponentStateSQL, false);
+          }
+        }
       } finally {
         if (rs != null) {
           rs.close();


Mime
View raw message