Browse Source

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
changes/12/694212/2
Idan Hefetz 3 weeks ago
parent
commit
e2a792a1c7
2 changed files with 12 additions and 7 deletions
  1. +11
    -6
      vitrage/entity_graph/processor/processor.py
  2. +1
    -1
      vitrage/tests/functional/evaluator/test_action_executor.py

+ 11
- 6
vitrage/entity_graph/processor/processor.py 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)

+ 1
- 1
vitrage/tests/functional/evaluator/test_action_executor.py 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):

Loading…
Cancel
Save