Merge "ec: Don't copy EC metadata to replicated objects"

This commit is contained in:
Zuul 2021-04-28 21:27:13 +00:00 committed by Gerrit Code Review
commit ae06540381
2 changed files with 12 additions and 1 deletions

View File

@ -3106,6 +3106,12 @@ class ECObjectController(BaseObjectController):
if resp.status_int == HTTP_REQUESTED_RANGE_NOT_SATISFIABLE:
resp.headers['Content-Range'] = 'bytes */%s' % resp.headers[
'X-Object-Sysmeta-Ec-Content-Length']
ec_headers = [header for header in resp.headers
if header.lower().startswith('x-object-sysmeta-ec-')]
for header in ec_headers:
# clients (including middlewares) shouldn't need to care about
# this implementation detail
del resp.headers[header]
def _fix_ranges(self, req, resp):
# Has to be called *before* kickoff()!

View File

@ -2308,12 +2308,17 @@ class TestECObjController(ECObjectControllerMixin, unittest.TestCase):
def test_GET_simple(self):
req = swift.common.swob.Request.blank('/v1/a/c/o')
get_statuses = [200] * self.policy.ec_ndata
get_hdrs = [{'Connection': 'close'}] * self.policy.ec_ndata
get_hdrs = [{
'Connection': 'close',
'X-Object-Sysmeta-Ec-Scheme': self.policy.ec_scheme_description,
}] * self.policy.ec_ndata
with set_http_connect(*get_statuses, headers=get_hdrs):
resp = req.get_response(self.app)
self.assertEqual(resp.status_int, 200)
self.assertIn('Accept-Ranges', resp.headers)
self.assertNotIn('Connection', resp.headers)
self.assertFalse([h for h in resp.headers
if h.lower().startswith('x-object-sysmeta-ec-')])
def test_GET_not_found_when_404_newer(self):
# if proxy receives a 404, it keeps waiting for other connections until