Merge "slo: Default allow_async_delete to true"

This commit is contained in:
Zuul 2022-12-01 19:25:50 +00:00 committed by Gerrit Code Review
commit 0470994a03
4 changed files with 8 additions and 9 deletions

View File

@ -34,7 +34,6 @@ use = egg:swift#dlo
[filter:slo] [filter:slo]
use = egg:swift#slo use = egg:swift#slo
allow_async_delete = True
[filter:container_sync] [filter:container_sync]
use = egg:swift#container_sync use = egg:swift#container_sync

View File

@ -1093,7 +1093,7 @@ use = egg:swift#slo
# `?multipart-manifest=delete&async=on`. You may want to keep this off if it # `?multipart-manifest=delete&async=on`. You may want to keep this off if it
# negatively impacts your expirers; in that case, the deletes will still # negatively impacts your expirers; in that case, the deletes will still
# be done as part of the client request. # be done as part of the client request.
# allow_async_delete = false # allow_async_delete = true
# Note: Put after auth and staticweb in the pipeline. # Note: Put after auth and staticweb in the pipeline.
# If you don't put it in the pipeline, it will be inserted for you. # If you don't put it in the pipeline, it will be inserted for you.

View File

@ -1103,7 +1103,7 @@ class StaticLargeObject(object):
max_manifest_segments=DEFAULT_MAX_MANIFEST_SEGMENTS, max_manifest_segments=DEFAULT_MAX_MANIFEST_SEGMENTS,
max_manifest_size=DEFAULT_MAX_MANIFEST_SIZE, max_manifest_size=DEFAULT_MAX_MANIFEST_SIZE,
yield_frequency=DEFAULT_YIELD_FREQUENCY, yield_frequency=DEFAULT_YIELD_FREQUENCY,
allow_async_delete=False): allow_async_delete=True):
self.conf = conf self.conf = conf
self.app = app self.app = app
self.logger = get_logger(conf, log_route='slo') self.logger = get_logger(conf, log_route='slo')
@ -1732,7 +1732,7 @@ def filter_factory(global_conf, **local_conf):
yield_frequency = int(conf.get('yield_frequency', yield_frequency = int(conf.get('yield_frequency',
DEFAULT_YIELD_FREQUENCY)) DEFAULT_YIELD_FREQUENCY))
allow_async_delete = config_true_value(conf.get('allow_async_delete', allow_async_delete = config_true_value(conf.get('allow_async_delete',
'false')) 'true'))
register_swift_info('slo', register_swift_info('slo',
max_manifest_segments=max_manifest_segments, max_manifest_segments=max_manifest_segments,

View File

@ -4597,7 +4597,7 @@ class TestSwiftInfo(unittest.TestCase):
self.assertEqual(swift_info['slo'].get('min_segment_size'), 1) self.assertEqual(swift_info['slo'].get('min_segment_size'), 1)
self.assertEqual(swift_info['slo'].get('max_manifest_size'), self.assertEqual(swift_info['slo'].get('max_manifest_size'),
mware.max_manifest_size) mware.max_manifest_size)
self.assertIs(swift_info['slo'].get('allow_async_delete'), False) self.assertIs(swift_info['slo'].get('allow_async_delete'), True)
self.assertEqual(1000, mware.max_manifest_segments) self.assertEqual(1000, mware.max_manifest_segments)
self.assertEqual(8388608, mware.max_manifest_size) self.assertEqual(8388608, mware.max_manifest_size)
self.assertEqual(1048576, mware.rate_limit_under_size) self.assertEqual(1048576, mware.rate_limit_under_size)
@ -4606,21 +4606,21 @@ class TestSwiftInfo(unittest.TestCase):
self.assertEqual(10, mware.yield_frequency) self.assertEqual(10, mware.yield_frequency)
self.assertEqual(2, mware.concurrency) self.assertEqual(2, mware.concurrency)
self.assertEqual(2, mware.bulk_deleter.delete_concurrency) self.assertEqual(2, mware.bulk_deleter.delete_concurrency)
self.assertIs(False, mware.allow_async_delete) self.assertIs(True, mware.allow_async_delete)
def test_registered_non_defaults(self): def test_registered_non_defaults(self):
conf = dict( conf = dict(
max_manifest_segments=500, max_manifest_size=1048576, max_manifest_segments=500, max_manifest_size=1048576,
rate_limit_under_size=2097152, rate_limit_after_segment=20, rate_limit_under_size=2097152, rate_limit_after_segment=20,
rate_limit_segments_per_sec=2, yield_frequency=5, concurrency=1, rate_limit_segments_per_sec=2, yield_frequency=5, concurrency=1,
delete_concurrency=3, allow_async_delete='y') delete_concurrency=3, allow_async_delete='n')
mware = slo.filter_factory(conf)('have to pass in an app') mware = slo.filter_factory(conf)('have to pass in an app')
swift_info = registry.get_swift_info() swift_info = registry.get_swift_info()
self.assertTrue('slo' in swift_info) self.assertTrue('slo' in swift_info)
self.assertEqual(swift_info['slo'].get('max_manifest_segments'), 500) self.assertEqual(swift_info['slo'].get('max_manifest_segments'), 500)
self.assertEqual(swift_info['slo'].get('min_segment_size'), 1) self.assertEqual(swift_info['slo'].get('min_segment_size'), 1)
self.assertEqual(swift_info['slo'].get('max_manifest_size'), 1048576) self.assertEqual(swift_info['slo'].get('max_manifest_size'), 1048576)
self.assertIs(swift_info['slo'].get('allow_async_delete'), True) self.assertIs(swift_info['slo'].get('allow_async_delete'), False)
self.assertEqual(500, mware.max_manifest_segments) self.assertEqual(500, mware.max_manifest_segments)
self.assertEqual(1048576, mware.max_manifest_size) self.assertEqual(1048576, mware.max_manifest_size)
self.assertEqual(2097152, mware.rate_limit_under_size) self.assertEqual(2097152, mware.rate_limit_under_size)
@ -4629,7 +4629,7 @@ class TestSwiftInfo(unittest.TestCase):
self.assertEqual(5, mware.yield_frequency) self.assertEqual(5, mware.yield_frequency)
self.assertEqual(1, mware.concurrency) self.assertEqual(1, mware.concurrency)
self.assertEqual(3, mware.bulk_deleter.delete_concurrency) self.assertEqual(3, mware.bulk_deleter.delete_concurrency)
self.assertIs(True, mware.allow_async_delete) self.assertIs(False, mware.allow_async_delete)
if __name__ == '__main__': if __name__ == '__main__':