AMBARI-18640. Part2.Ambari upgrade failed while running "Alter Table blueprint" 
- blueprint_name column.(vbrodetskyi)

(cherry picked from commit 7116c013275af447fb11e3fb177281e23e2d67a0)

Change-Id: I37fa68e146040d975490fe31a8d8751d7f354b01


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

Branch: refs/heads/AMBARI-2.4.2.16
Commit: 8243b9afb174b275471726a482aa352efc1bc1f2
Parents: c697b48
Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Authored: Thu Nov 10 02:51:00 2016 +0200
Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Committed: Thu Nov 10 17:25:13 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java | 4 ++++
 .../org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java  | 2 ++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8243b9af/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
index f5445ea..6f927ab 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
@@ -157,10 +157,14 @@ public class UpgradeCatalog242 extends 
AbstractUpgradeCatalog {
 
       dbAccessor.dropFKConstraint(HOST_GROUP_TABLE, "FK_hg_blueprint_name");
 
+      dbAccessor.dropFKConstraint(HOST_GROUP_TABLE, 
"FK_hostgroup_blueprint_name");
+
       dbAccessor.dropFKConstraint(BLUEPRINT_CONFIGURATION, 
"FK_cfg_blueprint_name");
 
       dbAccessor.dropFKConstraint(BLUEPRINT_CONFIGURATION, 
"FK_blueprint_configuration_blueprint_name");
 
+      dbAccessor.dropFKConstraint(BLUEPRINT_SETTING, 
"FK_blueprint_setting_blueprint_name");
+
       dbAccessor.dropFKConstraint(BLUEPRINT_SETTING, 
"FK_blueprint_setting_name");
 
       dbAccessor.alterColumn(BLUEPRINT_TABLE, new 
DBAccessor.DBColumnInfo(BLUEPRINT_NAME_COLUMN, String.class, 100, null, false));

http://git-wip-us.apache.org/repos/asf/ambari/blob/8243b9af/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java
index 8cfcee5..265aa10 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java
@@ -149,8 +149,10 @@ public class UpgradeCatalog242Test {
     dbAccessor.alterColumn(eq(UpgradeCatalog242.HOST_ROLE_COMMAND_TABLE), 
capture(hostRoleCommandStatusColumnChangeSize));
 
     dbAccessor.dropFKConstraint(eq(UpgradeCatalog242.HOST_GROUP_TABLE), 
eq("FK_hg_blueprint_name"));
+    dbAccessor.dropFKConstraint(eq(UpgradeCatalog242.HOST_GROUP_TABLE), 
eq("FK_hostgroup_blueprint_name"));
     dbAccessor.dropFKConstraint(eq(UpgradeCatalog242.BLUEPRINT_CONFIGURATION), 
eq("FK_cfg_blueprint_name"));
     dbAccessor.dropFKConstraint(eq(UpgradeCatalog242.BLUEPRINT_CONFIGURATION), 
eq("FK_blueprint_configuration_blueprint_name"));
+    dbAccessor.dropFKConstraint(eq(UpgradeCatalog242.BLUEPRINT_SETTING), 
eq("FK_blueprint_setting_blueprint_name"));
     dbAccessor.dropFKConstraint(eq(UpgradeCatalog242.BLUEPRINT_SETTING), 
eq("FK_blueprint_setting_name"));
 
     dbAccessor.alterColumn(eq(UpgradeCatalog242.BLUEPRINT_TABLE), 
capture(blueprintBlueprintNameColumnChangeSize));

Reply via email to