AMBARI-6952. Schema upgrade failed during upgrade from BWM20 with default 
Postgres DB.(vbrodetskyi)


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

Branch: refs/heads/branch-alerts-dev
Commit: 4b91492d28ab84b05a316afc9600e47a59b37206
Parents: dd48a4c
Author: Vitaly Brodetskyi <[email protected]>
Authored: Wed Aug 20 22:12:09 2014 +0300
Committer: Vitaly Brodetskyi <[email protected]>
Committed: Wed Aug 20 22:12:25 2014 +0300

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/4b91492d/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
index 620c076..703987b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
@@ -453,10 +453,7 @@ public class UpgradeCatalog150 extends 
AbstractUpgradeCatalog {
 
     //add new sequences for config groups
     //TODO evalate possibility to automatically wrap object names in DBAcessor
-    String valueColumnName = "\"value\"";
-    if (Configuration.ORACLE_DB_NAME.equals(dbType) || 
Configuration.MYSQL_DB_NAME.equals(dbType)) {
-      valueColumnName = "value";
-    }
+    String valueColumnName = "sequence_value";
 
     dbAccessor.executeQuery("INSERT INTO ambari_sequences(sequence_name, " + 
valueColumnName + ") " +
       "VALUES('configgroup_id_seq', 1)", true);
@@ -713,6 +710,7 @@ public class UpgradeCatalog150 extends 
AbstractUpgradeCatalog {
                   configEntity.setType(configType);
                   configEntity.setTag(defaultVersionTag);
                   configEntity.setData(configData);
+                  configEntity.setVersion(1L);
                   configEntity.setTimestamp(System.currentTimeMillis());
                   configEntity.setClusterEntity(clusterEntity);
                   LOG.debug("Creating new " + configType + " config...");
@@ -809,7 +807,7 @@ public class UpgradeCatalog150 extends 
AbstractUpgradeCatalog {
   }
 
   private String getPostgresSequenceUpgradeQuery() {
-    return "INSERT INTO ambari_sequences(sequence_name, \"value\") " +
+    return "INSERT INTO ambari_sequences(sequence_name, sequence_value) " +
       "SELECT 'cluster_id_seq', nextval('clusters_cluster_id_seq') " +
       "UNION ALL " +
       "SELECT 'user_id_seq', nextval('users_user_id_seq') " +

Reply via email to