Merge "consistency should not delete events"
This commit is contained in:
commit
89a7efcb12
@ -43,17 +43,15 @@ class ConsistencyEnforcer(object):
|
||||
|
||||
def periodic_process(self):
|
||||
try:
|
||||
LOG.debug('Consistency Periodic Process - Started')
|
||||
LOG.info('Periodic consistency check..')
|
||||
|
||||
# remove vitrage_is_deleted=True entities
|
||||
old_deleted_entities = self._find_old_deleted_entities()
|
||||
LOG.debug('Found %s vertices to be deleted by consistency service'
|
||||
': %s', len(old_deleted_entities), old_deleted_entities)
|
||||
self._push_events_to_queue(old_deleted_entities,
|
||||
GraphAction.REMOVE_DELETED_ENTITY)
|
||||
|
||||
# mark stale entities as vitrage_is_deleted=True
|
||||
stale_entities = self._find_stale_entities()
|
||||
stale_entities = self._find_placeholder_entities()
|
||||
LOG.debug('Found %s vertices to be marked as deleted by '
|
||||
'consistency service: %s', len(stale_entities),
|
||||
stale_entities)
|
||||
@ -63,14 +61,15 @@ class ConsistencyEnforcer(object):
|
||||
LOG.exception(
|
||||
'Error in deleting vertices from entity_graph: %s', e)
|
||||
|
||||
def _find_stale_entities(self):
|
||||
def _find_placeholder_entities(self):
|
||||
vitrage_sample_tstmp = str(utcnow() - timedelta(
|
||||
seconds=2 * self.conf.datasources.snapshots_interval))
|
||||
query = {
|
||||
'and': [
|
||||
{'!=': {VProps.VITRAGE_TYPE: VITRAGE_DATASOURCE}},
|
||||
{'<': {VProps.VITRAGE_SAMPLE_TIMESTAMP: vitrage_sample_tstmp}},
|
||||
{'==': {VProps.VITRAGE_IS_DELETED: False}}
|
||||
{'==': {VProps.VITRAGE_IS_DELETED: False}},
|
||||
{'==': {VProps.VITRAGE_IS_PLACEHOLDER: True}},
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class TestConsistencyFunctional(TestFunctionalBase):
|
||||
self.assertEqual(self.NUM_INSTANCES - 3, len(instance_vertices))
|
||||
self.assertEqual(self._num_total_expected_vertices() - 3,
|
||||
len(self.processor.entity_graph.get_vertices()))
|
||||
self.assertEqual(6, len(deleted_instance_vertices))
|
||||
self.assertEqual(3, len(deleted_instance_vertices))
|
||||
|
||||
def _periodic_process_setup_stage(self, consistency_interval):
|
||||
self._create_processor_with_graph(self.conf, processor=self.processor)
|
||||
|
Loading…
Reference in New Issue
Block a user