gencache: if a key exists, log its stored value.
authorMichael Adam <obnox@samba.org>
Thu, 5 Feb 2015 14:55:30 +0000 (15:55 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 17 Mar 2015 06:19:19 +0000 (07:19 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/lib/gencache.c

index d9cc08195d487065b9cd5a3c1c3d8896afd68a4d..4c95b399b0612bbfa8996eb55a60e7371342c24b 100644 (file)
@@ -281,7 +281,7 @@ bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
                            time_t timeout)
 {
        int ret;
-       char* val;
+       char* val = NULL;
        time_t last_stabilize;
        static int writecount;
 
@@ -298,8 +298,22 @@ bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
        if (!gencache_init()) return False;
 
        if (gencache_have_val(keystr, blob, timeout)) {
-               DEBUG(10, ("Did not store value for %s, we already got it\n",
-                          keystr));
+               if (CHECK_DEBUGLVL(10)) {
+                       bool ok;
+
+                       ok = gencache_get(keystr, talloc_tos(), &val, &timeout);
+                       if (!ok) {
+                               DEBUG(10, ("Did not store value for key=[%s]: "
+                                          "It exists, but failed failed to "
+                                          "get it from the db!\n", keystr));
+                       } else {
+                               DEBUG(10, ("Did not store value for key=[%s], "
+                                          "we already got it: val=[%s]\n",
+                                          keystr, val));
+                       }
+                       TALLOC_FREE(val);
+               }
+
                return true;
        }