Remove update_clients() call from update-status.

The commit [0] added a explicit call to update_clients
which is executed on every hook run (including update-status),
the update_clients function iterates over all the units
related through the amqp relation and makes a call
to the amqp_changed function.

As the update_status hook interval is set to run every 5 minutes,
isn't convenient to do a call to amqp_changed for every related unit
particularly in large scale deployments, as this might cause
an unwanted workload overhead on the cloud at every tick
of the update-status hook.

Further work needs to be done to improve the overall
handling performed via the update_clients function but
this commit alleviates the problem of leaving the update-status
hook stuck for ~1 hour every time.

[0] 2472e1ca9f

Change-Id: If9d6ed03d0b8a79fa0210fba57a3d54c2646214d
Closes-Bug: #1717579
Signed-off-by: Jorge Niedbalski <jorge.niedbalski@canonical.com>
This commit is contained in:
Jorge Niedbalski 2017-09-15 17:17:58 -03:00
parent 1ec1269a1c
commit f9b2eb310e
1 changed files with 14 additions and 4 deletions

View File

@ -121,7 +121,7 @@ def install():
def validate_amqp_config_tracker(f):
"""Decorator to mark all existing tracked amqp configs as stale so that
they are refreshed the next time the current unit leader.
they are refreshed the next time the current unit leader.
"""
def _validate_amqp_config_tracker(*args, **kwargs):
if not is_leader():
@ -677,7 +677,7 @@ def config_changed():
'/etc/default/rabbitmq-server')
# Install packages to ensure any changes to source
# result in an upgrade if applicable only if we change the 'source'
# result in an upgrade if applicable only if we change the 'source'
# config option
if rabbit.archive_upgrade_available():
rabbit.install_or_upgrade_packages()
@ -782,6 +782,16 @@ if __name__ == '__main__':
hooks.execute(sys.argv)
except UnregisteredHookError as e:
log('Unknown hook {} - skipping.'.format(e))
# Gated client updates
update_clients()
# NOTE(niedbalski): we skip running update_clients on
# update-status as this might workload overhead on the
# cloud at every tick of the update-status hook. (LP:#1717579).
(hook, skip) = (os.path.basename(sys.argv[0]), ('update-status', ))
if hook in skip:
log("Skipping to run update_clients on hook: {} - skip: {}".format(
hook, ",".join(skip)), DEBUG)
else:
# Gated client updates
update_clients()
rabbit.assess_status(rabbit.ConfigRenderer(rabbit.CONFIG_FILES))