On 09/22/2015 10:25 AM, Pavel Březina wrote:
On 09/21/2015 04:33 PM, Pavel Reichl wrote:
Hello, please see simple patch attached.

Hi,
the patch looks good in general. However, I'd like to rephrase the warning.

+              "%s is lesser then %s, sysdb will not be updated for users.\n",
                         ^lower

How about:

%s is lower then %s. User records will not be updated before memory cache entry 
expires.

%s is lower then %s. User records will not be updated before memory cache entry 
gets expired.
_______________________________________________

Hello Pavel, thanks for comment. I updated the patch as you proposed.

I did quick research on usage of smaller/lower/lesser and all seem to for 
correct for our case, but I agree that lower might sound more common.
>From 531820bf4bd3c85dbf78b0390aa6cc58d140cd19 Mon Sep 17 00:00:00 2001
From: Pavel Reichl <prei...@redhat.com>
Date: Mon, 21 Sep 2015 10:26:20 -0400
Subject: [PATCH] confdb: warn if memcache_timeout > than entry_cache

Only group and user records are cached in memory cache so only timeouts
for those are checked.

Resolves:
https://fedorahosted.org/sssd/ticket/2176
---
 src/confdb/confdb.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index c097aad7745eda4fff051c7da027776f95db0f03..5403a6153b26448d9396725cca958f77330d9bee 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -827,6 +827,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
     uint32_t entry_cache_timeout;
     char *default_domain;
     bool fqnames_default = false;
+    int memcache_timeout;
 
     tmp_ctx = talloc_new(mem_ctx);
     if (!tmp_ctx) return ENOMEM;
@@ -851,6 +852,16 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
         goto done;
     }
 
+    ret = confdb_get_int(cdb,
+                         CONFDB_NSS_CONF_ENTRY,
+                         CONFDB_MEMCACHE_TIMEOUT,
+                         300, &memcache_timeout);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_FATAL_FAILURE,
+              "Unable to get memory cache entry timeout.\n");
+        goto done;
+    }
+
     domain = talloc_zero(mem_ctx, struct sss_domain_info);
     if (!domain) {
         ret = ENOMEM;
@@ -1078,6 +1089,13 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
         goto done;
     }
 
+    if (domain->user_timeout < memcache_timeout) {
+        DEBUG(SSSDBG_CONF_SETTINGS,
+              "%s is lower then %s. User records will not be updated "
+              "before memory cache entry expires.\n",
+              CONFDB_DOMAIN_USER_CACHE_TIMEOUT, CONFDB_MEMCACHE_TIMEOUT);
+    }
+
     /* Override the group cache timeout, if specified */
     ret = get_entry_as_uint32(res->msgs[0], &domain->group_timeout,
                               CONFDB_DOMAIN_GROUP_CACHE_TIMEOUT,
@@ -1089,6 +1107,13 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
         goto done;
     }
 
+    if (domain->group_timeout < memcache_timeout) {
+        DEBUG(SSSDBG_CONF_SETTINGS,
+              "%s is lower then %s. Group records will not be updated "
+              "before memory cache entry expires.\n",
+              CONFDB_DOMAIN_GROUP_CACHE_TIMEOUT, CONFDB_MEMCACHE_TIMEOUT);
+    }
+
     /* Override the netgroup cache timeout, if specified */
     ret = get_entry_as_uint32(res->msgs[0], &domain->netgroup_timeout,
                               CONFDB_DOMAIN_NETGROUP_CACHE_TIMEOUT,
-- 
2.4.3

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to