summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2022-09-30 08:42:39 -0700
committerTim Burke <tim.burke@gmail.com>2022-09-30 08:42:43 -0700
commitc87278aba8985447a4a1746e66b4f785a602f8ab (patch)
tree5b5979502874457a39dfa2bbe3c97f0d263b1c73
parent99b0b3d1ec15e93a98dd7ddd1c24e1da9650f64b (diff)
downloadswift-c87278aba8985447a4a1746e66b4f785a602f8ab.tar.gz
object-replicator: Count sync failures in update_deleted
Previously, we would track the failure in the failure_devs_info set, but not actually use it to update failure stats unless some other exception occurred. Change-Id: Ib28196191275022fcb74d2365910240cc7c61c3a
-rw-r--r--swift/obj/replicator.py2
-rw-r--r--test/unit/obj/test_replicator.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py
index 45d8a3f85..8b5100aae 100644
--- a/swift/obj/replicator.py
+++ b/swift/obj/replicator.py
@@ -592,8 +592,8 @@ class ObjectReplicator(Daemon):
self.logger.increment('partition.lock-failure.count')
except (Exception, Timeout):
self.logger.exception("Error syncing handoff partition")
- stats.add_failure_stats(failure_devs_info)
finally:
+ stats.add_failure_stats(failure_devs_info)
target_devs_info = set([(target_dev['replication_ip'],
target_dev['device'])
for target_dev in job['nodes']])
diff --git a/test/unit/obj/test_replicator.py b/test/unit/obj/test_replicator.py
index 53eac6db2..25fe04275 100644
--- a/test/unit/obj/test_replicator.py
+++ b/test/unit/obj/test_replicator.py
@@ -1004,6 +1004,7 @@ class TestObjectReplicator(unittest.TestCase):
# stopped after handoffs!
self.assertEqual(1, self.replicator.handoffs_remaining)
self.assertEqual(8, self.replicator.job_count)
+ self.assertEqual(self.replicator.total_stats.failure, 1)
# in addition to the two update_deleted jobs as many as "concurrency"
# jobs may have been spawned into the pool before the failed
# update_deleted job incremented handoffs_remaining and caused the