Merge "Stop logging tracebacks when the replicator runs out of handoffs"

This commit is contained in:
Zuul 2018-01-24 02:27:32 +00:00 committed by Gerrit Code Review
commit c9264124f3
2 changed files with 7 additions and 4 deletions

View File

@ -485,11 +485,14 @@ class ObjectReplicator(Daemon):
self.logger.exception(_("Error syncing with node: %s") %
node)
self.suffix_count += len(local_hash)
except StopIteration:
self.logger.error('Ran out of handoffs while replicating '
'partition %s', job['partition'])
except (Exception, Timeout):
failure_devs_info.update(target_devs_info)
self._add_failure_stats(failure_devs_info)
self.logger.exception(_("Error syncing partition"))
finally:
self._add_failure_stats(failure_devs_info)
self.stats['success'] += len(target_devs_info - failure_devs_info)
self.partition_times.append(time.time() - begin)
self.logger.timing_since('partition.update.timing', begin)

View File

@ -1783,7 +1783,6 @@ class TestObjectReplicator(unittest.TestCase):
# count of attempts and call args
resp.status = 507
error = '%(replication_ip)s/%(device)s responded as unmounted'
expect = 'Error syncing partition: '
expected_listdir_calls = [
mock.call(int(job['partition']),
self.replicator.replication_cycle)
@ -1810,8 +1809,9 @@ class TestObjectReplicator(unittest.TestCase):
for node in job['policy'].object_ring.get_more_nodes(
int(job['partition'])):
expected.append(error % node)
# ... and finally it will exception out
expected.append(expect)
# ... and finally we get an error about running out of nodes
expected.append('Ran out of handoffs while replicating '
'partition %s' % job['partition'])
self.assertEqual(expected, error_lines)
self.assertEqual(len(self.replicator.partition_times), 1)
self.assertEqual(mock_http.call_count, len(ring._devs) - 1)