You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Robert Nettleton (JIRA)" <ji...@apache.org> on 2016/01/11 21:11:39 UTC

[jira] [Created] (AMBARI-14615) Blueprints HostGroupComponentEntity primary key is incorrectly specified

Robert Nettleton created AMBARI-14615:
-----------------------------------------

             Summary: Blueprints HostGroupComponentEntity primary key is incorrectly specified
                 Key: AMBARI-14615
                 URL: https://issues.apache.org/jira/browse/AMBARI-14615
             Project: Ambari
          Issue Type: Bug
          Components: ambari-server
    Affects Versions: 2.2.1
            Reporter: Robert Nettleton
            Assignee: Robert Nettleton
            Priority: Critical
             Fix For: 2.2.1


The patch for AMBARI-14555 introduced an error into the entity defintion for the "hostgroup_component" table.  That patch added a new column, "provision_action", that was not mean to be added to the entity's primary key, but was added incorrectly.  

The "provision_action" column should not be marked with the "@Id" annotation, as it is not meant to be included in the entity's primary key. 

This accidental inclusion of the @Id anntation, combined with the fact that this column is null-able, can cause the following exception when attempting a Blueprint operation:

{code}
Local Exception Stack: 
Exception [EclipseLink-6044] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.QueryException
Exception Description: The primary key read from the row [ArrayRecord(
hostgroup_component.name => AMBARI_SERVER
hostgroup_component.provision_action => null
hostgroup_component.blueprint_name => hadoop_ha
hostgroup_component.hostgroup_name => headnode0)] during the execution of the query was detected to be null. Primary keys must not contain null.
Query: ReadAllQuery(name="components" referenceClass=HostGroupComponentEntity sql="SELECT name, provision_action, blueprint_name, hostgroup_name FROM hostgroup_component WHERE ((blueprint_name = ?) AND (hostgroup_name = ?))")
at org.eclipse.persistence.exceptions.QueryException.nullPrimaryKeyInBuildingObject(QueryException.java:922)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:715)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:1340)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:516)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1168)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1127)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:403)
at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3214)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:129)
at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:116)
at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)
at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:173)
at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:234)
at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)
at org.eclipse.persistence.indirection.IndirectList.buildDelegate(IndirectList.java:252)
at org.eclipse.persistence.indirection.IndirectList.getDelegate(IndirectList.java:423)
{code}

The fix is to remove the annotations that include this column in the primary key definition.  

I'm working on a fix for this, and will be submitting a patch shortly. 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)