ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hurley" <jhur...@hortonworks.com>
Subject Review Request 42319: Cannot Finalize Downgrade Due To Detached ClusterEntity
Date Thu, 14 Jan 2016 20:34:28 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42319/
-----------------------------------------------------------

Review request for Ambari, Alejandro Fernandez, Jayush Luniya, and Nate Cole.


Bugs: AMBARI-14674
    https://issues.apache.org/jira/browse/AMBARI-14674


Repository: ambari


Description
-------

RU HDP 2.2 to 2.4 downgrade results in:

{code}
java.lang.IllegalArgumentException: Can not refresh not managed object: org.apache.ambari.server.orm.entities.ClusterEntity@18126.
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.refresh(EntityManagerImpl.java:1024)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.refresh(EntityManagerImpl.java:929)
	at org.apache.ambari.server.orm.dao.ClusterDAO.refresh(ClusterDAO.java:309)
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:68)
	at org.apache.ambari.server.state.cluster.ClusterImpl.removeConfigurations(ClusterImpl.java:3216)
	at org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction.finalizeDowngrade(FinalizeUpgradeAction.java:314)
    ...
{code}

It seems like what's happening is that the ClusterEntity is being retrieved outside of a JPA
session. Although the ClusterDAO creates the session, it also ends it, leaving the Entity
detached. We should instead be refreshing this Entity within the bounds of the Transaction.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java 22bd8bb 
  ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java 3938e31

  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 3d00c29


Diff: https://reviews.apache.org/r/42319/diff/


Testing
-------

I performed several upgrades and downgrades and only saw the problem once. After my changes,
I haven't seen it since. I can artificially reproduce it by clearing the EM cache. Working
on a test now that tries to capture this scenario since it's the silent-but-deadly type.


Thanks,

Jonathan Hurley


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