Repository: ambari Updated Branches: refs/heads/trunk 2d4e49f77 -> 765b259e5
AMBARI-16635. Ambari upgrade fails because of new [cluster_type] column.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/765b259e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/765b259e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/765b259e Branch: refs/heads/trunk Commit: 765b259e505cc71fe15ff368ed2fe337c8067052 Parents: 2d4e49f Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Authored: Thu May 12 19:19:26 2016 +0300 Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com> Committed: Thu May 12 19:19:26 2016 +0300 ---------------------------------------------------------------------- .../ambari/server/orm/entities/ViewInstanceEntity.java | 6 +++--- .../apache/ambari/server/upgrade/UpgradeCatalog240.java | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/765b259e/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java index ba5774f..98bafdd 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java @@ -126,9 +126,9 @@ public class ViewInstanceEntity implements ViewInstanceDefinition { /** * Cluster Type for cluster Handle */ - @Enumerated(EnumType.STRING) - @Column(name = "cluster_type", nullable = false) - private ClusterType clusterType; + @Enumerated(value = EnumType.STRING) + @Column(name = "cluster_type", nullable = false, length = 100) + private ClusterType clusterType = ClusterType.LOCAL_AMBARI; /** * Visible flag. http://git-wip-us.apache.org/repos/asf/ambari/blob/765b259e/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java index 3547ad3..1f3b1d3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java @@ -37,8 +37,6 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; -import com.google.common.reflect.TypeToken; -import com.google.gson.Gson; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.controller.AmbariManagementController; @@ -46,9 +44,9 @@ import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo; import org.apache.ambari.server.orm.dao.AlertDefinitionDAO; import org.apache.ambari.server.orm.dao.ClusterDAO; import org.apache.ambari.server.orm.dao.PermissionDAO; -import org.apache.ambari.server.orm.dao.PrivilegeDAO; import org.apache.ambari.server.orm.dao.PrincipalDAO; import org.apache.ambari.server.orm.dao.PrincipalTypeDAO; +import org.apache.ambari.server.orm.dao.PrivilegeDAO; import org.apache.ambari.server.orm.dao.ResourceTypeDAO; import org.apache.ambari.server.orm.dao.RoleAuthorizationDAO; import org.apache.ambari.server.orm.dao.UserDAO; @@ -75,15 +73,17 @@ import org.apache.ambari.server.state.ServiceInfo; import org.apache.ambari.server.state.StackId; import org.apache.ambari.server.state.StackInfo; import org.apache.ambari.server.state.State; -import org.apache.ambari.view.ClusterType; import org.apache.ambari.server.state.stack.WidgetLayout; import org.apache.ambari.server.state.stack.WidgetLayoutInfo; +import org.apache.ambari.view.ClusterType; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.support.JdbcUtils; import com.google.common.collect.Lists; +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -292,7 +292,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog { dbAccessor.addFKConstraint(VIEWINSTANCE_TABLE, "FK_instance_url_id", SHORT_URL_COLUMN, VIEWURL_TABLE, URL_ID_COLUMN, false); dbAccessor.addColumn(VIEWINSTANCE_TABLE, - new DBColumnInfo(CLUSTER_TYPE_COLUMN, String.class, 100, ClusterType.LOCAL_AMBARI, false)); + new DBColumnInfo(CLUSTER_TYPE_COLUMN, String.class, 100, ClusterType.LOCAL_AMBARI.name(), false)); } private void updateClusterTableDDL() throws SQLException {