Make the broker timeout when sharding configurable

This is a bit of a blunt tool -- might be better to do a temporary boost
when recording progress, based on the amount of time spent *making* that
progress like in manage_shard_ranges -- but I definitely *don't* want to
get through a 4 hour cleave and then *fail to record that*.

Default to 60s, which is more than twice the default timeout, but give
operators the option to set it as they like.

Change-Id: If518d503b0995051f7dafcbb73ac3c9889fe450f
This commit is contained in:
Tim Burke 2018-04-13 18:05:40 +00:00
parent 7eb60b4cd6
commit 33ee15b8aa
2 changed files with 9 additions and 1 deletions

View File

@ -417,3 +417,8 @@ use = egg:swift#xprofile
# limit may be changed by setting recon_candidates_limit to an integer value. A
# negative value implies no limit.
# recon_candidates_limit = 5
#
# Large databases tend to take a while to work with, but we want to make sure
# we write down our progress. Use a larger-than-normal broker timeout to make
# us less likely to bomb out on a LockTimeout.
# broker_timeout = 60

View File

@ -141,6 +141,8 @@ class ContainerSharder(ContainerReplicator):
self.auto_shard = config_true_value(conf.get('auto_shard', False))
self.recon_candidates_limit = int(
conf.get('recon_candidates_limit', 5))
self.broker_timeout = config_positive_int_value(
conf.get('broker_timeout', 60))
# internal client
self.conn_timeout = float(conf.get('conn_timeout', 5))
@ -978,7 +980,8 @@ class ContainerSharder(ContainerReplicator):
node_id)
continue
broker = ContainerBroker(path, logger=self.logger)
broker = ContainerBroker(path, logger=self.logger,
timeout=self.broker_timeout)
error = None
try:
self._identify_sharding_candidate(broker, node)