From f792373d702dad03899f34a6a3b357cbf4f04043 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 5 Mar 2024 13:36:48 +0900 Subject: [PATCH] Add cache client retry options for the pymemcache backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch specifies a set of options required to setup the retrying wrapper feature of pymemcache (dogpile.cache) cache backend. Original oslo.cache change: https://review.opendev.org/c/openstack/oslo.cache/+/803747 Co-Authored-By: Hervé Beraud Depends-On: https://review.opendev.org/826869 Change-Id: Ia0fa98ff49d63332eff8e4e377402d2527b1c595 --- manifests/cache.pp | 21 +++++++++++++++++++ ..._cache_retry_options-fdd8f4bab512172f.yaml | 4 ++++ spec/classes/zaqar_cache_spec.rb | 9 ++++++++ 3 files changed, 34 insertions(+) create mode 100644 releasenotes/notes/add_cache_retry_options-fdd8f4bab512172f.yaml diff --git a/manifests/cache.pp b/manifests/cache.pp index 6e2827c..e30cac1 100644 --- a/manifests/cache.pp +++ b/manifests/cache.pp @@ -145,6 +145,21 @@ # be available. # Default to $facts['os_service_default'] # +# [*enable_retry_client*] +# (Optional) Enable retry client mechanisms to handle failure. +# Those mechanisms can be used to wrap all kind of pymemcache +# clients. The wrapper allows you to define how many attempts +# to make and how long to wait between attempts. +# Default to $facts['os_service_default'] +# +# [*retry_attempts*] +# (Optional) Number of times to attempt an action before failing. +# Default to $facts['os_service_default'] +# +# [*retry_delay*] +# (Optional) Number of seconds to sleep between each attempt. +# Default to $facts['os_service_default'] +# class zaqar::cache ( $config_prefix = $facts['os_service_default'], $expiration_time = $facts['os_service_default'], @@ -170,6 +185,9 @@ class zaqar::cache ( $tls_certfile = $facts['os_service_default'], $tls_keyfile = $facts['os_service_default'], $tls_allowed_ciphers = $facts['os_service_default'], + $enable_retry_client = $facts['os_service_default'], + $retry_attempts = $facts['os_service_default'], + $retry_delay = $facts['os_service_default'], ) { include zaqar::deps @@ -199,5 +217,8 @@ class zaqar::cache ( tls_certfile => $tls_certfile, tls_keyfile => $tls_keyfile, tls_allowed_ciphers => $tls_allowed_ciphers, + enable_retry_client => $enable_retry_client, + retry_attempts => $retry_attempts, + retry_delay => $retry_delay, } } diff --git a/releasenotes/notes/add_cache_retry_options-fdd8f4bab512172f.yaml b/releasenotes/notes/add_cache_retry_options-fdd8f4bab512172f.yaml new file mode 100644 index 0000000..38d728c --- /dev/null +++ b/releasenotes/notes/add_cache_retry_options-fdd8f4bab512172f.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add cache client retry options for the pymemcache (dogpile.cache) backend. diff --git a/spec/classes/zaqar_cache_spec.rb b/spec/classes/zaqar_cache_spec.rb index 0344861..10846b5 100644 --- a/spec/classes/zaqar_cache_spec.rb +++ b/spec/classes/zaqar_cache_spec.rb @@ -34,6 +34,9 @@ describe 'zaqar::cache' do :tls_certfile => '', :tls_keyfile => '', :tls_allowed_ciphers => '', + :enable_retry_client => '', + :retry_attempts => '', + :retry_delay => '', :manage_backend_package => true, ) end @@ -60,6 +63,9 @@ describe 'zaqar::cache' do :memcache_pool_connection_get_timeout => '360', :memcache_pool_flush_on_reconnect => false, :tls_enabled => false, + :enable_retry_client => false, + :retry_attempts => 2, + :retry_delay => 0, :manage_backend_package => false, } end @@ -89,6 +95,9 @@ describe 'zaqar::cache' do :tls_certfile => '', :tls_keyfile => '', :tls_allowed_ciphers => '', + :enable_retry_client => false, + :retry_attempts => 2, + :retry_delay => 0, :manage_backend_package => false, ) end