diff --git a/swift/proxy/controllers/container.py b/swift/proxy/controllers/container.py index 529fbd1aaf..85f43bfdff 100644 --- a/swift/proxy/controllers/container.py +++ b/swift/proxy/controllers/container.py @@ -239,8 +239,8 @@ class ContainerController(Controller): memcache = cache_from_env(req.environ, True) if memcache and ns_bound_list: # cache in memcache only if shard ranges as expected - self.logger.debug('Caching %d shards for %s', - len(ns_bound_list.bounds), req.path_qs) + self.logger.info('Caching listing shards for %s (%d shards)', + cache_key, len(ns_bound_list.bounds)) memcache.set(cache_key, ns_bound_list.bounds, time=self.app.recheck_listing_shard_ranges) return ns_bound_list diff --git a/swift/proxy/controllers/obj.py b/swift/proxy/controllers/obj.py index 4f3ed304d6..cdc354f701 100644 --- a/swift/proxy/controllers/obj.py +++ b/swift/proxy/controllers/obj.py @@ -386,6 +386,9 @@ class BaseObjectController(Controller): shard_ranges) infocache[cache_key] = cached_namespaces if memcache: + self.logger.info( + 'Caching updating shards for %s (%d shards)', + cache_key, len(cached_namespaces.bounds)) memcache.set( cache_key, cached_namespaces.bounds, time=self.app.recheck_updating_shard_ranges) diff --git a/test/unit/proxy/controllers/test_container.py b/test/unit/proxy/controllers/test_container.py index d8b1367578..f0bd3ae693 100644 --- a/test/unit/proxy/controllers/test_container.py +++ b/test/unit/proxy/controllers/test_container.py @@ -3210,6 +3210,10 @@ class TestContainerController(TestRingBase): 'shard-listing-v2/a/c', self.ns_bound_list.bounds, time=600), mock.call.set('container/a/c', mock.ANY, time=60)], self.memcache.calls) + info_lines = self.logger.get_lines_for_level('info') + self.assertIn( + 'Caching listing shards for shard-listing-v2/a/c (3 shards)', + info_lines) # shards were cached self.assertEqual('sharded', self.memcache.calls[2][1][1]['sharding_state']) diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py index 2e4da07544..1082a23717 100644 --- a/test/unit/proxy/test_server.py +++ b/test/unit/proxy/test_server.py @@ -4358,6 +4358,10 @@ class TestReplicatedObjectController( 'object.shard_updating.cache.miss.200': 1}, stats) self.assertEqual([], self.app.logger.log_dict['set_statsd_prefix']) + info_lines = self.logger.get_lines_for_level('info') + self.assertIn( + 'Caching updating shards for shard-updating-v2/a/c (3 shards)', + info_lines) backend_requests = fake_conn.requests account_request = backend_requests[0]