ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower" <>
Subject Review Request 31721: Caching of JPA entities causes SECONDARY_NAMENODE component to be re-persisted after NN HA enabling
Date Wed, 04 Mar 2015 04:18:08 GMT

This is an automatically generated e-mail. To reply, visit:

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

Bugs: AMBARI-9918

Repository: ambari


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.


  ambari-server/src/main/java/org/apache/ambari/server/state/host/ 13d8d86 
  ambari-server/src/test/java/org/apache/ambari/server/state/host/ PRE-CREATION



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] ------------------------------------------------------------------------
[INFO] Total time: 34:38 min
[INFO] Finished at: 2015-03-03T22:50:21-05:00
[INFO] Final Memory: 42M/638M
[INFO] ------------------------------------------------------------------------


Tom Beerbower

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