AMBARI-7433. Issues on upgrade ambari 1.6.0->1.7.0(ambari+mysql)(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6eecc2c1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6eecc2c1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6eecc2c1 Branch: refs/heads/branch-alerts-dev Commit: 6eecc2c156cdb9058f3c098770590a00b6ab32ff Parents: f4ddfd6 Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Authored: Mon Sep 22 17:49:54 2014 +0300 Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Committed: Mon Sep 22 17:49:54 2014 +0300 ---------------------------------------------------------------------- .../apache/ambari/server/upgrade/UpgradeCatalog170.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6eecc2c1/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java index 1313a3f..db96aa7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java @@ -332,7 +332,7 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog { } } else if (Configuration.MYSQL_DB_NAME.equals(dbType)) { if (dbAccessor.tableHasData("clusterconfig")) { - dbAccessor.executeQuery("UPDATE viewinstance " + + dbAccessor.executeQuery("UPDATE clusterconfig " + "SET config_id = (SELECT @a := @a + 1 FROM (SELECT @a := 1) s)"); } } else if (Configuration.POSTGRES_DB_NAME.equals(dbType)) { @@ -370,7 +370,11 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog { populateConfigVersions(); - dbAccessor.setNullable("clusterconfig", "version", false); + if (Configuration.MYSQL_DB_NAME.equals(dbType)) { + dbAccessor.executeQuery("ALTER TABLE clusterconfig MODIFY version BIGINT NOT NULL"); + } else { + dbAccessor.setNullable("clusterconfig", "version", false); + } dbAccessor.executeQuery("ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag)", true); dbAccessor.executeQuery("ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version)", true); @@ -481,7 +485,7 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog { private void renameSequenceValueColumnName() throws AmbariException, SQLException { final String dbType = getDbType(); if (Configuration.MYSQL_DB_NAME.equals(dbType)) { - dbAccessor.executeQuery("ALTER TABLE ambari_sequences RENAME COLUMN value to sequence_value DECIMAL(38) NOT NULL"); + dbAccessor.executeQuery("ALTER TABLE ambari_sequences CHANGE value sequence_value DECIMAL(38) NOT NULL"); } else if (Configuration.DERBY_DB_NAME.equals(dbType)) { dbAccessor.executeQuery("RENAME COLUMN ambari_sequences.\"value\" to sequence_value"); } else if (Configuration.ORACLE_DB_NAME.equals(dbType)) {