From 0ad1b0cca1f2538ac8fe3ef27d9e06c102157000 Mon Sep 17 00:00:00 2001 From: oshritf Date: Thu, 17 Mar 2016 16:53:04 +0200 Subject: [PATCH] Container sync nodes shuffle cleanup Since commit "Update container sync to use internal client" get_object is done using internal_client and not directly on nodes which makes the block of code to shuffle the nodes redundant. Change-Id: I45a6dab05f6f87510cf73102b1ed191238209efe --- swift/container/sync.py | 7 +------ test/unit/container/test_sync.py | 3 --- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/swift/container/sync.py b/swift/container/sync.py index 7bb37f9225..1c2260e0f5 100644 --- a/swift/container/sync.py +++ b/swift/container/sync.py @@ -18,7 +18,7 @@ import os import uuid from swift import gettext_ as _ from time import ctime, time -from random import choice, random, shuffle +from random import choice, random from struct import unpack_from from eventlet import sleep, Timeout @@ -463,11 +463,6 @@ class ContainerSync(Daemon): else: # when sync'ing a live object, use ts_meta - this is the time # at which the source object was last modified by a PUT or POST - part, nodes = \ - self.get_object_ring(info['storage_policy_index']). \ - get_nodes(info['account'], info['container'], - row['name']) - shuffle(nodes) exc = None # look up for the newest one headers_out = {'X-Newest': True, diff --git a/test/unit/container/test_sync.py b/test/unit/container/test_sync.py index 42833ed161..9cb56d2d05 100644 --- a/test/unit/container/test_sync.py +++ b/test/unit/container/test_sync.py @@ -854,7 +854,6 @@ class TestContainerSync(unittest.TestCase): def _test_container_sync_row_put(self, realm, realm_key): orig_uuid = sync.uuid - orig_shuffle = sync.shuffle orig_put_object = sync.put_object try: class FakeUUID(object): @@ -862,7 +861,6 @@ class TestContainerSync(unittest.TestCase): hex = 'abcdef' sync.uuid = FakeUUID - sync.shuffle = lambda x: x ts_data = Timestamp(1.1) timestamp = Timestamp(1.2) @@ -1064,7 +1062,6 @@ class TestContainerSync(unittest.TestCase): self.assertLogMessage('error', 'ERROR Syncing') finally: sync.uuid = orig_uuid - sync.shuffle = orig_shuffle sync.put_object = orig_put_object def test_select_http_proxy_None(self):