BIND 10 trac741, updated. 612a96ab3eea34e232fd97e834599745401b73eb [trac741] Log statements for message cache

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jul 1 11:40:05 UTC 2011


The branch, trac741 has been updated
       via  612a96ab3eea34e232fd97e834599745401b73eb (commit)
      from  b9755c94e619471f8d9769c7c0d230c1e40b9584 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 612a96ab3eea34e232fd97e834599745401b73eb
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Jul 1 13:39:14 2011 +0200

    [trac741] Log statements for message cache

-----------------------------------------------------------------------

Summary of changes:
 src/lib/cache/cache_messages.mes |   16 ++++++++++++++++
 src/lib/cache/message_cache.cc   |   20 ++++++++++++++++++++
 src/lib/cache/message_cache.h    |    2 +-
 3 files changed, 37 insertions(+), 1 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/cache/cache_messages.mes b/src/lib/cache/cache_messages.mes
index 7637e0c..429c746 100644
--- a/src/lib/cache/cache_messages.mes
+++ b/src/lib/cache/cache_messages.mes
@@ -19,3 +19,19 @@ $NAMESPACE isc::cache
 % CACHE_LOCALZONE_UNKNOWN entry with key %1 not found in local zone data
 
 % CACHE_LOCALZONE_FOUND found entry with key %1 in local zone data
+
+% CACHE_MESSAGES_INIT initialized message cache for %1 %2 messages
+
+% CACHE_MESSAGES_DEINIT deinitialized message cache
+
+% CACHE_MESSAGES_FOUND found a message entry for %1 in the message cache
+
+% CACHE_MESSAGES_EXPIRED found an expired message entry for %1 in the message cache
+
+% CACHE_MESSAGES_UNKNOWN no entry for %1 found in the message cache
+
+% CACHE_MESSAGES_UNCACHEABLE not inserting uncacheable message %1/%2/%3
+
+% CACHE_MESSAGES_UPDATE updating message entry %1/%2/%3
+
+% CACHE_MESSAGES_REMOVE removing old instance of %1/%2/%3 first
diff --git a/src/lib/cache/message_cache.cc b/src/lib/cache/message_cache.cc
index 816ffe3..e141bb5 100644
--- a/src/lib/cache/message_cache.cc
+++ b/src/lib/cache/message_cache.cc
@@ -1,6 +1,7 @@
 // Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
+//
 // purpose with or without fee is hereby granted, provided that the above
 // copyright notice and this permission notice appear in all copies.
 //
@@ -20,6 +21,7 @@
 #include "message_cache.h"
 #include "message_utility.h"
 #include "cache_entry_key.h"
+#include "logger.h"
 
 namespace isc {
 namespace cache {
@@ -39,11 +41,14 @@ MessageCache::MessageCache(const RRsetCachePtr& rrset_cache,
     message_lru_((3 * cache_size),
                   new HashDeleter<MessageEntry>(message_table_))
 {
+    LOG_DEBUG(logger, DBG_TRACE_BASIC, CACHE_MESSAGES_INIT).arg(cache_size).
+        arg(RRClass(message_class));
 }
 
 MessageCache::~MessageCache() {
     // Destroy all the message entries in the cache.
     message_lru_.clear();
+    LOG_DEBUG(logger, DBG_TRACE_BASIC, CACHE_MESSAGES_DEINIT);
 }
 
 bool
@@ -57,26 +62,38 @@ MessageCache::lookup(const isc::dns::Name& qname,
     if(msg_entry) {
         // Check whether the message entry has expired.
        if (msg_entry->getExpireTime() > time(NULL)) {
+            LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_MESSAGES_FOUND).
+                arg(entry_name);
             message_lru_.touch(msg_entry);
             return (msg_entry->genMessage(time(NULL), response));
         } else {
             // message entry expires, remove it from hash table and lru list.
+            LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_MESSAGES_EXPIRED).
+                arg(entry_name);
             message_table_.remove(entry_key);
             message_lru_.remove(msg_entry);
             return (false);
        }
     }
 
+    LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_MESSAGES_UNKNOWN).arg(entry_name);
     return (false);
 }
 
 bool
 MessageCache::update(const Message& msg) {
     if (!canMessageBeCached(msg)){
+        LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_MESSAGES_UNCACHEABLE).
+            arg((*msg.beginQuestion())->getName()).
+            arg((*msg.beginQuestion())->getType()).
+            arg((*msg.beginQuestion())->getClass());
         return (false);
     }
 
     QuestionIterator iter = msg.beginQuestion();
+    LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_MESSAGES_UPDATE).
+        arg((*iter)->getName()).arg((*iter)->getType()).
+        arg((*iter)->getClass());
     std::string entry_name = genCacheEntryName((*iter)->getName(),
                                                (*iter)->getType());
     HashKey entry_key = HashKey(entry_name, RRClass(message_class_));
@@ -88,6 +105,9 @@ MessageCache::update(const Message& msg) {
     // add the message entry, maybe there is one way to touch it once.
     MessageEntryPtr old_msg_entry = message_table_.get(entry_key);
     if (old_msg_entry) {
+        LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_MESSAGES_REMOVE).
+            arg((*iter)->getName()).arg((*iter)->getType()).
+            arg((*iter)->getClass());
         message_lru_.remove(old_msg_entry);
     }
 
diff --git a/src/lib/cache/message_cache.h b/src/lib/cache/message_cache.h
index 979b814..44d7fd1 100644
--- a/src/lib/cache/message_cache.h
+++ b/src/lib/cache/message_cache.h
@@ -39,7 +39,7 @@ private:
     MessageCache& operator=(const MessageCache& source);
 public:
     /// \param rrset_cache The cache that stores the RRsets that the
-    ///        message entry will points to
+    ///        message entry will point to
     /// \param cache_size The size of message cache.
     /// \param message_class The class of the message cache
     /// \param negative_soa_cache The cache that stores the SOA record




More information about the bind10-changes mailing list