From c374a7a85152699fe1edc6078076f66fcbce3dfb Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 5 May 2021 15:30:21 -0700 Subject: [PATCH] Allow floats for all intervals Change-Id: I91e9bc02d94fe7ea6e89307305705c383087845a --- etc/account-server.conf-sample | 8 ++++---- etc/container-reconciler.conf-sample | 2 +- etc/container-server.conf-sample | 12 ++++++------ etc/container-sync-realms.conf-sample | 2 +- etc/object-expirer.conf-sample | 4 ++-- etc/object-server.conf-sample | 26 +++++++++++++------------- etc/proxy-server.conf-sample | 2 +- swift/account/reaper.py | 2 +- swift/common/db_auditor.py | 2 +- swift/common/db_replicator.py | 4 ++-- swift/common/wsgi.py | 2 +- swift/container/reconciler.py | 2 +- swift/container/sync.py | 2 +- swift/container/updater.py | 2 +- swift/obj/auditor.py | 2 +- swift/obj/expirer.py | 4 ++-- swift/obj/reconstructor.py | 8 ++++---- swift/obj/replicator.py | 8 ++++---- swift/obj/updater.py | 2 +- test/unit/container/test_updater.py | 5 ++--- test/unit/obj/test_updater.py | 5 ++--- 21 files changed, 52 insertions(+), 54 deletions(-) diff --git a/etc/account-server.conf-sample b/etc/account-server.conf-sample index eb0ce80459..89c1ea3506 100644 --- a/etc/account-server.conf-sample +++ b/etc/account-server.conf-sample @@ -151,9 +151,9 @@ use = egg:swift#recon # concurrency = 8 # # Time in seconds to wait between replication passes -# interval = 30 +# interval = 30.0 # run_pause is deprecated, use interval instead -# run_pause = 30 +# run_pause = 30.0 # # Process at most this many databases per second # databases_per_second = 50 @@ -214,7 +214,7 @@ use = egg:swift#recon # log_address = /dev/log # # Will audit each account at most once per interval -# interval = 1800 +# interval = 1800.0 # # accounts_per_second = 200 # recon_cache_path = /var/cache/swift @@ -239,7 +239,7 @@ use = egg:swift#recon # log_address = /dev/log # # concurrency = 25 -# interval = 3600 +# interval = 3600.0 # node_timeout = 10 # conn_timeout = 0.5 # diff --git a/etc/container-reconciler.conf-sample b/etc/container-reconciler.conf-sample index ee507a396b..cda8110e62 100644 --- a/etc/container-reconciler.conf-sample +++ b/etc/container-reconciler.conf-sample @@ -41,7 +41,7 @@ # in the queue. # reclaim_age = 604800 # The cycle time of the daemon -# interval = 30 +# interval = 30.0 # Server errors from requests will be retried by default # request_tries = 3 # diff --git a/etc/container-server.conf-sample b/etc/container-server.conf-sample index d03217cbb8..51bef8a828 100644 --- a/etc/container-server.conf-sample +++ b/etc/container-server.conf-sample @@ -161,9 +161,9 @@ use = egg:swift#recon # concurrency = 8 # # Time in seconds to wait between replication passes -# interval = 30 +# interval = 30.0 # run_pause is deprecated, use interval instead -# run_pause = 30 +# run_pause = 30.0 # # Process at most this many databases per second # databases_per_second = 50 @@ -223,7 +223,7 @@ use = egg:swift#recon # log_level = INFO # log_address = /dev/log # -# interval = 300 +# interval = 300.0 # concurrency = 4 # node_timeout = 3 # conn_timeout = 0.5 @@ -260,7 +260,7 @@ use = egg:swift#recon # log_address = /dev/log # # Will audit each container at most once per interval -# interval = 1800 +# interval = 1800.0 # # containers_per_second = 200 # recon_cache_path = /var/cache/swift @@ -290,7 +290,7 @@ use = egg:swift#recon # sync_proxy = http://10.1.1.1:8888,http://10.1.1.2:8888 # # Will sync each container at most once per interval -# interval = 300 +# interval = 300.0 # # Maximum amount of time to spend syncing each container per pass # container_time = 60 @@ -467,7 +467,7 @@ use = egg:swift#xprofile # broker_timeout = 60 # # Time in seconds to wait between sharder cycles -# interval = 30 +# interval = 30.0 # # Process at most this many databases per second # databases_per_second = 50 diff --git a/etc/container-sync-realms.conf-sample b/etc/container-sync-realms.conf-sample index 19ce21c18c..01e4723ed5 100644 --- a/etc/container-sync-realms.conf-sample +++ b/etc/container-sync-realms.conf-sample @@ -1,7 +1,7 @@ # [DEFAULT] # The number of seconds between checking the modified time of this config file # for changes and therefore reloading it. -# mtime_check_interval = 300 +# mtime_check_interval = 300.0 # [realm1] diff --git a/etc/object-expirer.conf-sample b/etc/object-expirer.conf-sample index 44e5743902..a83d9e0013 100644 --- a/etc/object-expirer.conf-sample +++ b/etc/object-expirer.conf-sample @@ -38,9 +38,9 @@ # ionice_priority = [object-expirer] -# interval = 300 +# interval = 300.0 # expiring_objects_account_name = expiring_objects -# report_interval = 300 +# report_interval = 300.0 # # request_tries is the number of times the expirer's internal client will # attempt any given request in the event of failure. The default is 3. diff --git a/etc/object-server.conf-sample b/etc/object-server.conf-sample index 762037178c..4e62bd8815 100644 --- a/etc/object-server.conf-sample +++ b/etc/object-server.conf-sample @@ -230,9 +230,9 @@ use = egg:swift#recon # daemonize = on # # Time in seconds to wait between replication passes -# interval = 30 +# interval = 30.0 # run_pause is deprecated, use interval instead -# run_pause = 30 +# run_pause = 30.0 # # Number of concurrent replication jobs to run. This is per-process, # so replicator_workers=W and concurrency=C will result in W*C @@ -244,7 +244,7 @@ use = egg:swift#recon # is done in the main process. # replicator_workers = 0 # -# stats_interval = 300 +# stats_interval = 300.0 # # default is rsync, alternative is ssync # sync_method = rsync @@ -277,7 +277,7 @@ use = egg:swift#recon # attempts to kill all workers if nothing replicates for lockup_timeout seconds # lockup_timeout = 1800 # -# ring_check_interval = 15 +# ring_check_interval = 15.0 # recon_cache_path = /var/cache/swift # # limits how long rsync error log lines are @@ -329,9 +329,9 @@ use = egg:swift#recon # daemonize = on # # Time in seconds to wait between reconstruction passes -# interval = 30 +# interval = 30.0 # run_pause is deprecated, use interval instead -# run_pause = 30 +# run_pause = 30.0 # # Maximum number of worker processes to spawn. Each worker will handle a # subset of devices. Devices will be assigned evenly among the workers so that @@ -341,11 +341,11 @@ use = egg:swift#recon # reconstructor_workers = 0 # # concurrency = 1 -# stats_interval = 300 +# stats_interval = 300.0 # node_timeout = 10 # http_timeout = 60 # lockup_timeout = 1800 -# ring_check_interval = 15 +# ring_check_interval = 15.0 # recon_cache_path = /var/cache/swift # The handoffs_only mode option is for special case emergency situations during # rebalance such as disk full in the cluster. This option SHOULD NOT BE @@ -398,7 +398,7 @@ use = egg:swift#recon # log_level = INFO # log_address = /dev/log # -# interval = 300 +# interval = 300.0 # node_timeout = # # updater_workers controls how many processes the object updater will @@ -420,7 +420,7 @@ use = egg:swift#recon # logging is per-process, so with concurrency > 1, the logs will # contain one stats log per worker process every report_interval # seconds. -# report_interval = 300 +# report_interval = 300.0 # # recon_cache_path = /var/cache/swift # @@ -444,7 +444,7 @@ use = egg:swift#recon # log_address = /dev/log # # Time in seconds to wait between auditor passes -# interval = 30 +# interval = 30.0 # # You can set the disk chunk size that the auditor uses making it larger if # you like for more efficient local auditing of larger objects @@ -537,9 +537,9 @@ use = egg:swift#recon # log_level = INFO # log_address = /dev/log # -# interval = 300 +# interval = 300.0 # -# report_interval = 300 +# report_interval = 300.0 # # request_tries is the number of times the expirer's internal client will # attempt any given request in the event of failure. The default is 3. diff --git a/etc/proxy-server.conf-sample b/etc/proxy-server.conf-sample index d0bc1caae7..ac38002a57 100644 --- a/etc/proxy-server.conf-sample +++ b/etc/proxy-server.conf-sample @@ -168,7 +168,7 @@ use = egg:swift#proxy # How long without an error before a node's error count is reset. This will # also be how long before a node is reenabled after suppression is triggered. # Set to 0 to disable error-limiting. -# error_suppression_interval = 60 +# error_suppression_interval = 60.0 # # How many errors can accumulate before a node is temporarily ignored. # error_suppression_limit = 10 diff --git a/swift/account/reaper.py b/swift/account/reaper.py index bd4ee98e4c..1bafeb9871 100644 --- a/swift/account/reaper.py +++ b/swift/account/reaper.py @@ -65,7 +65,7 @@ class AccountReaper(Daemon): self.logger = logger or get_logger(conf, log_route='account-reaper') self.devices = conf.get('devices', '/srv/node') self.mount_check = config_true_value(conf.get('mount_check', 'true')) - self.interval = int(conf.get('interval', 3600)) + self.interval = float(conf.get('interval', 3600)) self.swift_dir = conf.get('swift_dir', '/etc/swift') self.account_ring = None self.container_ring = None diff --git a/swift/common/db_auditor.py b/swift/common/db_auditor.py index aeae8c113a..393416c96c 100644 --- a/swift/common/db_auditor.py +++ b/swift/common/db_auditor.py @@ -44,7 +44,7 @@ class DatabaseAuditor(Daemon): self.server_type)) self.devices = conf.get('devices', '/srv/node') self.mount_check = config_true_value(conf.get('mount_check', 'true')) - self.interval = int(conf.get('interval', 1800)) + self.interval = float(conf.get('interval', 1800)) self.logging_interval = 3600 # once an hour self.passes = 0 self.failures = 0 diff --git a/swift/common/db_replicator.py b/swift/common/db_replicator.py index fa180b6f47..d51c7b620a 100644 --- a/swift/common/db_replicator.py +++ b/swift/common/db_replicator.py @@ -196,8 +196,8 @@ class Replicator(Daemon): self._local_device_ids = set() self.per_diff = int(conf.get('per_diff', 1000)) self.max_diffs = int(conf.get('max_diffs') or 100) - self.interval = int(conf.get('interval') or - conf.get('run_pause') or 30) + self.interval = float(conf.get('interval') or + conf.get('run_pause') or 30) if 'run_pause' in conf: if 'interval' in conf: self.logger.warning( diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py index a54de0e467..bce2f151af 100644 --- a/swift/common/wsgi.py +++ b/swift/common/wsgi.py @@ -897,7 +897,7 @@ class ServersPerPortStrategy(StrategyBase): super(ServersPerPortStrategy, self).__init__(conf, logger) self.servers_per_port = servers_per_port self.swift_dir = conf.get('swift_dir', '/etc/swift') - self.ring_check_interval = int(conf.get('ring_check_interval', 15)) + self.ring_check_interval = float(conf.get('ring_check_interval', 15)) bind_ip = conf.get('bind_ip', '0.0.0.0') self.cache = BindPortsCache(self.swift_dir, bind_ip) diff --git a/swift/container/reconciler.py b/swift/container/reconciler.py index 9bf225eb64..346032ad91 100644 --- a/swift/container/reconciler.py +++ b/swift/container/reconciler.py @@ -362,7 +362,7 @@ class ContainerReconciler(Daemon): # marker will be retried before it is abandoned. It is not coupled # with the tombstone reclaim age in the consistency engine. self.reclaim_age = int(conf.get('reclaim_age', 86400 * 7)) - self.interval = int(conf.get('interval', 30)) + self.interval = float(conf.get('interval', 30)) conf_path = conf.get('__file__') or \ '/etc/swift/container-reconciler.conf' self.logger = get_logger(conf, log_route='container-reconciler') diff --git a/swift/container/sync.py b/swift/container/sync.py index 34b300fb03..eeec9d6840 100644 --- a/swift/container/sync.py +++ b/swift/container/sync.py @@ -171,7 +171,7 @@ class ContainerSync(Daemon): self.mount_check = config_true_value(conf.get('mount_check', 'true')) #: Minimum time between full scans. This is to keep the daemon from #: running wild on near empty systems. - self.interval = int(conf.get('interval', 300)) + self.interval = float(conf.get('interval', 300)) #: Maximum amount of time to spend syncing a container before moving on #: to the next one. If a container sync hasn't finished in this time, #: it'll just be resumed next scan. diff --git a/swift/container/updater.py b/swift/container/updater.py index 88afb42037..601e18875e 100644 --- a/swift/container/updater.py +++ b/swift/container/updater.py @@ -47,7 +47,7 @@ class ContainerUpdater(Daemon): self.devices = conf.get('devices', '/srv/node') self.mount_check = config_true_value(conf.get('mount_check', 'true')) self.swift_dir = conf.get('swift_dir', '/etc/swift') - self.interval = int(conf.get('interval', 300)) + self.interval = float(conf.get('interval', 300)) self.account_ring = None self.concurrency = int(conf.get('concurrency', 4)) if 'slowdown' in conf: diff --git a/swift/obj/auditor.py b/swift/obj/auditor.py index dba12a073b..e2f732d295 100644 --- a/swift/obj/auditor.py +++ b/swift/obj/auditor.py @@ -323,7 +323,7 @@ class ObjectAuditor(Daemon): self.recon_cache_path = conf.get('recon_cache_path', '/var/cache/swift') self.rcache = join(self.recon_cache_path, "object.recon") - self.interval = int(conf.get('interval', 30)) + self.interval = float(conf.get('interval', 30)) watcher_names = set(list_from_csv(conf.get('watchers', ''))) # Normally '__file__' is always in config, but tests neglect it often. diff --git a/swift/obj/expirer.py b/swift/obj/expirer.py index 1c8f9bb958..0efff6a804 100644 --- a/swift/obj/expirer.py +++ b/swift/obj/expirer.py @@ -78,7 +78,7 @@ class ObjectExpirer(Daemon): def __init__(self, conf, logger=None, swift=None): self.conf = conf self.logger = logger or get_logger(conf, log_route='object-expirer') - self.interval = int(conf.get('interval') or 300) + self.interval = float(conf.get('interval') or 300) self.tasks_per_second = float(conf.get('tasks_per_second', 50.0)) self.conf_path = \ @@ -99,7 +99,7 @@ class ObjectExpirer(Daemon): self.read_conf_for_queue_access(swift) - self.report_interval = int(conf.get('report_interval') or 300) + self.report_interval = float(conf.get('report_interval') or 300) self.report_first_time = self.report_last_time = time() self.report_objects = 0 self.recon_cache_path = conf.get('recon_cache_path', diff --git a/swift/obj/reconstructor.py b/swift/obj/reconstructor.py index 7d3477bf94..d1c64cbe5a 100644 --- a/swift/obj/reconstructor.py +++ b/swift/obj/reconstructor.py @@ -179,12 +179,12 @@ class ObjectReconstructor(Daemon): self.reconstructor_workers = int(conf.get('reconstructor_workers', 0)) self.policies = [policy for policy in POLICIES if policy.policy_type == EC_POLICY] - self.stats_interval = int(conf.get('stats_interval', '300')) - self.ring_check_interval = int(conf.get('ring_check_interval', 15)) + self.stats_interval = float(conf.get('stats_interval', '300')) + self.ring_check_interval = float(conf.get('ring_check_interval', 15)) self.next_check = time.time() + self.ring_check_interval self.partition_times = [] - self.interval = int(conf.get('interval') or - conf.get('run_pause') or 30) + self.interval = float(conf.get('interval') or + conf.get('run_pause') or 30) if 'run_pause' in conf: if 'interval' in conf: self.logger.warning( diff --git a/swift/obj/replicator.py b/swift/obj/replicator.py index 7e753d545f..17c7546a92 100644 --- a/swift/obj/replicator.py +++ b/swift/obj/replicator.py @@ -142,13 +142,13 @@ class ObjectReplicator(Daemon): self.replicator_workers = int(conf.get('replicator_workers', 0)) self.policies = [policy for policy in POLICIES if policy.policy_type == REPL_POLICY] - self.stats_interval = int(conf.get('stats_interval', '300')) - self.ring_check_interval = int(conf.get('ring_check_interval', 15)) + self.stats_interval = float(conf.get('stats_interval', '300')) + self.ring_check_interval = float(conf.get('ring_check_interval', 15)) self.next_check = time.time() + self.ring_check_interval self.replication_cycle = random.randint(0, 9) self.partition_times = [] - self.interval = int(conf.get('interval') or - conf.get('run_pause') or 30) + self.interval = float(conf.get('interval') or + conf.get('run_pause') or 30) if 'run_pause' in conf: if 'interval' in conf: self.logger.warning( diff --git a/swift/obj/updater.py b/swift/obj/updater.py index f3a01a8241..534053f418 100644 --- a/swift/obj/updater.py +++ b/swift/obj/updater.py @@ -93,7 +93,7 @@ class ObjectUpdater(Daemon): self.devices = conf.get('devices', '/srv/node') self.mount_check = config_true_value(conf.get('mount_check', 'true')) self.swift_dir = conf.get('swift_dir', '/etc/swift') - self.interval = int(conf.get('interval', 300)) + self.interval = float(conf.get('interval', 300)) self.container_ring = None self.concurrency = int(conf.get('concurrency', 8)) self.updater_workers = int(conf.get('updater_workers', 1)) diff --git a/test/unit/container/test_updater.py b/test/unit/container/test_updater.py index 82651e48a6..dd13c23c4b 100644 --- a/test/unit/container/test_updater.py +++ b/test/unit/container/test_updater.py @@ -103,7 +103,7 @@ class TestContainerUpdater(unittest.TestCase): 'devices': '/some/where/else', 'mount_check': 'huh?', 'swift_dir': '/not/here', - 'interval': '600', + 'interval': '600.1', 'concurrency': '2', 'containers_per_second': '10.5', } @@ -111,7 +111,7 @@ class TestContainerUpdater(unittest.TestCase): self.assertEqual(daemon.devices, '/some/where/else') self.assertEqual(daemon.mount_check, False) self.assertEqual(daemon.swift_dir, '/not/here') - self.assertEqual(daemon.interval, 600) + self.assertEqual(daemon.interval, 600.1) self.assertEqual(daemon.concurrency, 2) self.assertEqual(daemon.max_containers_per_second, 10.5) @@ -124,7 +124,6 @@ class TestContainerUpdater(unittest.TestCase): container_updater.ContainerUpdater(conf) check_bad({'interval': 'foo'}) - check_bad({'interval': '300.0'}) check_bad({'concurrency': 'bar'}) check_bad({'concurrency': '1.0'}) check_bad({'slowdown': 'baz'}) diff --git a/test/unit/obj/test_updater.py b/test/unit/obj/test_updater.py index 9eb4a2b3f5..a1e83e7957 100644 --- a/test/unit/obj/test_updater.py +++ b/test/unit/obj/test_updater.py @@ -131,7 +131,7 @@ class TestObjectUpdater(unittest.TestCase): 'devices': '/some/where/else', 'mount_check': 'huh?', 'swift_dir': '/not/here', - 'interval': '600', + 'interval': '600.1', 'concurrency': '2', 'updater_workers': '3', 'objects_per_second': '10.5', @@ -140,7 +140,7 @@ class TestObjectUpdater(unittest.TestCase): self.assertEqual(daemon.devices, '/some/where/else') self.assertEqual(daemon.mount_check, False) self.assertEqual(daemon.swift_dir, '/not/here') - self.assertEqual(daemon.interval, 600) + self.assertEqual(daemon.interval, 600.1) self.assertEqual(daemon.concurrency, 2) self.assertEqual(daemon.updater_workers, 3) self.assertEqual(daemon.max_objects_per_second, 10.5) @@ -155,7 +155,6 @@ class TestObjectUpdater(unittest.TestCase): object_updater.ObjectUpdater(conf, logger=self.logger) check_bad({'interval': 'foo'}) - check_bad({'interval': '300.0'}) check_bad({'concurrency': 'bar'}) check_bad({'concurrency': '1.0'}) check_bad({'slowdown': 'baz'})