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

(Updated July 2, 2015, 9:52 p.m.)


Review request for Ambari, Dmytro Sen, 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.

Also resolved conflict with fix for AMBARI-12063.


Diffs
-----

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

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


Testing (updated)
-------

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

mvn clean test

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47:22 min
[INFO] Finished at: 2015-07-02T17:44:50-04:00
[INFO] Final Memory: 58M/2036M
[INFO] ------------------------------------------------------------------------


Thanks,

Tom Beerbower

Reply via email to