ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-11409. UpgradeCatalog210 fails because older schemas used different FK names for host columns (alejandro)
Date Wed, 27 May 2015 20:39:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c5d244246 -> 82b86622e


AMBARI-11409. UpgradeCatalog210 fails because older schemas used different FK names for host
columns (alejandro)


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

Branch: refs/heads/trunk
Commit: 82b86622eea02db1e898456663beafe8a8414ba3
Parents: c5d2442
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Wed May 27 13:24:35 2015 -0700
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Wed May 27 13:24:35 2015 -0700

----------------------------------------------------------------------
 .../org/apache/ambari/server/upgrade/UpgradeCatalog210.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/82b86622/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 94757e3..8413b7f 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
@@ -360,10 +360,11 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
     if (databaseType == Configuration.DatabaseType.DERBY) {
       String constraintName = getDerbyTableConstraintName("p", HOSTS_TABLE);
       if (null != constraintName) {
-        dbAccessor.executeQuery("ALTER TABLE " + HOSTS_TABLE + " DROP CONSTRAINT " + constraintName
+ " CASCADE");
+        // Derby doesn't support CASCADE DELETE.
+        dbAccessor.executeQuery("ALTER TABLE " + HOSTS_TABLE + " DROP CONSTRAINT " + constraintName);
       }
     } else {
-      dbAccessor.executeQuery("ALTER TABLE " + HOSTS_TABLE + " DROP CONSTRAINT hosts_pkey");
+      dbAccessor.executeQuery("ALTER TABLE " + HOSTS_TABLE + " DROP CONSTRAINT hosts_pkey
CASCADE");
     }
     dbAccessor.executeQuery("ALTER TABLE " + HOSTS_TABLE + " ADD CONSTRAINT PK_hosts_id PRIMARY
KEY (host_id)");
     dbAccessor.executeQuery("ALTER TABLE " + HOSTS_TABLE + " ADD CONSTRAINT UQ_hosts_host_name
UNIQUE (host_name)");


Mime
View raw message