ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adorosz...@apache.org
Subject ambari git commit: AMBARI-21397. Remove previous upgrades to allow schema change
Date Tue, 04 Jul 2017 18:23:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-21348 45608210f -> 2b147ea66


AMBARI-21397. Remove previous upgrades to allow schema change


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

Branch: refs/heads/branch-feature-AMBARI-21348
Commit: 2b147ea66976181db82a82ec933b1186589de437
Parents: 4560821
Author: Attila Doroszlai <adoroszlai@hortonworks.com>
Authored: Mon Jul 3 18:56:36 2017 +0200
Committer: Attila Doroszlai <adoroszlai@hortonworks.com>
Committed: Tue Jul 4 20:22:35 2017 +0200

----------------------------------------------------------------------
 .../apache/ambari/server/upgrade/UpgradeCatalog252.java  | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2b147ea6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
index fd26504..0ab8180 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
@@ -36,6 +36,11 @@ public class UpgradeCatalog252 extends AbstractUpgradeCatalog {
   private static final String UPGRADE_TABLE = "upgrade";
   private static final String UPGRADE_TABLE_FROM_REPO_COLUMN = "from_repo_version_id";
   private static final String UPGRADE_TABLE_TO_REPO_COLUMN = "to_repo_version_id";
+  private static final String CLUSTERS_TABLE = "clusters";
+  private static final String SERVICE_COMPONENT_HISTORY_TABLE = "servicecomponent_history";
+  private static final String UPGRADE_GROUP_TABLE = "upgrade_group";
+  private static final String UPGRADE_ITEM_TABLE = "upgrade_item";
+  private static final String UPGRADE_ID_COLUMN = "upgrade_id";
 
   /**
    * Constructor.
@@ -109,6 +114,12 @@ public class UpgradeCatalog252 extends AbstractUpgradeCatalog {
    * @throws SQLException
    */
   private void addRepositoryColumnsToUpgradeTable() throws SQLException {
+    dbAccessor.executeQuery(String.format("UPDATE %s SET %s = NULL", CLUSTERS_TABLE, UPGRADE_ID_COLUMN));
+    dbAccessor.executeQuery(String.format("DELETE FROM %s", SERVICE_COMPONENT_HISTORY_TABLE));
+    dbAccessor.executeQuery(String.format("DELETE FROM %s", UPGRADE_ITEM_TABLE));
+    dbAccessor.executeQuery(String.format("DELETE FROM %s", UPGRADE_GROUP_TABLE));
+    dbAccessor.executeQuery(String.format("DELETE FROM %s", UPGRADE_TABLE));
+
     dbAccessor.dropColumn(UPGRADE_TABLE, "to_version");
     dbAccessor.dropColumn(UPGRADE_TABLE, "from_version");
 


Mime
View raw message