Bugfix - Processor check if neighbors are newer before updating them

The bug is that the processor may update a vertex to an older timestamp
 than the existing.

Change-Id: I67e4c59fc1170b07e8f7c50416de8e8598152f09
This commit is contained in:
Idan Hefetz 2019-11-14 08:38:18 +00:00
parent 8122f24ebe
commit e2a792a1c7
2 changed files with 12 additions and 7 deletions

View File

@ -219,12 +219,17 @@ class Processor(processor.ProcessorBase):
for (vertex, edge) in neighbors:
graph_vertex = self.entity_graph.get_vertex(vertex.vertex_id)
if not graph_vertex or not PUtils.is_deleted(graph_vertex):
LOG.debug("Updates vertex: %s", vertex)
self._calculate_vitrage_aggregated_values(vertex, action)
PUtils.update_entity_graph_vertex(self.entity_graph,
graph_vertex,
vertex)
if graph_vertex and not PUtils.is_newer_vertex(graph_vertex,
vertex):
LOG.warning("Neighbor update event arrived later than "
"expected - graph_vertex: %s --- "
"updated_vertex: %s", graph_vertex, vertex)
else:
LOG.debug("Updates vertex: %s", vertex)
self._calculate_vitrage_aggregated_values(vertex, action)
PUtils.update_entity_graph_vertex(self.entity_graph,
graph_vertex,
vertex)
if edge not in valid_edges:
LOG.debug("Updates edge: %s", edge)
self.entity_graph.update_edge(edge)

View File

@ -354,7 +354,7 @@ class TestActionExecutor(TestFunctionalBase, TestConfiguration):
NProps.STATUS_INFO: 'test test test',
DSProp.DATASOURCE_ACTION: DatasourceAction.SNAPSHOT,
DSProp.ENTITY_TYPE: NAGIOS_DATASOURCE,
DSProp.SAMPLE_DATE: '2016-02-07 15:26:04'}
DSProp.SAMPLE_DATE: '2016-02-07T15:26:04Z'}
@staticmethod
def _get_vitrage_add_vertex_event(target_vertex, alarm_name, severity):