From 888142960ef4136c53260f926edfb983adcad81a Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Tue, 31 May 2022 13:14:13 -0700 Subject: [PATCH] object-replicator: Remove some dead code Nothing ever looked at ObjectReplicator.my_replication_ips, and only one test was depending on the ring-loading side-effect down into replicate(). So we can just fix the test and rip it out. Change-Id: I82447bf9b2883c16b6e32f92179fc496f4e86dea --- swift/obj/replicator.py | 12 ------------ test/unit/obj/test_replicator.py | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index 38bc6bd8b0..0984d85400 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -213,17 +213,6 @@ class ObjectReplicator(Daemon): self.replicator_workers, os.getpid())) - def _get_my_replication_ips(self): - my_replication_ips = set() - ips = whataremyips() - for policy in self.policies: - self.load_object_ring(policy) - for local_dev in [dev for dev in policy.object_ring.devs - if dev and dev['replication_ip'] in ips and - dev['replication_port'] == self.port]: - my_replication_ips.add(local_dev['replication_ip']) - return list(my_replication_ips) - def _child_process_reaper(self): """ Consume processes from self._child_process_reaper_queue and wait() for @@ -951,7 +940,6 @@ class ObjectReplicator(Daemon): self.last_replication_count = 0 self.replication_cycle = (self.replication_cycle + 1) % 10 self.partition_times = [] - self.my_replication_ips = self._get_my_replication_ips() self.all_devs_info = set() self.handoffs_remaining = 0 diff --git a/test/unit/obj/test_replicator.py b/test/unit/obj/test_replicator.py index 494d430b0e..d508213a19 100644 --- a/test/unit/obj/test_replicator.py +++ b/test/unit/obj/test_replicator.py @@ -2287,6 +2287,7 @@ class TestObjectReplicator(unittest.TestCase): def test_replicate_skipped_partpower_increase(self): _create_test_rings(self.testdir, next_part_power=4) + self.replicator.get_local_devices() # refresh rings self.replicator.replicate() self.assertEqual(0, self.replicator.job_count) self.assertEqual(0, self.replicator.total_stats.attempted)