AMBARI-22267 - Version registration failure during patch upgrade + Debian + Oracle run (jonathanhurley)
(cherry picked from commit 1c34fe1f0cec43733e1d87015efacb596b6de143) Change-Id: I4f0d2964b6ed7d87574fface16f09389cac1909d Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2746fa91 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2746fa91 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2746fa91 Branch: refs/heads/AMBARI-2.6.0.0 Commit: 2746fa91e4f42cfea524c81e66b84faadc763c05 Parents: a7c80f8 Author: Jonathan Hurley <jhur...@hortonworks.com> Authored: Wed Oct 18 19:27:34 2017 -0400 Committer: Zuul <rel...@hortonworks.com> Committed: Thu Oct 19 22:02:29 2017 -0700 ---------------------------------------------------------------------- .../ambari/server/orm/entities/RepositoryVersionEntity.java | 5 +---- .../ambari/server/orm/entities/ServiceDesiredStateEntity.java | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2746fa91/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java index edfe494..cee7028 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java @@ -21,13 +21,11 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -94,7 +92,7 @@ import com.google.inject.Provider; query = "SELECT repositoryVersion FROM RepositoryVersionEntity repositoryVersion WHERE repositoryVersion.version = :version ORDER BY repositoryVersion.id DESC"), @NamedQuery( name = "findByServiceDesiredVersion", - query = "SELECT DISTINCT sd.desiredRepositoryVersion from ServiceDesiredStateEntity sd WHERE sd.desiredRepositoryVersion IN ?1") }) + query = "SELECT repositoryVersion FROM RepositoryVersionEntity repositoryVersion WHERE repositoryVersion IN (SELECT DISTINCT sd1.desiredRepositoryVersion FROM ServiceDesiredStateEntity sd1 WHERE sd1.desiredRepositoryVersion IN ?1)") }) @StaticallyInject public class RepositoryVersionEntity { private static Logger LOG = LoggerFactory.getLogger(RepositoryVersionEntity.class); @@ -131,7 +129,6 @@ public class RepositoryVersionEntity { @Enumerated(value = EnumType.STRING) private RepositoryType type = RepositoryType.STANDARD; - @Basic(fetch=FetchType.LAZY) @Lob @Column(name="version_xml", insertable = true, updatable = true) private String versionXml; http://git-wip-us.apache.org/repos/asf/ambari/blob/2746fa91/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java index 0124d3e..3ef0768 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java @@ -40,20 +40,20 @@ import org.apache.commons.lang.builder.EqualsBuilder; @Entity public class ServiceDesiredStateEntity { - @Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10) @Id + @Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10) private Long clusterId; - @Column(name = "service_name", nullable = false, insertable = false, updatable = false) @Id + @Column(name = "service_name", nullable = false, insertable = false, updatable = false) private String serviceName; @Column(name = "desired_state", nullable = false, insertable = true, updatable = true) @Enumerated(value = EnumType.STRING) private State desiredState = State.INIT; - @Column(name = "desired_host_role_mapping", nullable = false, insertable = true, updatable = true, length = 10) @Basic + @Column(name = "desired_host_role_mapping", nullable = false, insertable = true, updatable = true, length = 10) private int desiredHostRoleMapping = 0; @Column(name = "maintenance_state", nullable = false, insertable = true, updatable = true)