summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2019-04-25 12:57:16 -0700
committerTim Burke <tim.burke@gmail.com>2019-10-18 13:43:58 -0700
commit657ee1092d8caeb0b9be8a011741cfcdfba6dc99 (patch)
tree1c92eb4fc16ebef574fdcd5883b23b6d294cd15b
parent3d5f7aa41db7dd06e0965bd7494f2b23e7caf3f3 (diff)
downloadswift-657ee1092d8caeb0b9be8a011741cfcdfba6dc99.tar.gz
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)
-rw-r--r--swift/container/replicator.py2
1 files changed, 1 insertions, 1 deletions
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')))