swift/test/unit/proxy/controllers
Matthew Oliver 56510ab3c3 container-server: return objects of a given policy
There is a tight coupling between a root container and its shards: the
shards hold the object metadata for the root container, so are really
an extension of the root.  When we PUT objects in to a root container,
it'll redirect them, with the root's policy, to the shards. And the
shards are happy to take them, even if the shard's policy is different
to the root's.  But when it comes to GETs, the root redirects the GET
onto it's shards whom currently wont respond with objects (which they
probably took) because they are of a different policy. Currently, when
getting objects from the container server, the policy used is always
the broker's policy.

This patch corrects this behaviour by allowing the ability to override
the policy index to use. If the request to the container server
contains an 'X-Backend-Storage-Policy-Index' header it'll be used
instead of the policy index stored in the broker.

This patch adds the root container's policy as this header in the
proxy container controller's `_get_from_shards` method which is used
by the proxy to redirect a GET to a root to its shards.

Further, a new backend response header has been added. If the
container response contains an `X-Backend-Record-Type: object` header,
then it means the response is a response with objects in it. In this
case this patch also adds a `X-Backend-Record-Storage-Policy-Index`
header so the policy index of the given objects is known, as
X-Backend-Storage-Policy-Index in the response _always_ represents the
policy index of the container itself.

On a plus side this new container policy API allows us a way to check
containers for object listing is other policies. So might come in handy
for OPs/SREs.

Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Change-Id: I026b699fc5f0fba619cf524093632d67ca38d32f
2021-08-16 11:56:54 +01:00
..
__init__.py re-use headers_to_container_info on container GET 2012-11-01 18:46:47 -07:00
test_account.py Client should retry when there's just one 404 and a bunch of errors 2020-09-08 14:33:09 -07:00
test_base.py Cleanup tests' import of debug_logger 2021-04-27 12:04:41 +01:00
test_container.py container-server: return objects of a given policy 2021-08-16 11:56:54 +01:00
test_info.py py3: Monkey-patch json.loads to accept bytes on py35 2018-11-02 21:38:53 +00:00
test_obj.py Add unit test for missing whole EC fragments 2021-06-01 13:27:19 +01:00