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

(Updated March 24, 2016, 9:42 a.m.)


Review request for Ambari, Jonathan Hurley, Nate Cole, Sumit Mohanty, Sebastian 
Toader, and Sid Wagle.


Changes
-------

Added a unit test to simulate scenario that caused the NPE.


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


Repository: ambari


Description
-------

AMBARI-15544: Creating multinode cluster using Blueprints fails.

** Issue **:

This issue happens when there are multiple agents running before deployment 
happens. During registration, there is no cluster, so the recovery 
configuration is not obtained. Subsequently, when hosts become a part of a 
cluster, agents attempt to get the recovery configuration during the 
heartbeats. The first agent successfully gets the configuration because the 
timestamp map is empty. When the next agent heartbeats, it checks to see if the 
configuration is stale. While there is an entry for the cluster name in the 
timestamp map created by the previous agent, there is no hostname entry for the 
current agent which causes the timestamp returned for that hostname to be null.

** Fix **:

Check the returned Timestamp object for null before accessing it.


Diffs (updated)
-----

  
ambari-server/src/main/java/org/apache/ambari/server/agent/RecoveryConfigHelper.java
 dca4a9b9a32377a2d7d620d6f939e7250cc40590 
  
ambari-server/src/test/java/org/apache/ambari/server/configuration/RecoveryConfigHelperTest.java
 f7c85b6d514cee908f07513e62874ed9ed393fa4 

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


Testing
-------

** 1. mvn clean install -DskipTests **

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Ambari Main ....................................... SUCCESS [5.199s]
[INFO] Apache Ambari Project POM ......................... SUCCESS [0.037s]
[INFO] Ambari Web ........................................ SUCCESS [31.250s]
[INFO] Ambari Views ...................................... SUCCESS [1.140s]
[INFO] Ambari Admin View ................................. SUCCESS [5.628s]
[INFO] ambari-metrics .................................... SUCCESS [0.355s]
[INFO] Ambari Metrics Common ............................. SUCCESS [0.476s]
[INFO] Ambari Metrics Hadoop Sink ........................ SUCCESS [1.067s]
[INFO] Ambari Metrics Flume Sink ......................... SUCCESS [0.562s]
[INFO] Ambari Metrics Kafka Sink ......................... SUCCESS [0.595s]
[INFO] Ambari Metrics Storm Sink ......................... SUCCESS [1.437s]
[INFO] Ambari Metrics Collector .......................... SUCCESS [6.724s]
[INFO] Ambari Metrics Monitor ............................ SUCCESS [2.089s]
[INFO] Ambari Metrics Grafana ............................ SUCCESS [0.862s]
[INFO] Ambari Metrics Assembly ........................... SUCCESS [1:17.652s]
[INFO] Ambari Server ..................................... SUCCESS [2:31.754s]
[INFO] Ambari Functional Tests ........................... SUCCESS [1.281s]
[INFO] Ambari Agent ...................................... SUCCESS [22.491s]
[INFO] Ambari Client ..................................... SUCCESS [0.061s]
[INFO] Ambari Python Client .............................. SUCCESS [1.008s]
[INFO] Ambari Groovy Client .............................. SUCCESS [2.175s]
[INFO] Ambari Shell ...................................... SUCCESS [0.058s]
[INFO] Ambari Python Shell ............................... SUCCESS [0.694s]
[INFO] Ambari Groovy Shell ............................... SUCCESS [1.028s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5:16.311s
[INFO] Finished at: Wed Mar 23 15:30:45 PDT 2016
[INFO] Final Memory: 261M/1167M
[INFO] ------------------------------------------------------------------------

** 2. Manual tests **

Deployed a cluster with 3 nodes, registered a blueprint and template. Noticed 
that the second agent now gets a **true** value for 
**isConfigStale(clusterName, hostName, timestamp)**, allowing it to get the 
recovery configuration.

** 3. Unit tests **


-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Picked up _JAVA_OPTIONS: -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true
Running org.apache.ambari.server.agent.TestHeartbeatHandler
Tests run: 24, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 54.831 sec - 
in org.apache.ambari.server.agent.TestHeartbeatHandler
Picked up _JAVA_OPTIONS: -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true
Running org.apache.ambari.server.configuration.RecoveryConfigHelperTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.43 sec - in 
org.apache.ambari.server.configuration.RecoveryConfigHelperTest

Results :

Tests run: 31, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:43.413s
[INFO] Finished at: Wed Mar 23 15:44:44 PDT 2016
[INFO] Final Memory: 55M/1019M
[INFO] ------------------------------------------------------------------------


Thanks,

Nahappan Somasundaram

Reply via email to