Merge "Fix logging in proxy container GET path"
This commit is contained in:
commit
257041affe
@ -391,23 +391,19 @@ class ContainerController(Controller):
|
||||
req, shard_range.account, shard_range.container,
|
||||
headers=headers, params=params)
|
||||
|
||||
shard_state = 'unknown'
|
||||
try:
|
||||
shard_state = shard_resp.headers['x-backend-sharding-state']
|
||||
shard_state = ShardRange.resolve_state(shard_state)
|
||||
except (AttributeError, ValueError, KeyError):
|
||||
pass
|
||||
sharding_state = shard_resp.headers.get('x-backend-sharding-state',
|
||||
'unknown')
|
||||
|
||||
if objs is None:
|
||||
# tolerate errors
|
||||
self.app.logger.debug(
|
||||
'Failed to get objects from shard (state=%s), total = %d',
|
||||
shard_state, len(objects))
|
||||
sharding_state, len(objects))
|
||||
continue
|
||||
|
||||
self.app.logger.debug(
|
||||
'Found %d objects in shard (state=%s), total = %d',
|
||||
len(objs), shard_state, len(objs) + len(objects))
|
||||
len(objs), sharding_state, len(objs) + len(objects))
|
||||
|
||||
if not objs:
|
||||
# tolerate empty shard containers
|
||||
|
@ -982,7 +982,7 @@ class TestContainerController(TestRingBase):
|
||||
# when shrinking the final shard will return the root shard range into
|
||||
# which it is shrinking
|
||||
shard_resp_hdrs = {
|
||||
'X-Backend-Sharding-State': 'sharded',
|
||||
'X-Backend-Sharding-State': 'sharding',
|
||||
'X-Container-Object-Count': 0,
|
||||
'X-Container-Bytes-Used': 0,
|
||||
'X-Backend-Storage-Policy-Index': 0,
|
||||
@ -1028,6 +1028,11 @@ class TestContainerController(TestRingBase):
|
||||
self.assertEqual(
|
||||
[('a', 'c'), ('.shards_a', 'c_xyz')],
|
||||
resp.request.environ.get('swift.shard_listing_history'))
|
||||
lines = [line for line in self.app.logger.get_lines_for_level('debug')
|
||||
if line.startswith('Found 1024 objects in shard')]
|
||||
self.assertEqual(2, len(lines), lines)
|
||||
self.assertIn("(state=sharded), total = 1024", lines[0]) # shard->root
|
||||
self.assertIn("(state=sharding), total = 1024", lines[1]) # shard
|
||||
|
||||
def test_GET_sharded_container_shard_redirects_between_shards(self):
|
||||
# check that if one shard redirects listing to another shard that
|
||||
@ -1767,7 +1772,7 @@ class TestContainerController(TestRingBase):
|
||||
'X-Backend-Storage-Policy-Index': '0'}
|
||||
|
||||
def _do_test_caching(self, record_type, exp_recheck_listing):
|
||||
# this test gest shard ranges into cache and then reads from cache
|
||||
# this test gets shard ranges into cache and then reads from cache
|
||||
sharding_state = 'sharded'
|
||||
self.memcache.delete_all()
|
||||
self.memcache.clear_calls()
|
||||
|
Loading…
Reference in New Issue
Block a user