> On Dec. 18, 2015, 12:27 p.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java,
> >  lines 114-141
> > <https://reviews.apache.org/r/41526/diff/3/?file=1170927#file1170927line114>
> >
> >     Looks like you're adding the same source to each entity - can you just 
> > put this in a loop and loop over the 2 entities?
> 
> Vitalyi Brodetskyi wrote:
>     Jonathan, i'm not sure i understand your note. I'm updaring sources for 
> two different alerts, hive metastore and hive server process laerts. In the 
> method you mentioned, i'm getting source from every alert definition, then 
> adding(if needed) "timeout" parameter and then set it to entity.

Each if-statement is performing the same work on each entity. You could do this:
```
List alertDefinitions = new 
ArrayList(hiveMetastoreProcessAlertDefinitionEntity, 
hiveServerProcessAlertDefinitionEntity);
for( AlertDefinitionEntity definition : alertDefinitions ){
  String source = definition.getSource();
  definition.setScheduleInterval(3);
  definition.setSource(addCheckCommandTimeoutParam(source));
  definition.setHash(UUID.randomUUID().toString());
  alertDefinitionDAO.merge(definition);
  LOG.info("Updated the alert definition {}", definition.getName());
}
```


- Jonathan


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


On Dec. 18, 2015, 11:41 a.m., Vitalyi Brodetskyi wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41526/
> -----------------------------------------------------------
> 
> (Updated Dec. 18, 2015, 11:41 a.m.)
> 
> 
> Review request for Ambari, Andrew Onischuk, Dmytro Sen, Jonathan Hurley, and 
> Sumit Mohanty.
> 
> 
> Bugs: AMBARI-14424
>     https://issues.apache.org/jira/browse/AMBARI-14424
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> For Hive metastore and server alerts
> 1) Change default timeout to 60 seconds
> 2) Make this a configurable script param, so people can pass this in
> 
> 
> Diffs
> -----
> 
>   
> ambari-common/src/main/python/resource_management/libraries/functions/hive_check.py
>  55fd6bd 
>   
> ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
>  5e22f71 
>   
> ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
>  PRE-CREATION 
>   
> ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/alerts.json 
> 55e3f78 
>   
> ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_metastore.py
>  c7a9102 
>   
> ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py
>  a04c2a6 
>   
> ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
>  PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/41526/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> 
> Thanks,
> 
> Vitalyi Brodetskyi
> 
>

Reply via email to