Skip to content

Commit

Permalink
ec: Don't copy EC metadata to replicated objects
Browse files Browse the repository at this point in the history
Change-Id: Ia6c1b75a24d2b46720d7a3b6e3a126444a38be0e
Closes-Bug: #1885857
  • Loading branch information
tipabu committed Mar 30, 2021
1 parent 6dd3c7c commit 399bda8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions swift/proxy/controllers/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,12 @@ def _fix_response(self, req, resp):
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()!
Expand Down
7 changes: 6 additions & 1 deletion test/unit/proxy/controllers/test_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -2307,12 +2307,17 @@ def _test_one_handoff(index):
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
Expand Down

0 comments on commit 399bda8

Please sign in to comment.