From 596042b9c778114dcfab1670e1ca40aa3a8c71ee Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Thu, 12 Feb 2015 16:15:42 -0800 Subject: [PATCH] Minor cleanup post efficent multi-region replication One log line had a typo, and I refactored the per object cleanup code out of update_deleted into the per object hashdir cleanup method. Change-Id: I19d03d0706a75bd8ec2fe327a1eb1b5ec36de6d2 --- swift/obj/replicator.py | 15 ++++++--------- test/unit/obj/test_replicator.py | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index 020bfc95cd..c06586c079 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -274,14 +274,9 @@ class ObjectReplicator(Daemon): all(responses) if not suffixes or delete_handoff: if delete_objs: - self.logger.info(_("Removing %s objecs"), + self.logger.info(_("Removing %s objects"), len(delete_objs)) - delete_objs = [ - storage_directory(job['obj_path'], - job['partition'], - object_hash) - for object_hash in delete_objs] - self.delete_handoff_paths(delete_objs) + self.delete_handoff_objs(job, delete_objs) else: self.logger.info(_("Removing partition: %s"), job['path']) tpool.execute( @@ -292,8 +287,10 @@ class ObjectReplicator(Daemon): self.partition_times.append(time.time() - begin) self.logger.timing_since('partition.delete.timing', begin) - def delete_handoff_paths(self, paths): - for object_path in paths: + def delete_handoff_objs(self, job, delete_objs): + for object_hash in delete_objs: + object_path = storage_directory(job['obj_path'], job['partition'], + object_hash) tpool.execute(shutil.rmtree, object_path, ignore_errors=True) suffix_dir = dirname(object_path) try: diff --git a/test/unit/obj/test_replicator.py b/test/unit/obj/test_replicator.py index 0417194cd4..47288b9ed2 100644 --- a/test/unit/obj/test_replicator.py +++ b/test/unit/obj/test_replicator.py @@ -684,7 +684,7 @@ class TestObjectReplicator(unittest.TestCase): self.call_nums = 0 self.conf['sync_method'] = 'ssync' - def _fake_ssync(node, job, suffixes): + def _fake_ssync(node, job, suffixes, **kwags): success = False ret_val = [] if self.call_nums == 2: