-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/56552/
-----------------------------------------------------------
Review request for Ambari, Nate Cole and Robert Levas.
Bugs: AMBARI-19967
https://issues.apache.org/jira/browse/AMBARI-19967
Repository: ambari
Description
-------
The `AlertDataManagerTest` is exposing a problem with concurrent creation of
alert groups where an exception is thrown during concurrent UT creation due to
a UNIQUE violation:
javax.persistence.PersistenceException:
Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: Unique index or primary key
violation: "UNQ_ALERT_GROUP_0_INDEX_9 ON AMBARI.ALERT_GROUP(CLUSTER_ID,
GROUP_NAME) VALUES (1, 'HDFS', 2)"; SQL statement:
INSERT INTO alert_group (group_id, cluster_id, group_name, is_default,
service_name) VALUES (?, ?, ?, ?, ?) [23505-193]
Error Code: 23505
Call: INSERT INTO alert_group (group_id, cluster_id, group_name, is_default,
service_name) VALUES (?, ?, ?, ?, ?)
bind => [5 parameters bound]
at
org.apache.ambari.server.state.cluster.AlertDataManagerTest.setup(AlertDataManagerTest.java:149)
This is actually a problem both in the tests and the code for Ambari. We can
replace one of the locks and also synchronize the event publishing.
Diffs
-----
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java
703ff58
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java
3b9c97a
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java
1ec6d40
ambari-server/src/test/java/org/apache/ambari/server/state/cluster/AlertDataManagerTest.java
4ad93e6
Diff: https://reviews.apache.org/r/56552/diff/
Testing
-------
Results :
Tests run: 4912, Failures: 0, Errors: 0, Skipped: 39
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17:10 min
[INFO] Finished at: 2017-02-10T11:42:49-05:00
[INFO] Final Memory: 62M/662M
[INFO] ------------------------------------------------------------------------
Thanks,
Jonathan Hurley