proxy: only use listing shards cache for 'auto' listings
The proxy should NOT read or write to memcache when handling a container GET that explicitly requests 'shard' or 'object' record type. A request for 'shard' record type may specify 'namespace' format, but this request is unrelated to container listings or object updates and passes directly to the backend. This patch also removes unnecessary JSON serialisation and de-serialisation of namespaces within the proxy GET path when a sharded object listing is being built. The final response body will contain a list of objects so there is no need to write intermediate response bodies with a list of namespaces. Requests that explicitly specify record type of 'shard' will of course still have the response body with serialised shard dicts that is returned from the backend. Change-Id: Id79c156432350c11c52a4004d69b85e9eb904ca6
This commit is contained in:
5 changed files with 1229 additions and 700 deletions
@@ -2998,17 +2998,14 @@ class TestShardedAPI(BaseTestContainerSharding):
params={'states': 'updating'})
self._assert_namespace_equivalence(orig_shard_ranges, shard_ranges)
# XXX the states=listing param provokes the proxy to cache the backend
# values and then respond to the client with the cached *namespaces* !!
# shard_ranges = self.get_container_shard_ranges(
# params={'states': 'listing'})
# self._assert_namespace_equivalence(orig_shard_ranges, shard_ranges)
shard_ranges = self.get_container_shard_ranges(
params={'states': 'listing'})
self._assert_namespace_equivalence(orig_shard_ranges, shard_ranges)
# XXX ditto...
# shard_ranges = self.get_container_shard_ranges(
# headers={'X-Newest': 'true'},
# params={'states': 'listing'})
# self._assert_namespace_equivalence(orig_shard_ranges, shard_ranges)
shard_ranges = self.get_container_shard_ranges(
headers={'X-Newest': 'true'},
params={'states': 'listing'})
self._assert_namespace_equivalence(orig_shard_ranges, shard_ranges)
# this is what the sharder requests...
shard_ranges = self.get_container_shard_ranges(
@@ -7904,6 +7904,15 @@ class TestNamespaceBoundList(unittest.TestCase):
self.end_ns = utils.Namespace('a/z-', 'z', '')
self.lowerbounds = [start, atof, ftol, ltor, rtoz, end]
def test_eq(self):
this = utils.NamespaceBoundList(self.lowerbounds)
that = utils.NamespaceBoundList(self.lowerbounds)
self.assertEqual(this, that)
that = utils.NamespaceBoundList(self.lowerbounds[:1])
self.assertNotEqual(this, that)
self.assertNotEqual(this, None)
self.assertNotEqual(this, self.lowerbounds)
def test_get_namespace(self):
namespace_list = utils.NamespaceBoundList(self.lowerbounds)
self.assertEqual(namespace_list.bounds, self.lowerbounds)
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.