Merge "Use separate name for HeaderKeyDict var vs list of response headers"
This commit is contained in:
commit
8ae1855072
@ -2441,10 +2441,12 @@ class ECObjectController(BaseObjectController):
|
|||||||
headers = []
|
headers = []
|
||||||
for getter, _parts_iter in bad_bucket.get_responses():
|
for getter, _parts_iter in bad_bucket.get_responses():
|
||||||
if best_bucket and best_bucket.durable:
|
if best_bucket and best_bucket.durable:
|
||||||
headers = HeaderKeyDict(getter.last_headers)
|
bad_resp_headers = HeaderKeyDict(getter.last_headers)
|
||||||
t_data_file = headers.get('X-Backend-Data-Timestamp')
|
t_data_file = bad_resp_headers.get(
|
||||||
t_obj = headers.get('X-Backend-Timestamp',
|
'X-Backend-Data-Timestamp')
|
||||||
headers.get('X-Timestamp'))
|
t_obj = bad_resp_headers.get(
|
||||||
|
'X-Backend-Timestamp',
|
||||||
|
bad_resp_headers.get('X-Timestamp'))
|
||||||
bad_ts = Timestamp(t_data_file or t_obj or '0')
|
bad_ts = Timestamp(t_data_file or t_obj or '0')
|
||||||
if bad_ts <= Timestamp(best_bucket.timestamp_str):
|
if bad_ts <= Timestamp(best_bucket.timestamp_str):
|
||||||
# We have reason to believe there's still good data
|
# We have reason to believe there's still good data
|
||||||
|
@ -2280,6 +2280,18 @@ class TestECObjController(ECObjectControllerMixin, unittest.TestCase):
|
|||||||
self.assertIn('Accept-Ranges', resp.headers)
|
self.assertIn('Accept-Ranges', resp.headers)
|
||||||
self.assertNotIn('Connection', resp.headers)
|
self.assertNotIn('Connection', resp.headers)
|
||||||
|
|
||||||
|
def test_GET_not_found_when_404_newer(self):
|
||||||
|
# if proxy receives a 404, it keeps waiting for other connections until
|
||||||
|
# max number of nodes in hopes of finding an object, but if 404 is
|
||||||
|
# more recent than a 200, then it should ignore 200 and return 404
|
||||||
|
req = swift.common.swob.Request.blank('/v1/a/c/o')
|
||||||
|
rest = 2 * self.policy.object_ring.replica_count - 2
|
||||||
|
codes = [200, 404] + [200] * rest
|
||||||
|
ts_iter = iter([1, 2] + [1] * rest)
|
||||||
|
with set_http_connect(*codes, timestamps=ts_iter):
|
||||||
|
resp = req.get_response(self.app)
|
||||||
|
self.assertEqual(resp.status_int, 404)
|
||||||
|
|
||||||
def _test_if_match(self, method):
|
def _test_if_match(self, method):
|
||||||
num_responses = self.policy.ec_ndata if method == 'GET' else 1
|
num_responses = self.policy.ec_ndata if method == 'GET' else 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user