URL: https://github.com/SSSD/sssd/pull/5549 Author: elkoniu Title: #5549: data_provider: Configure backend probing interval Action: opened
PR body: """ When be_ptask is created to monitor backend when SSSD is in offline mode checks are happening in specified intervals: delay = delay + (sss_rand() % task->random_offset); New configuration option is introduced in this commit: * refresh_max_random_offset Using this option allows end client to decide what should be the size of random offset when new interval for probing backend is calculated. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925608 """ To pull the PR as Git branch: git remote add ghsssd https://github.com/SSSD/sssd git fetch ghsssd pull/5549/head:pr5549 git checkout pr5549
From 2ce2fd262e2679690d97ff02b3f18180483f6be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= <[email protected]> Date: Tue, 23 Mar 2021 14:40:46 +0100 Subject: [PATCH] data_provider: Configure backend probing interval When be_ptask is created to monitor backend when SSSD is in offline mode checks are happening in specified intervals: delay = delay + (sss_rand() % task->random_offset); New configuration option is introduced in this commit: * refresh_max_random_offset Using this option allows end client to decide what should be the size of random offset when new interval for probing backend is calculated. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925608 --- src/confdb/confdb.h | 1 + src/config/SSSDConfigTest.py | 2 ++ src/config/cfg_rules.ini | 1 + src/config/etc/sssd.api.conf | 2 +- src/man/sssd.conf.5.xml | 26 ++++++++++++++++++++++++++ src/providers/data_provider_be.c | 25 +++++++++++++++++++++++-- 6 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index a2be227ddd..9e6e7cc453 100644 --- a/src/confdb/confdb.h +++ b/src/confdb/confdb.h @@ -245,6 +245,7 @@ #define CONFDB_DOMAIN_REFRESH_EXPIRED_INTERVAL "refresh_expired_interval" #define CONFDB_DOMAIN_OFFLINE_TIMEOUT "offline_timeout" #define CONFDB_DOMAIN_OFFLINE_TIMEOUT_MAX "offline_timeout_max" +#define CONFDB_DOMAIN_REFRESH_MAX_RANDOM_OFFSET "refresh_max_random_offset" #define CONFDB_DOMAIN_SUBDOMAIN_INHERIT "subdomain_inherit" #define CONFDB_DOMAIN_CACHED_AUTH_TIMEOUT "cached_auth_timeout" #define CONFDB_DOMAIN_TYPE "domain_type" diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py index 04c4b35baa..e13f804c50 100755 --- a/src/config/SSSDConfigTest.py +++ b/src/config/SSSDConfigTest.py @@ -594,6 +594,7 @@ def testListOptions(self): 'timeout', 'offline_timeout', 'offline_timeout_max', + 'refresh_max_random_offset', 'command', 'enumerate', 'cache_credentials', @@ -976,6 +977,7 @@ def testRemoveProvider(self): 'timeout', 'offline_timeout', 'offline_timeout_max', + 'refresh_max_random_offset', 'command', 'enumerate', 'cache_credentials', diff --git a/src/config/cfg_rules.ini b/src/config/cfg_rules.ini index bf2d03b824..a931413e03 100644 --- a/src/config/cfg_rules.ini +++ b/src/config/cfg_rules.ini @@ -409,6 +409,7 @@ option = enumerate option = subdomain_enumerate option = offline_timeout option = offline_timeout_max +option = refresh_max_random_offset option = cache_credentials option = cache_credentials_minimal_first_factor_length option = use_fully_qualified_names diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf index 49ced63859..b06a529ae0 100644 --- a/src/config/etc/sssd.api.conf +++ b/src/config/etc/sssd.api.conf @@ -172,6 +172,7 @@ enumerate = bool, None, false subdomain_enumerate = str, None, false offline_timeout = int, None, false offline_timeout_max = int, None, false +refresh_max_random_offset = int, None, false cache_credentials = bool, None, false cache_credentials_minimal_first_factor_length = int, None, false use_fully_qualified_names = bool, None, false @@ -235,4 +236,3 @@ dyndns_server = str, None, false [provider/deny] [provider/deny/access] - diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml index 42659dffe6..327cf4c13d 100644 --- a/src/man/sssd.conf.5.xml +++ b/src/man/sssd.conf.5.xml @@ -790,6 +790,32 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term>refresh_max_random_offset (integer)</term> + <listitem> + <para> + When SSSD is in offline mode it keeps probing + backend servers in specified time intervals: + </para> + <para> + delay = delay + (rand() % random_offset) + </para> + <para> + This parameter controls the value of the random offset + used for above equasion. Final random_offset value + will be random number from range: + </para> + <para> + [0 - refresh_max_random_offset] + </para> + <para> + A value of 0 disables the random offset addition. + </para> + <para> + Default: 30 + </para> + </listitem> + </varlistentry> <varlistentry> <term>responder_idle_timeout</term> <listitem> diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index e3f8c71c5a..6917b1c9ce 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -51,7 +51,7 @@ #define ONLINE_CB_RETRY 3 #define ONLINE_CB_RETRY_MAX_DELAY 4 -#define OFFLINE_TIMEOUT_RANDOM_OFFSET 30 +#define OFFLINE_TIMEOUT_RANDOM_OFFSET_DEFAULT 30 #define OFFLINE_TIMEOUT_DEFAULT 60 #define OFFLINE_TIMEOUT_MAX_DEFAULT 3600 @@ -134,10 +134,30 @@ static int get_offline_timeout_max(struct be_ctx *ctx) return offline_timeout_max; } +static int get_offline_timeout_radnom_offset(struct be_ctx *ctx) +{ + int offline_timeout_random_offset; + errno_t ret; + + ret = confdb_get_int(ctx->cdb, ctx->conf_path, + CONFDB_DOMAIN_REFRESH_MAX_RANDOM_OFFSET, + OFFLINE_TIMEOUT_RANDOM_OFFSET_DEFAULT, + &offline_timeout_random_offset); + if (ret != EOK) { + DEBUG(SSSDBG_CONF_SETTINGS, + "Failed to get refresh_max_random_offset from confdb. " + "Will use %d seconds.\n", OFFLINE_TIMEOUT_RANDOM_OFFSET_DEFAULT); + offline_timeout_random_offset = OFFLINE_TIMEOUT_RANDOM_OFFSET_DEFAULT; + } + + return offline_timeout_random_offset; +} + void be_mark_offline(struct be_ctx *ctx) { int offline_timeout; int offline_timeout_max; + int offline_timeout_random_offset; errno_t ret; DEBUG(SSSDBG_TRACE_INTERNAL, "Going offline!\n"); @@ -152,13 +172,14 @@ void be_mark_offline(struct be_ctx *ctx) offline_timeout = get_offline_timeout(ctx); offline_timeout_max = get_offline_timeout_max(ctx); + offline_timeout_random_offset = get_offline_timeout_radnom_offset(ctx); ret = be_ptask_create_sync(ctx, ctx, offline_timeout, offline_timeout, offline_timeout, - OFFLINE_TIMEOUT_RANDOM_OFFSET, + offline_timeout_random_offset, offline_timeout, offline_timeout_max, try_to_go_online,
_______________________________________________ sssd-devel mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/[email protected] Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
