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

Review request for Ambari, Mahadev Konar, Oliver Szabo, and Sumit Mohanty.


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


Repository: ambari


Description
-------

This patch resolves AMBARI-17811. 

A NullPointerException could occur in the LoggingService class in the Ambari 
LogSearch integration. This would only happen if a REST client directly 
attempts to access the "searchEngine" REST resource when LogSearch is not 
running, or is not deployed in the current cluster. 

This patch implements the following:

1. Adds a check for a null LoggingRequestHelper instance when the associated 
factory method is invoked by the LoggingService. 
2. In the event that LogSearch is not running, this REST resource will now 
return an HTTP 404 "Not Found" error code, with a message in the entity body 
indicating that LogSearch is not running, and that this resource is not 
currently available. 
3. Adds a new unit test to verify the changes to the LoggingService class.
4. Minor code cleanup: removing un-necessary TO-DO's that don't reflect the 
state of this code anymore.


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java
 c93f7bd 
  
ambari-server/src/test/java/org/apache/ambari/server/api/services/LoggingServiceTest.java
 PRE-CREATION 

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


Testing
-------

1. With this patch applied, I deployed a 3-node vagrant cluster with HDFS, 
Yarn, and LogSearch selected, and verified that the cluster deploys 
successfully.  Verified that calls to the "searchEngine" REST resource no 
longer throw a NullPointerException when LogSearch is not running.  Verified 
that the expected search results are returned from the "searchEngine" resource 
when LogSearch is running. 
2. Ran the ambari-server "mvn clean test" suite.  

Results: 

"
Results :

Tests in error:
  ServicePropertiesTest.validatePropertySchemaOfServiceXMLs:48 ยป Ambari File 
/Us...

Tests run: 4551, Failures: 0, Errors: 1, Skipped: 34
"

This unit test failure was happening in trunk without this patch applied, so 
this must be a separate breakage in trunk, unrelated to this change.


Thanks,

Robert Nettleton

Reply via email to