Commit 4e0adcf3 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] Merge branch 'master' of ssh://bind10.isc.org/var/bind10/git/bind10

parents 87d5f96f 3336f575
237. [bug] naokikambe
Resolved that the stats module wasn't configurable in bindctl in
spite of its having configuration items. The configuration part
was removed from the original spec file "stats.spec" and was
placed in a new spec file "stats-schema.spec". Because it means
definitions of statistics items. The command part is still
there. Thus stats module currently has no its own configuration,
and the items in "stats-schema.spec" are neither visible nor
configurable through bindctl. "stats-schema.spec" is shared with
stats module and stats-httpd module, and maybe with other
statistical modules in future. "stats.spec" has own configuration
and commands of stats module, if it requires.
(Trac#719, git a234b20dc6617392deb8a1e00eb0eed0ff353c0a)
236. [func] jelte
C++ client side of configuration now uses BIND10 logging system.
It also has improved error handling when communicating with the
......
......@@ -807,6 +807,7 @@ AC_OUTPUT([doc/version.ent
src/bin/stats/stats.py
src/bin/stats/stats_httpd.py
src/bin/stats/stats.spec
src/bin/stats/stats-schema.spec
src/bin/stats/stats-httpd.spec
src/bin/stats/stats-httpd-xml.tpl
src/bin/stats/stats-httpd-xsd.tpl
......
......@@ -5,7 +5,7 @@ pkglibexecdir = $(libexecdir)/@PACKAGE@
pkglibexec_SCRIPTS = b10-stats b10-stats-httpd
b10_statsdir = $(pkgdatadir)
b10_stats_DATA = stats.spec stats-httpd.spec
b10_stats_DATA = stats.spec stats-httpd.spec stats-schema.spec
b10_stats_DATA += stats-httpd-xml.tpl stats-httpd-xsd.tpl stats-httpd-xsl.tpl
CLEANFILES = b10-stats stats.pyc
......@@ -13,7 +13,7 @@ CLEANFILES += b10-stats-httpd stats_httpd.pyc
man_MANS = b10-stats.8 b10-stats-httpd.8
EXTRA_DIST = $(man_MANS) b10-stats.xml b10-stats-httpd.xml
EXTRA_DIST += stats.spec stats-httpd.spec
EXTRA_DIST += stats.spec stats-httpd.spec stats-schema.spec
EXTRA_DIST += stats-httpd-xml.tpl stats-httpd-xsd.tpl stats-httpd-xsl.tpl
if ENABLE_MAN
......@@ -28,8 +28,7 @@ endif
# this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
b10-stats: stats.py
$(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" \
-e "s|.*#@@REMOVED@@$$||" stats.py >$@
$(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" stats.py >$@
chmod a+x $@
b10-stats-httpd: stats_httpd.py
......
......@@ -66,6 +66,10 @@ bindctl(1)\&. Please see the manual of
bindctl(1)
about how to configure the settings\&.
.PP
/usr/local/share/bind10\-devel/stats\-schema\&.spec
\(em This is a spec file for data schema of of BIND 10 statistics\&. This schema cannot be configured via
bindctl(1)\&.
.PP
/usr/local/share/bind10\-devel/stats\-httpd\-xml\&.tpl
\(em the template file of XML document\&.
......
......@@ -112,6 +112,12 @@
of <refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum> about
how to configure the settings.
</para>
<para><filename>/usr/local/share/bind10-devel/stats-schema.spec</filename>
<!--TODO: The filename should be computed from prefix-->
&mdash; This is a spec file for data schema of
of BIND 10 statistics. This schema cannot be configured
via <refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum>.
</para>
<para>
<filename>/usr/local/share/bind10-devel/stats-httpd-xml.tpl</filename>
<!--TODO: The filename should be computed from prefix-->
......
......@@ -63,11 +63,17 @@ switches to verbose mode\&. It sends verbose messages to STDOUT\&.
.PP
/usr/local/share/bind10\-devel/stats\&.spec
\(em This is a spec file for
\fBb10\-stats\fR\&. It contains definitions of statistics items of BIND 10 and commands received via
\fBb10\-stats\fR\&. It contains commands for
\fBb10\-stats\fR\&. They can be invoked via
bindctl(1)\&.
.PP
/usr/local/share/bind10\-devel/stats\-schema\&.spec
\(em This is a spec file for data schema of of BIND 10 statistics\&. This schema cannot be configured via
bindctl(1)\&.
.SH "SEE ALSO"
.PP
\fBb10-stats-httpd\fR(8),
\fBbind10\fR(8),
\fBbindctl\fR(1),
\fBb10-auth\fR(8),
......
......@@ -89,16 +89,26 @@
<refsect1>
<title>FILES</title>
<para><filename>/usr/local/share/bind10-devel/stats.spec</filename>
<!--TODO: The filename should be computed from prefix-->
&mdash; This is a spec file for <command>b10-stats</command>. It
contains definitions of statistics items of BIND 10 and commands
received via
<refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum>.
contains commands for <command>b10-stats</command>. They can be
invoked
via <refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum>.
</para>
<para><filename>/usr/local/share/bind10-devel/stats-schema.spec</filename>
<!--TODO: The filename should be computed from prefix-->
&mdash; This is a spec file for data schema of
of BIND 10 statistics. This schema cannot be configured
via <refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum>.
</para>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
<para>
<citerefentry>
<refentrytitle>b10-stats-httpd</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
......
{
"module_spec": {
"module_name": "Stats",
"module_description": "Statistics data schema",
"config_data": [
{
"item_name": "report_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "Report time",
"item_description": "A date time when stats module reports",
"item_format": "date-time"
},
{
"item_name": "bind10.boot_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "bind10.BootTime",
"item_description": "A date time when bind10 process starts initially",
"item_format": "date-time"
},
{
"item_name": "stats.boot_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "stats.BootTime",
"item_description": "A date time when the stats module starts initially or when the stats module restarts",
"item_format": "date-time"
},
{
"item_name": "stats.start_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "stats.StartTime",
"item_description": "A date time when the stats module starts collecting data or resetting values last time",
"item_format": "date-time"
},
{
"item_name": "stats.last_update_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "stats.LastUpdateTime",
"item_description": "The latest date time when the stats module receives from other modules like auth server or boss process and so on",
"item_format": "date-time"
},
{
"item_name": "stats.timestamp",
"item_type": "real",
"item_optional": false,
"item_default": 0.0,
"item_title": "stats.Timestamp",
"item_description": "A current time stamp since epoch time (1970-01-01T00:00:00Z)",
"item_format": "second"
},
{
"item_name": "stats.lname",
"item_type": "string",
"item_optional": false,
"item_default": "",
"item_title": "stats.LocalName",
"item_description": "A localname of stats module given via CC protocol"
},
{
"item_name": "auth.queries.tcp",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "auth.queries.tcp",
"item_description": "A number of total query counts which all auth servers receive over TCP since they started initially"
},
{
"item_name": "auth.queries.udp",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "auth.queries.udp",
"item_description": "A number of total query counts which all auth servers receive over UDP since they started initially"
}
],
"commands": []
}
}
......@@ -24,12 +24,6 @@ from optparse import OptionParser, OptionValueError
from collections import defaultdict
from isc.config.ccsession import ModuleCCSession, create_answer
from isc.cc import Session, SessionError
# Note: Following lines are removed in b10-stats #@@REMOVED@@
if __name__ == 'stats': #@@REMOVED@@
try: #@@REMOVED@@
from fake_time import time, strftime, gmtime #@@REMOVED@@
except ImportError: #@@REMOVED@@
pass #@@REMOVED@@
# for setproctitle
import isc.util.process
......@@ -39,13 +33,15 @@ isc.util.process.rename()
# from a directory relative to that, otherwise we use the ones
# installed on the system
if "B10_FROM_SOURCE" in os.environ:
SPECFILE_LOCATION = os.environ["B10_FROM_SOURCE"] + os.sep + \
"src" + os.sep + "bin" + os.sep + "stats" + os.sep + "stats.spec"
BASE_LOCATION = os.environ["B10_FROM_SOURCE"] + os.sep + \
"src" + os.sep + "bin" + os.sep + "stats"
else:
PREFIX = "@prefix@"
DATAROOTDIR = "@datarootdir@"
SPECFILE_LOCATION = "@datadir@" + os.sep + "@PACKAGE@" + os.sep + "stats.spec"
SPECFILE_LOCATION = SPECFILE_LOCATION.replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
BASE_LOCATION = "@datadir@" + os.sep + "@PACKAGE@"
BASE_LOCATION = BASE_LOCATION.replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
SPECFILE_LOCATION = BASE_LOCATION + os.sep + "stats.spec"
SCHEMA_SPECFILE_LOCATION = BASE_LOCATION + os.sep + "stats-schema.spec"
class Singleton(type):
"""
......@@ -184,8 +180,7 @@ class CCSessionListener(Listener):
self.session = self.subject.session = self.cc_session._session
# initialize internal data
self.config_spec = self.cc_session.get_module_spec().get_config_spec()
self.stats_spec = self.config_spec
self.stats_spec = isc.config.module_spec_from_file(SCHEMA_SPECFILE_LOCATION).get_config_spec()
self.stats_data = self.initialize_data(self.stats_spec)
# add event handler invoked via SessionSubject object
......
......@@ -2,86 +2,7 @@
"module_spec": {
"module_name": "Stats",
"module_description": "Stats daemon",
"config_data": [
{
"item_name": "report_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "Report time",
"item_description": "A date time when stats module reports",
"item_format": "date-time"
},
{
"item_name": "bind10.boot_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "bind10.BootTime",
"item_description": "A date time when bind10 process starts initially",
"item_format": "date-time"
},
{
"item_name": "stats.boot_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "stats.BootTime",
"item_description": "A date time when the stats module starts initially or when the stats module restarts",
"item_format": "date-time"
},
{
"item_name": "stats.start_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "stats.StartTime",
"item_description": "A date time when the stats module starts collecting data or resetting values last time",
"item_format": "date-time"
},
{
"item_name": "stats.last_update_time",
"item_type": "string",
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "stats.LastUpdateTime",
"item_description": "The latest date time when the stats module receives from other modules like auth server or boss process and so on",
"item_format": "date-time"
},
{
"item_name": "stats.timestamp",
"item_type": "real",
"item_optional": false,
"item_default": 0.0,
"item_title": "stats.Timestamp",
"item_description": "A current time stamp since epoch time (1970-01-01T00:00:00Z)",
"item_format": "second"
},
{
"item_name": "stats.lname",
"item_type": "string",
"item_optional": false,
"item_default": "",
"item_title": "stats.LocalName",
"item_description": "A localname of stats module given via CC protocol"
},
{
"item_name": "auth.queries.tcp",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "auth.queries.tcp",
"item_description": "A number of total query counts which all auth servers receive over TCP since they started initially"
},
{
"item_name": "auth.queries.udp",
"item_type": "integer",
"item_optional": false,
"item_default": 0,
"item_title": "auth.queries.udp",
"item_description": "A number of total query counts which all auth servers receive over UDP since they started initially"
}
],
"config_data": [],
"commands": [
{
"command_name": "status",
......
......@@ -46,7 +46,7 @@ else:
BASE_LOCATION = "@datadir@" + os.sep + "@PACKAGE@"
BASE_LOCATION = BASE_LOCATION.replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
SPECFILE_LOCATION = BASE_LOCATION + os.sep + "stats-httpd.spec"
STATS_SPECFILE_LOCATION = BASE_LOCATION + os.sep + "stats.spec"
SCHEMA_SPECFILE_LOCATION = BASE_LOCATION + os.sep + "stats-schema.spec"
XML_TEMPLATE_LOCATION = BASE_LOCATION + os.sep + "stats-httpd-xml.tpl"
XSD_TEMPLATE_LOCATION = BASE_LOCATION + os.sep + "stats-httpd-xsd.tpl"
XSL_TEMPLATE_LOCATION = BASE_LOCATION + os.sep + "stats-httpd-xsl.tpl"
......@@ -175,7 +175,7 @@ class StatsHttpd:
SPECFILE_LOCATION, self.config_handler, self.command_handler)
self.cc_session = self.mccs._session
# read spec file of stats module and subscribe 'Stats'
self.stats_module_spec = isc.config.module_spec_from_file(STATS_SPECFILE_LOCATION)
self.stats_module_spec = isc.config.module_spec_from_file(SCHEMA_SPECFILE_LOCATION)
self.stats_config_spec = self.stats_module_spec.get_config_spec()
self.stats_module_name = self.stats_module_spec.get_module_name()
......
......@@ -23,7 +23,11 @@ import unittest
import imp
from isc.cc.session import Session, SessionError
from isc.config.ccsession import ModuleCCSession, ModuleCCSessionError
from fake_time import time, strftime, gmtime
import stats
stats.time = time
stats.strftime = strftime
stats.gmtime = gmtime
from stats import SessionSubject, CCSessionListener, get_timestamp, get_datetime
from fake_time import _TEST_TIME_SECS, _TEST_TIME_STRF
......@@ -540,9 +544,14 @@ class TestStats2(unittest.TestCase):
os.environ["B10_FROM_SOURCE"] + os.sep + \
"src" + os.sep + "bin" + os.sep + "stats" + \
os.sep + "stats.spec")
self.assertEqual(stats.SCHEMA_SPECFILE_LOCATION,
os.environ["B10_FROM_SOURCE"] + os.sep + \
"src" + os.sep + "bin" + os.sep + "stats" + \
os.sep + "stats-schema.spec")
imp.reload(stats)
# change path of SPECFILE_LOCATION
stats.SPECFILE_LOCATION = TEST_SPECFILE_LOCATION
stats.SCHEMA_SPECFILE_LOCATION = TEST_SPECFILE_LOCATION
self.assertEqual(stats.SPECFILE_LOCATION, TEST_SPECFILE_LOCATION)
self.subject = stats.SessionSubject(session=self.session, verbose=True)
self.session = self.subject.session
......
......@@ -7,7 +7,7 @@ AM_CPPFLAGS += $(SQLITE_CFLAGS)
AM_CXXFLAGS = $(B10_CXXFLAGS)
CLEANFILES = *.gcno *.gcda
CLEANFILES = *.gcno *.gcda messagedef.h messagedef.cc
lib_LTLIBRARIES = libdatasrc.la
libdatasrc_la_SOURCES = data_source.h data_source.cc
......@@ -20,3 +20,16 @@ libdatasrc_la_SOURCES += zonetable.h zonetable.cc
libdatasrc_la_SOURCES += memory_datasrc.h memory_datasrc.cc
libdatasrc_la_SOURCES += zone.h
libdatasrc_la_SOURCES += result.h
libdatasrc_la_SOURCES += logger.h logger.cc
nodist_libdatasrc_la_SOURCES = messagedef.h messagedef.cc
libdatasrc_la_LIBADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
libdatasrc_la_LIBADD += $(top_builddir)/src/lib/dns/libdns++.la
libdatasrc_la_LIBADD += $(top_builddir)/src/lib/log/liblog.la
libdatasrc_la_LIBADD += $(top_builddir)/src/lib/cc/libcc.la
BUILT_SOURCES = messagedef.h messagedef.cc
messagedef.h messagedef.cc: Makefile messagedef.mes
$(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/datasrc/messagedef.mes
EXTRA_DIST = messagedef.mes
......@@ -24,6 +24,7 @@
#include <list>
#include <datasrc/cache.h>
#include <datasrc/logger.h>
using namespace std;
using namespace isc::dns;
......@@ -204,16 +205,21 @@ public:
// HotCacheImpl constructor
HotCacheImpl::HotCacheImpl(int slots, bool enabled) :
enabled_(enabled), slots_(slots), count_(0)
{}
{
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_CACHE_CREATE);
}
// Insert a cache node into the cache
inline void
HotCacheImpl::insert(const CacheNodePtr node) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_INSERT).
arg(node->getRRset()->getName());
std::map<Question, CacheNodePtr>::const_iterator iter;
iter = map_.find(node->question);
if (iter != map_.end()) {
CacheNodePtr old = iter->second;
if (old && old->isValid()) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_OLD_FOUND);
remove(old);
}
}
......@@ -225,6 +231,7 @@ HotCacheImpl::insert(const CacheNodePtr node) {
++count_;
if (slots_ != 0 && count_ > slots_) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_FULL);
remove(lru_.back());
}
}
......@@ -245,6 +252,8 @@ HotCacheImpl::promote(CacheNodePtr node) {
// Remove a node from the LRU list and the map
void
HotCacheImpl::remove(ConstCacheNodePtr node) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_REMOVE).
arg(node->getRRset()->getName());
lru_.erase(node->lru_entry_);
map_.erase(node->question);
--count_;
......@@ -257,6 +266,7 @@ HotCache::HotCache(const int slots) {
// HotCache destructor
HotCache::~HotCache() {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_CACHE_DESTROY);
delete impl_;
}
......@@ -303,18 +313,21 @@ HotCache::retrieve(const Name& n, const RRClass& c, const RRType& t,
std::map<Question, CacheNodePtr>::const_iterator iter;
iter = impl_->map_.find(Question(n, c, t));
if (iter == impl_->map_.end()) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_NOT_FOUND).arg(n);
return (false);
}
CacheNodePtr node = iter->second;
if (node->isValid()) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_FOUND).arg(n);
impl_->promote(node);
rrset = node->getRRset();
flags = node->getFlags();
return (true);
}
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_CACHE_EXPIRED).arg(n);
impl_->remove(node);
return (false);
}
......@@ -328,6 +341,9 @@ HotCache::setSlots(const int slots) {
return;
}
logger.info(DATASRC_CACHE_SLOTS).arg(slots).arg(max(0, impl_->count_ -
slots));
while (impl_->slots_ != 0 && impl_->count_ > impl_->slots_) {
impl_->remove(impl_->lru_.back());
}
......@@ -343,6 +359,11 @@ HotCache::getSlots() const {
void
HotCache::setEnabled(const bool e) {
impl_->enabled_ = e;
if (e) {
logger.info(DATASRC_CACHE_ENABLE);
} else {
logger.info(DATASRC_CACHE_DISABLE);
}
}
/// Indicate whether the cache is enabled
......
......@@ -25,6 +25,7 @@
#include <datasrc/cache.h>
#include <datasrc/data_source.h>
#include <datasrc/query.h>
#include <datasrc/logger.h>
#include <util/encode/base32hex.h>
#include <util/hash/sha1.h>
......@@ -83,7 +84,7 @@ class ZoneInfo {
public:
ZoneInfo(DataSrc* ts,
const isc::dns::Name& n,
const isc::dns::RRClass& c,
const isc::dns::RRClass& c,
const isc::dns::RRType& t = isc::dns::RRType::ANY()) :
top_source_(ts),
dsm_(((t == RRType::DS() && n.getLabelCount() != 1)
......@@ -123,6 +124,8 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
const Rdata& rd(it->getCurrent());
if (rrset->getType() == RRType::NS()) {
const generic::NS& ns = dynamic_cast<const generic::NS&>(rd);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_GET_NS_ADDITIONAL).
arg(ns.getNSName()).arg(rrset->getName());
q.tasks().push(QueryTaskPtr(
new QueryTask(q, ns.getNSName(),
Message::SECTION_ADDITIONAL,
......@@ -130,6 +133,8 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
QueryTask::GETADDITIONAL)));
} else if (rrset->getType() == RRType::MX()) {
const generic::MX& mx = dynamic_cast<const generic::MX&>(rd);
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_GET_MX_ADDITIONAL).
arg(mx.getMXName()).arg(rrset->getName());
q.tasks().push(QueryTaskPtr(
new QueryTask(q, mx.getMXName(),
Message::SECTION_ADDITIONAL,
......@@ -143,11 +148,14 @@ getAdditional(Query& q, ConstRRsetPtr rrset) {
// understand DNAME
void
synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_SYNTH_CNAME).
arg(rrset->getName());
RdataIteratorPtr it = rrset->getRdataIterator();
// More than one DNAME RR in the RRset is illegal, so we only have
// to process the first one.
if (it->isLast()) {
logger.error(DATASRC_QUERY_EMPTY_DNAME).arg(rrset->getName());
return;
}
......@@ -171,16 +179,20 @@ synthesizeCname(QueryTaskPtr task, RRsetPtr rrset, RRsetList& target) {
// to by a CNAME record
void
chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_FOLLOW_CNAME).
arg(rrset->getName());
RdataIteratorPtr it = rrset->getRdataIterator();
// More than one CNAME RR in the RRset is illegal, so we only have
// to process the first one.
if (it->isLast()) {
logger.error(DATASRC_QUERY_EMPTY_CNAME).arg(rrset->getName());
return;
}
// Stop chasing CNAMES after 16 lookups, to prevent loops
if (q.tooMany()) {
logger.error(DATASRC_QUERY_TOO_MANY_CNAMES).arg(rrset->getName());
return;
}
......@@ -194,6 +206,8 @@ chaseCname(Query& q, QueryTaskPtr task, RRsetPtr rrset) {
// Check the cache for data which can answer the current query task.
bool
checkCache(QueryTask& task, RRsetList& target) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_CHECK_CACHE).
arg(task.qname).arg(task.qtype);
HotCache& cache = task.q.getCache();
RRsetList rrsets;
RRsetPtr rrset;
......@@ -206,6 +220,9 @@ checkCache(QueryTask& task, RRsetList& target) {
// ANY queries must be handled by the low-level data source,
// or the results won't be guaranteed to be complete
if (task.qtype == RRType::ANY() || task.qclass == RRClass::ANY()) {
LOG_DEBUG(logger, DBG_TRACE_DATA,
DATASRC_QUERY_NO_CACHE_ANY_SIMPLE).arg(task.qname).
arg(task.qtype).arg(task.qclass);
break;
}
......@@ -235,6 +252,8 @@ checkCache(QueryTask& task, RRsetList& target) {
case QueryTask::AUTH_QUERY: // Find exact RRset or CNAME
if (task.qtype == RRType::ANY() || task.qclass == RRClass::ANY()) {
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_QUERY_NO_CACHE_ANY_AUTH).
arg(task.qname).arg(task.qtype).arg(task.qclass);
break;
}
......@@ -353,6 +372,8 @@ DataSrc::Result
doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
HotCache& cache = task.q.getCache();
RRsetPtr rrset;
LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_DO_QUERY).arg(task.qname).
arg(task.qtype);
// First off, make sure at least we have a matching zone in some data
// source. We must do this before checking the cache, because it can
......@@ -363,11 +384,14 @@ doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
const Name* const zonename = zoneinfo.getEnclosingZone();
if (ds == NULL) {
task.flags |= DataSrc::NO_SUCH_ZONE;
logger.info(DATASRC_QUERY_NO_ZONE).arg(task.qname).arg(task.qclass);
return (DataSrc::SUCCESS);
}
// Then check the cache for matching data