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

Review request for Ambari, Alejandro Fernandez, Jonathan Hurley, Nate Cole, and 
Sid Wagle.


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


Repository: ambari


Description
-------

There is a problem in that the JPA component state entities are cached as part 
of the ServiceComponentHostImpl.


    private HostComponentStateEntity stateEntity;
    private HostComponentDesiredStateEntity desiredStateEntity;


Also in HostImpl ...


    private HostEntity hostEntity;
    private HostStateEntity hostStateEntity;


The cached entities can be come detached and stale.

1 The JOURNALNODE component is added and a component state entity is created 
and persisted for it.  Each state entity is associated with a host entity which 
is associated with all of its components (including SECONDARY_NAMENODE, in this 
case).  After persisting, the entity becomes detached.
2 The SECONDARY_NAMENODE component is removed.  The component state row is 
removed from the database via JPA.  The associated host entity is updated to 
remove the deleted component state entity reference.
3 The JOURNALNODE component state entity refers to a different (detached) host 
entity instance so it still refers back to the deleted component state entity 
reference for the SECONDARY_NAMENODE.
4 The heartbeat handler is called which updates the state of the components.  
When it gets to the JOURNALNODE, the associated stale host entity is persisted 
along with the now deleted SECONDARY_NAMENODE component state entity.  In other 
words, the entity manager sees the difference and thinks that the deleted 
component is being added back.  The row is added back to the database.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java 
13d8d86 
  
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
 8d132ea 
  
ambari-server/src/test/java/org/apache/ambari/server/state/host/HostImplTest.java
 PRE-CREATION 

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


Testing
-------

Manual test to ensure that SNN is deleted and that upgrade can continue through 
finalize.

Added some new unit tests (more needed).

All existing tests pass ...


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34:38 min
[INFO] Finished at: 2015-03-03T22:50:21-05:00
[INFO] Final Memory: 42M/638M
[INFO] ------------------------------------------------------------------------


Thanks,

Tom Beerbower

Reply via email to