-
Notifications
You must be signed in to change notification settings - Fork 117
FALCON-2229 BacklogEmitterMetricService fix for deleting entities' instances in case of removal of SLA or deletion of entity #335
Changes from 25 commits
9e68a57
a94d4fe
271318b
1a4dcd2
c065566
1bb8d3c
d6dc8bf
a178805
d0393e9
250cc46
48f6afa
bbca081
9cf36e9
f96a084
e0ad358
194f36a
0a433fb
b1546ed
4a2e23e
0cf9af6
456d4ee
089b10d
cc28658
3558af3
5cb25e8
22a80b6
280a079
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* Backlog Metric Store for entitties. | ||
* Backlog Metric Store for entities' backlog instances. | ||
*/ | ||
public class BacklogMetricStore { | ||
|
||
|
@@ -70,18 +70,19 @@ public synchronized void deleteMetricInstance(String entityName, String cluster, | |
q.setParameter("clusterName", cluster); | ||
q.setParameter("nominalTime", nominalTime); | ||
q.setParameter("entityType", entityType.name()); | ||
try{ | ||
try { | ||
q.executeUpdate(); | ||
} finally { | ||
commitAndCloseTransaction(entityManager); | ||
} | ||
} | ||
|
||
public void deleteEntityInstance(String entityName){ | ||
public void deleteEntityInstance(String entityName, String entityType) { | ||
EntityManager entityManager = getEntityManager(); | ||
beginTransaction(entityManager); | ||
Query q = entityManager.createNamedQuery(PersistenceConstants.DELETE_ALL_BACKLOG_ENTITY_INSTANCES); | ||
q.setParameter("entityName", entityName); | ||
q.setParameter("entityType", entityType); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to add clusterName also here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no. In a colo on removal of an entity, its removed from all the clusters, which means deletion of the instances across the clusters per colo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but the query for the PersistenceConstants DELETE_ALL_BACKLOG_ENTITY_INSTANCES expects three variables. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching it. I had missed it. I will remove cluster from the named query. |
||
try { | ||
q.executeUpdate(); | ||
} finally { | ||
|
@@ -110,7 +111,7 @@ public Map<Entity, List<MetricInfo>> getAllInstances() throws FalconException { | |
if (CollectionUtils.isEmpty(result)) { | ||
return null; | ||
} | ||
} finally{ | ||
} finally { | ||
entityManager.close(); | ||
} | ||
|
||
|
@@ -121,7 +122,7 @@ public Map<Entity, List<MetricInfo>> getAllInstances() throws FalconException { | |
if (!backlogMetrics.containsKey(entity)) { | ||
backlogMetrics.put(entity, new ArrayList<MetricInfo>()); | ||
} | ||
List<MetricInfo> metrics = backlogMetrics.get(entity); | ||
List<MetricInfo> metrics = backlogMetrics.get(entity); | ||
MetricInfo metricInfo = new MetricInfo(BacklogMetricEmitterService.DATE_FORMAT.get() | ||
.format(backlogMetricBean.getNominalTime()), | ||
backlogMetricBean.getClusterName()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change the method name to deleteEntityBackLogInstances?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. I will change it.