ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sid Wagle" <>
Subject Re: Review Request 41477: Fix stale cluster entity reference which results in merge issues
Date Fri, 18 Dec 2015 18:25:57 GMT

This is an automatically generated e-mail. To reply, visit:

(Updated Dec. 18, 2015, 6:25 p.m.)

Review request for Ambari, Jonathan Hurley, Myroslav Papirkovskyy, and Nate Cole.


- Made sure that the entity reference does not escape ClusterImpl and added documentation
for the same
- Made sure all mutations that use this reference make sure that it is refreshed and thereby
is attached to current session
- Added missing @Transactional on org.apache.ambari.server.state.cluster.ClusterImpl#setCurrentStackVersion
- Presently, the clusterEntity reference is used when the cluster is not yet persisted and
this is a valid use case but removing it would be a much larger refactoring effort and should
be done with a two digit version release eg: 2.3.0, in my opinion. Thereby still going with
the approach of refactoring all mutations on the in-memory object to refresh the reference
with latest information and leaving the getter alone.

Bugs: AMBARI-14411

Repository: ambari


*Preliminary patch*


Local Exception Stack: 
Exception [EclipseLink-6004] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.QueryException
Exception Description: The object [org.apache.ambari.server.orm.entities.ClusterConfigEntity@3646b3a8],
of class [class org.apache.ambari.server.orm.entities.ClusterConfigEntity], with identity
hashcode (System.identityHashCode()) [364,075,546], 
is not from this UnitOfWork object space, but the parent session's.  The object was never
registered in this UnitOfWork, 
but read from the parent session and related to an object registered in the UnitOfWork.  Ensure
that you are correctly
registering your objects.  If you are still having problems, you can use the UnitOfWork.validateObjectSpace()
method to 
help debug where the error occurred.  For more information, see the manual or FAQ.
	at org.eclipse.persistence.exceptions.QueryException.backupCloneIsOriginalFromParent(
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.getBackupClone(
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(
	at org.eclipse.persistence.mappings.CollectionMapping.buildElementUnitOfWorkClone(
	at org.eclipse.persistence.mappings.CollectionMapping.buildElementClone(
	at org.eclipse.persistence.internal.queries.ContainerPolicy.addNextValueFromIteratorInto(

Likely Cause:
Stale clusterEntity reference points to a detached entity which gets tried to be merged, the
Cascaded relationship throws the error on persist.

Diffs (updated)

  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ a0c6cfc



Unit testing in progress.


Sid Wagle

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message