From 657ee1092d8caeb0b9be8a011741cfcdfba6dc99 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 25 Apr 2019 12:57:16 -0700 Subject: sharding: better handle get_shard_ranges failures The contract for ReplConnection.replicate() is that if we can get a response, we return it, and if we can't (because of a timeout, or a socket error, or some other http_client error like BadStatusLine), we return None to indicate the error. Previously, _fetch_and_merge_shard_ranges() always assumed the response would have a `status` attribute and raise an AttributeError when response was None. Now it will treat that case like other get_shard_range failures. Change-Id: I023b8a46c06e9a2755b5aa890a7992ef9633cba9 (cherry picked from commit bc5f4c061122aee5965cfb055beb3cb079073536) --- swift/container/replicator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/container/replicator.py b/swift/container/replicator.py index 1077e7f4e..67a988432 100644 --- a/swift/container/replicator.py +++ b/swift/container/replicator.py @@ -138,7 +138,7 @@ class ContainerReplicator(db_replicator.Replicator): def _fetch_and_merge_shard_ranges(self, http, broker): with Timeout(self.node_timeout): response = http.replicate('get_shard_ranges') - if is_success(response.status): + if response and is_success(response.status): broker.merge_shard_ranges(json.loads( response.data.decode('ascii'))) -- cgit v1.2.1