Tom Beerbower created AMBARI-9918:
-------------------------------------

             Summary: Caching of JPA entities causes SECONDARY_NAMENODE 
component to be re-persisted after NN HA enabling
                 Key: AMBARI-9918
                 URL: https://issues.apache.org/jira/browse/AMBARI-9918
             Project: Ambari
          Issue Type: Bug
            Reporter: Tom Beerbower
            Assignee: Tom Beerbower
             Fix For: 2.0.0


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

{code}
  private HostComponentStateEntity stateEntity;
  private HostComponentDesiredStateEntity desiredStateEntity;
{code}

Also in HostImpl ...

{code}
  private HostEntity hostEntity;
  private HostStateEntity hostStateEntity;
{code}

The cached entities can be come detached and stale.

# 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.
# 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.
# 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.
# 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.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to