ec: Don't copy EC metadata to replicated objects

Change-Id: Ia6c1b75a24d2b46720d7a3b6e3a126444a38be0e
Closes-Bug: #1885857
This commit is contained in:
Tim Burke 2021-03-30 15:25:13 -07:00
parent 6dd3c7cd15
commit 399bda8a41
2 changed files with 12 additions and 1 deletions

View File

@ -3085,6 +3085,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

@ -2307,12 +2307,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