ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower" <tbeerbo...@hortonworks.com>
Subject Review Request 36140: ConcurrentModificationException during add host to config group
Date Thu, 02 Jul 2015 18:34:53 GMT

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

Review request for Ambari, John Speidel and Robert Nettleton.


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


Repository: ambari


Description
-------

1. Provision a cluster with the attached blueprint. Ambari will create 2 config groups for
HDFS and YARN besides the default one.
2. Install the ambari-agent on a new host and let it register to Ambari
3. Add the newly registered host to the cluster (POST /clusters/${getClusterName()}/hosts)
4. Add the components from slave_1 host group to the new host
5. Try to add the new host to both HDFS:slave_1 and YARN:slave_1 host group

Stack trace ...


    javax.persistence.PersistenceException: java.util.ConcurrentModificationException
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(QueryImpl.java:308)
	at org.apache.ambari.server.orm.dao.DaoUtils.executeUpdate(DaoUtils.java:88)
	at org.apache.ambari.server.orm.dao.ConfigGroupConfigMappingDAO.removeAllByGroup(ConfigGroupConfigMappingDAO.java:96)
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:60)
	at org.apache.ambari.server.state.configgroup.ConfigGroupImpl.persistConfigMapping(ConfigGroupImpl.java:403)
    ...
    Caused by: java.util.ConcurrentModificationException
	at java.util.IdentityHashMap$IdentityHashMapIterator.nextIndex(IdentityHashMap.java:734)
	at java.util.IdentityHashMap$KeyIterator.next(IdentityHashMap.java:825)
	at org.eclipse.persistence.internal.sessions.CollectionChangeRecord.mergeRecord(CollectionChangeRecord.java:260)
	at org.eclipse.persistence.internal.sessions.ObjectChangeSet.mergeObjectChanges(ObjectChangeSet.java:740)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet.mergeObjectChanges(UnitOfWorkChangeSet.java:492)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet.mergeUnitOfWorkChangeSet(UnitOfWorkChangeSet.java:509)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:466)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:863)
	at org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush(QueryImpl.java:963)
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(QueryImpl.java:296)
    
The ConfigGroupImpl code was doing a merge of the associated config group entity at the begining
of the @Transactional annotated saveIfPersisted() method.  It seems to me that it serves no
purpose, especially since the entity is merged later in the transaction.  

    configGroupEntity = configGroupDAO.merge(configGroupEntity);
    
Removing that line seems to resolve the issue.  Also did a little refactoring to remove a
findById (to get the associated cluster entity) from the transactional scope.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
f347eb6 

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


Testing
-------

Manual tested with STR above.  Verified no CME and host successfully added.

mvn clean test

results pending


Thanks,

Tom Beerbower


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