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

(Updated May 5, 2016, 12:47 p.m.)


Review request for Ambari, Jonathan Hurley, Laszlo Puskas, Myroslav 
Papirkovskyy, and Sebastian Toader.


Changes
-------

- updated unit tests
- when I added the first service, a Service already exits occurred, that was 
because the service has already persited in the database, and 
ClusterImpl#loadServices() method fill the services map with the services 
(based on ClusterServiceEntity). loadServices() only does anything when 
services == null, so I moved loadServices() to the constructor (and removed 
every occurrence of it from other methods), only ClusterImpl#invalidateData() 
set services to null, so I put loadServices() to the end of that method. (it 
should work because every operation read-write locked there)
- another solution here: (instead of removing loadServices() methods) add an 
extra String pameter to loadServices() called e.g. newService, and that service 
would be filtered out when the method adding services to the services map.


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


Repository: ambari


Description
-------

2 different type of errors can occur during adding any new service to Ambari:

org.apache.ambari.server.AmbariException: Unable to create a default alert 
group for unknown service <SERVICE_NAME> in cluster

org.apache.ambari.server.ServiceNotFoundException: Service not found, 
clusterName=c1, serviceName=<SERVICE_NAME>

The reason is that: ServiceInstalledEvent can be handled quicker than 
ServiceImpl.persist() can finish


Diffs (updated)
-----

  
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
 47342f3 
  ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java 
487489b 
  
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
 f38c25a 
  ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java 
a3d05a9 
  ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java 
19146fd 
  
ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertEventPublisherTest.java
 d1b27a9 
  
ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
 1875ba6 

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


Testing
-------

Unit Testing is in progress..
FT: added new services about 10 times, has no any errors thrown.


Thanks,

Oliver Szabo

Reply via email to