[svn] commit: r2230 - in /branches/trac192/src: bin/auth/ lib/datasrc/ lib/datasrc/tests/
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Jun 23 07:08:57 UTC 2010
Author: each
Date: Wed Jun 23 07:08:57 2010
New Revision: 2230
Log:
Addressed more review comments.
- expanded documentation
- changed cache() and ncache() functions to addPositive() and addNegative()
- instantiate the HotCache as part of AuthSrvImpl and pass it into
the Query constructor rather than using a static class member in the
Query class.
Modified:
branches/trac192/src/bin/auth/auth_srv.cc
branches/trac192/src/lib/datasrc/cache.cc
branches/trac192/src/lib/datasrc/cache.h
branches/trac192/src/lib/datasrc/data_source.cc
branches/trac192/src/lib/datasrc/query.cc
branches/trac192/src/lib/datasrc/query.h
branches/trac192/src/lib/datasrc/tests/cache_unittest.cc
branches/trac192/src/lib/datasrc/tests/datasrc_unittest.cc
branches/trac192/src/lib/datasrc/tests/query_unittest.cc
Modified: branches/trac192/src/bin/auth/auth_srv.cc
==============================================================================
--- branches/trac192/src/bin/auth/auth_srv.cc (original)
+++ branches/trac192/src/bin/auth/auth_srv.cc Wed Jun 23 07:08:57 2010
@@ -76,6 +76,9 @@
/// Currently non-configurable, but will be.
static const uint16_t DEFAULT_LOCAL_UDPSIZE = 4096;
+
+ /// Hot spot cache
+ isc::datasrc::HotCache cache_;
};
AuthSrvImpl::AuthSrvImpl() : cs_(NULL), verbose_mode_(false)
@@ -239,7 +242,7 @@
message.setUDPSize(AuthSrvImpl::DEFAULT_LOCAL_UDPSIZE);
try {
- Query query(message, dnssec_ok);
+ Query query(message, impl_->cache_, dnssec_ok);
impl_->data_sources_.doQuery(query);
} catch (const Exception& ex) {
if (impl_->verbose_mode_) {
Modified: branches/trac192/src/lib/datasrc/cache.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/cache.cc (original)
+++ branches/trac192/src/lib/datasrc/cache.cc Wed Jun 23 07:08:57 2010
@@ -60,8 +60,8 @@
/// \param rrset The \c RRset to cache.
/// \param flags The query response flags returned from the low-level
/// data source when this \c RRset was looked up.
- /// \param interval How long the cache node is to be considered valid.
- CacheNode(const RRsetPtr rrset, uint32_t flags, time_t interval);
+ /// \param lifespan How long the cache node is to be considered valid.
+ CacheNode(const RRsetPtr rrset, uint32_t flags, time_t lifespan);
/// \brief Constructor for negative cache entry.
///
@@ -71,12 +71,12 @@
/// \param flags Query response flags returned from the low-level
/// data source, indicating why this lookup failed (name not found,
/// type not found, etc).
- /// \param interval How long the cache node is to be considered valid.
+ /// \param lifespan How long the cache node is to be considered valid.
CacheNode(const Name& name,
const RRClass& rrclass,
const RRType& rrtype,
uint32_t flags,
- time_t interval);
+ time_t lifespan);
// \brief Destructor
~CacheNode();
@@ -164,11 +164,11 @@
// CacheNode constructors
CacheNode::CacheNode(const RRsetPtr rrset, const uint32_t flags,
- const time_t interval) :
+ const time_t lifespan) :
qname(rrset->getName()), qclass(rrset->getClass()), qtype(rrset->getType())
{
const time_t now = time(NULL);
- expiry = now + interval;
+ expiry = now + lifespan;
entry = CacheEntryPtr(new CacheEntry(rrset, flags));
prev = CacheNodePtr();
@@ -179,11 +179,11 @@
const RRClass& rrclass,
const RRType& rrtype,
const uint32_t flags,
- const time_t interval) :
+ const time_t lifespan) :
qname(name), qclass(rrclass), qtype(rrtype)
{
const time_t now = time(NULL);
- expiry = now + interval;
+ expiry = now + lifespan;
entry = CacheEntryPtr(new CacheEntry(RRsetPtr(), flags));
prev = CacheNodePtr();
@@ -307,21 +307,23 @@
}
void
-HotCache::cache(RRsetPtr rrset, const uint32_t flags, const time_t interval) {
- impl_->insert(CacheNodePtr(new CacheNode(rrset, flags, interval)));
-}
-
-void
-HotCache::ncache(const Name& name, const RRClass &rrclass,
- const RRType& rrtype, const uint32_t flags,
- const time_t interval)
+HotCache::addPositive(RRsetPtr rrset, const uint32_t flags,
+ const time_t lifespan)
+{
+ impl_->insert(CacheNodePtr(new CacheNode(rrset, flags, lifespan)));
+}
+
+void
+HotCache::addNegative(const Name& name, const RRClass &rrclass,
+ const RRType& rrtype, const uint32_t flags,
+ const time_t lifespan)
{
if (rrtype == RRType::ANY() || rrclass == RRClass::ANY()) {
return;
}
impl_->insert(CacheNodePtr(new CacheNode(name, rrclass, rrtype,
- flags, interval)));
+ flags, lifespan)));
}
bool
Modified: branches/trac192/src/lib/datasrc/cache.h
==============================================================================
--- branches/trac192/src/lib/datasrc/cache.h (original)
+++ branches/trac192/src/lib/datasrc/cache.h Wed Jun 23 07:08:57 2010
@@ -39,24 +39,52 @@
/// \brief A \c HotCache is a hot-spot cache for one or more data sources.
///
-/// A \c HotCache is instantiated as a static member of class \c Query, so
-/// that all instances of \c Query can use the same cache.
-///
-/// Each time <code>DataSrc::doQueryTask()</code> is called, it will
-/// search the hot-spot cache for records matching the query. If a
-/// matching entry is found, and is still within its lifespan, it will
-/// be returned to the calling function.
+/// A \c HotCache must be instantiated prior to creating a \c Query.
+/// The same instance should be passed to the constructor for all queries,
+/// so that all of them will be using the same cache.
+///
+/// The cache may contain positive or negative entries, indicating
+/// whether the data does or does not exist in the underlying data
+/// source. Entries have a fixed and limited lifespan (currently
+/// set to 30 seconds, see LIFESPAN_ below). If a cache entry is
+/// found which has exceeded its lifespan, it will not be returned
+/// to the caller--exactly as if it had not been found.
///
-/// When the requested data is not found in the cache, or is found but
-/// has expired, it will be looked up in the underlying data source.
-/// If found there, it will be cached with a lifespan currently defaulting
-/// to 30 seconds.
+/// The current 30 second cache entry lifespan is experimental. A longer
+/// lifespan would improve performance somewhat; however, longer-lived
+/// cache entries are more likely to be incorrect in the event that
+/// the underlying data source had been updated. Depending on the
+/// frequency of queries and the frequency of updates, longer or
+/// shorter lifespans may be desirable -- it's even possible
+/// we may want the lifespan to be set differently depending on
+/// the zone or the data source (i.e., with an infinite lifespan
+/// for cached data from a static data source). Additional benchmarking
+/// and analysis will be needed for this.
+///
+/// The cache may be configured with a number of available slots for
+/// for entries. The current default is unlimited (see SLOTS_ below),
+/// but if set to a nonzero value, then no more than the specified number
+/// of entries can exist in the cache. If more entries are inserted,
+/// old entries will be dropped in "least recently used" order.
+///
+/// Notes to developers: The current implementation of HotCache uses
+/// a std::map (keyed by isc::dns::Question) to locate nodes, so access
+/// will generally be in O(log n) time. (XXX: This might be faster if a
+/// hash table were used instead.)
+///
+/// A linked list is also maintained to keep track of recent accesses
+/// to cache entries; each time an entry is accessed, it is moved to the
+/// head of the list; when entries need to be removed, they are taken
+/// from the tail of the list. This operation is not locked. BIND 10
+/// does not currently use threads, but if it ever does (or if libdatasrc
+/// is ever used by a threaded application), this will need to be
+//revisited.
class HotCache {
private:
/// \name Static definitions
//@{
/// \brief Default validity period for cache entries
- static const int INTERVAL_ = 30;
+ static const int LIFESPAN_ = 30;
/// \brief Default number of slots in cache
static const int SLOTS_ = 0;
@@ -83,15 +111,21 @@
/// \name Cache Manipulation Methods
//@{
/// \brief Enter a positive cache entry.
+ ///
+ /// If an entry already exists in the cache which matches the
+ /// name/class/type of the RRset being cached, then the old entry
+ /// is removed before the the new one is inserted. (XXX: This is
+ /// currently slightly inefficient; it would be quicker to keep the
+ /// existing node and simply update the rrset, flags, and lifespan.)
///
/// \param rrset The \c RRset to cache.
/// \param flags The query response flags returned from the low-level
/// data source when this \c RRset was looked up.
- /// \param interval How long the cache node is to be considered valid;
+ /// \param lifespan How long the cache node is to be considered valid;
/// defaulting to 30 seconds.
- void cache(isc::dns::RRsetPtr rrset,
- uint32_t flags,
- time_t interval = INTERVAL_);
+ void addPositive(isc::dns::RRsetPtr rrset,
+ uint32_t flags,
+ time_t lifespan = LIFESPAN_);
/// \brief Enter a negative cache entry.
///
@@ -99,6 +133,11 @@
/// cache, so instead a null \c RRsetPtr will be stored. Since the
/// name, class, and type cannot be retrieved from an \c RRset, they
/// must be specified in the parameters.
+ ///
+ /// If an entry already exists in the cache which matches the
+ /// specified name/class/type, then the old entry is removed
+ /// before the the new one is inserted. (XXX: As noted in the comments
+ /// for addPositive(), this is currently slightly inefficient.)
///
/// \param name Query name
/// \param rrclass Query class
@@ -106,17 +145,17 @@
/// \param flags Query response flags returned from the low-level
/// data source, indicating why this lookup failed (name not found,
/// type not found, etc).
- /// \param interval How long the cache node is to be considered valid;
+ /// \param lifespan How long the cache node is to be considered valid;
/// defaulting to 30 seconds.
///
/// Note: 'rrclass' and 'rrtype' must refer to a specific class and
/// type; it is not meaningful to cache type or class ANY. Currently,
/// this condition is silently ignored.
- void ncache(const isc::dns::Name& name,
- const isc::dns::RRClass& rrclass,
- const isc::dns::RRType& rrtype,
- uint32_t flags,
- time_t interval = INTERVAL_);
+ void addNegative(const isc::dns::Name& name,
+ const isc::dns::RRClass& rrclass,
+ const isc::dns::RRType& rrtype,
+ uint32_t flags,
+ time_t lifespan = LIFESPAN_);
/// \brief Retrieve (and promote) a record from the cache
///
@@ -147,10 +186,9 @@
/// \brief Sets the number of slots in the cache.
///
/// If slots is set to zero, the cache can grow without any imposed
- /// limit. If slots is set to a lower number than previous (but not to
- /// zero), and the number of nodes currently in the cache exceeds the
- /// new value of slots, then the oldest records in the cache will
- /// be removed immediately.
+ /// limit. If slots is to set a lower number than the cache currently
+ /// contains, then the least recently used records will be purged from
+ /// the cache until the total number of items in the cache equals slots.
void setSlots(int slots);
/// \brief Returns the number of slots in the cache.
Modified: branches/trac192/src/lib/datasrc/data_source.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/data_source.cc (original)
+++ branches/trac192/src/lib/datasrc/data_source.cc Wed Jun 23 07:08:57 2010
@@ -141,7 +141,7 @@
// Perform the query specified in a QueryTask object
DataSrc::Result
doQueryTask(QueryTask& task, ZoneInfo& zoneinfo, RRsetList& target) {
- HotCache& cache = task.q.cache;
+ HotCache& cache = task.q.cache();
RRsetList rrsets;
RRsetPtr rrset;
ConstCacheNodePtr cnode;
@@ -311,9 +311,9 @@
if (task.flags == 0) {
rrset = target.findRRset(task.qtype, task.qclass);
assert(rrset);
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, task.qtype, task.flags);
+ cache.addNegative(task.qname, task.qclass, task.qtype, task.flags);
}
return (result);
@@ -332,23 +332,23 @@
if (task.qtype == RRType::ANY()) {
BOOST_FOREACH(RRsetPtr rr, target) {
- cache.cache(rr, task.flags);
+ cache.addPositive(rr, task.flags);
}
} else if ((task.flags & DataSrc::CNAME_FOUND) != 0) {
- cache.ncache(task.qname, task.qclass, task.qtype, task.flags);
+ cache.addNegative(task.qname, task.qclass, task.qtype, task.flags);
rrset = target.findRRset(RRType::CNAME(), task.qclass);
assert(rrset);
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else if ((task.flags & DataSrc::DATA_NOT_FOUND) == 0) {
if (task.qtype != RRType::CNAME()) {
- cache.ncache(task.qname, task.qclass, RRType::CNAME(),
- task.flags);
+ cache.addNegative(task.qname, task.qclass, RRType::CNAME(),
+ task.flags);
}
rrset = target.findRRset(task.qtype, task.qclass);
assert(rrset);
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, task.qtype, task.flags);
+ cache.addNegative(task.qname, task.qclass, task.qtype, task.flags);
}
return (result);
@@ -368,16 +368,17 @@
rrset = target.findRRset(RRType::A(), task.qclass);
if (rrset) {
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, RRType::A(), task.flags);
+ cache.addNegative(task.qname, task.qclass, RRType::A(), task.flags);
}
rrset = target.findRRset(RRType::AAAA(), task.qclass);
if (rrset) {
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, RRType::AAAA(), task.flags);
+ cache.addNegative(task.qname, task.qclass, RRType::AAAA(),
+ task.flags);
}
return (result);
@@ -396,21 +397,24 @@
rrset = target.findRRset(RRType::NS(), task.qclass);
if (rrset) {
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, RRType::NS(), task.flags);
+ cache.addNegative(task.qname, task.qclass, RRType::NS(),
+ task.flags);
}
rrset = target.findRRset(RRType::DS(), task.qclass);
if (rrset) {
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, RRType::DS(), task.flags);
+ cache.addNegative(task.qname, task.qclass, RRType::DS(),
+ task.flags);
}
rrset = target.findRRset(RRType::DNAME(), task.qclass);
if (rrset) {
- cache.cache(rrset, task.flags);
+ cache.addPositive(rrset, task.flags);
} else {
- cache.ncache(task.qname, task.qclass, RRType::DNAME(), task.flags);
+ cache.addNegative(task.qname, task.qclass, RRType::DNAME(),
+ task.flags);
}
return (result);
Modified: branches/trac192/src/lib/datasrc/query.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/query.cc (original)
+++ branches/trac192/src/lib/datasrc/query.cc Wed Jun 23 07:08:57 2010
@@ -88,17 +88,9 @@
QueryTask::~QueryTask() {}
-// Initialize the static query cache, used by all instances of Query.
-//
-// NOTE: This object is guaranteed by the C++ specification to be
-// constructed before main() runs, but not necessarily before any
-// global variable's constructor. For safety, it should never be
-// accessed by any constructor, not even Query::Query().
-HotCache Query::cache(0);
-
-Query::Query(Message& m, bool dnssec) :
+Query::Query(Message& m, HotCache& c, bool dnssec) :
status_(PENDING), qname_(NULL), qclass_(NULL), qtype_(NULL),
- message_(&m), want_additional_(true), want_dnssec_(dnssec)
+ cache_(&c), message_(&m), want_additional_(true), want_dnssec_(dnssec)
{
// Check message formatting
if (message_->getRRCount(Section::QUESTION()) != 1) {
Modified: branches/trac192/src/lib/datasrc/query.h
==============================================================================
--- branches/trac192/src/lib/datasrc/query.h (original)
+++ branches/trac192/src/lib/datasrc/query.h Wed Jun 23 07:08:57 2010
@@ -175,7 +175,7 @@
Query& operator=(const Query& source);
public:
// Query constructor
- Query(isc::dns::Message& m, bool dnssec);
+ Query(isc::dns::Message& m, HotCache& c, bool dnssec);
/// \brief The destructor.
virtual ~Query();
//@}
@@ -183,17 +183,17 @@
// wantAdditional() == true indicates that additional-section data
// should be looked up while processing this query. false indicates
// that we're only interested in answer-section data
- bool wantAdditional() { return want_additional_; }
+ bool wantAdditional() { return (want_additional_); }
void setWantAdditional(bool d) { want_additional_ = d; }
// wantDnssec() == true indicates that DNSSEC data should be retrieved
// from the data source when this query is being processed
- bool wantDnssec() const { return want_dnssec_; }
+ bool wantDnssec() const { return (want_dnssec_); }
void setWantDnssec(bool d) { want_dnssec_ = d; }
- const isc::dns::Name& qname() const { return *qname_; }
- const isc::dns::RRClass& qclass() const { return *qclass_; }
- const isc::dns::RRType& qtype() const { return *qtype_; }
+ const isc::dns::Name& qname() const { return (*qname_); }
+ const isc::dns::RRClass& qclass() const { return (*qclass_); }
+ const isc::dns::RRType& qtype() const { return (*qtype_); }
// Note: these can't be constant member functions because they expose
// writable 'handles' of internal member variables. It's questionable
@@ -201,10 +201,10 @@
// corresponding members are public (which itself is not a good practice
// but it's a different topic), but at the moment we keep them.
// We should definitely revisit the design later.
- isc::dns::Message& message() { return *message_; }
- QueryTaskQueue& tasks() { return querytasks_; }
-
- Status status() const { return status_; }
+ isc::dns::Message& message() { return (*message_); }
+ QueryTaskQueue& tasks() { return (querytasks_); }
+
+ Status status() const { return (status_); }
void setStatus(Status s) { status_ = s; }
// Limit CNAME chains to 16 per query, to avoid loops
@@ -216,11 +216,11 @@
}
void setDatasrc(DataSrc* ds) { datasrc_ = ds; }
- DataSrc* datasrc() const { return datasrc_; }
+ DataSrc* datasrc() const { return (datasrc_); }
// \brief The query cache. This is a static member of class \c Query;
// the same cache will be used by all instances.
- static HotCache cache;
+ HotCache& cache() const { return (*cache_); }
private:
Status status_;
@@ -229,6 +229,7 @@
const isc::dns::RRClass* qclass_;
const isc::dns::RRType* qtype_;
+ HotCache* cache_;
DataSrc* datasrc_;
isc::dns::Message* message_;
Modified: branches/trac192/src/lib/datasrc/tests/cache_unittest.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/tests/cache_unittest.cc (original)
+++ branches/trac192/src/lib/datasrc/tests/cache_unittest.cc Wed Jun 23 07:08:57 2010
@@ -53,9 +53,9 @@
cache.setSlots(5);
- cache.cache(a, 1, 30);
- cache.cache(b, 2, 30);
- cache.cache(c, 4, 30);
+ cache.addPositive(a, 1, 30);
+ cache.addPositive(b, 2, 30);
+ cache.addPositive(c, 4, 30);
}
Name test_name;
@@ -74,7 +74,7 @@
RRsetPtr aaaa(new RRset(Name("foo"), RRClass::IN(), RRType::AAAA(),
RRTTL(0)));
aaaa->addRdata(in::AAAA("2001:db8:3:bb::5"));
- cache.cache(aaaa, 0, 4);
+ cache.addPositive(aaaa, 0, 4);
EXPECT_EQ(4, cache.getCount());
@@ -179,7 +179,7 @@
RRsetPtr aaaa(new RRset(Name("foo"), RRClass::IN(), RRType::AAAA(),
RRTTL(0)));
aaaa->addRdata(in::AAAA("2001:db8:3:bb::5"));
- cache.cache(aaaa, 0, 2);
+ cache.addPositive(aaaa, 0, 2);
sleep(3);
@@ -204,25 +204,25 @@
RRsetPtr one(new RRset(Name("one"), RRClass::IN(), RRType::TXT(),
RRTTL(0)));
one->addRdata(generic::TXT("one"));
- cache.cache(one, 0, 30);
+ cache.addPositive(one, 0, 30);
EXPECT_EQ(4, cache.getCount());
RRsetPtr two(new RRset(Name("two"), RRClass::IN(), RRType::TXT(),
RRTTL(0)));
two->addRdata(generic::TXT("two"));
- cache.cache(two, 0, 30);
+ cache.addPositive(two, 0, 30);
EXPECT_EQ(5, cache.getCount());
RRsetPtr three(new RRset(Name("three"), RRClass::IN(), RRType::TXT(),
RRTTL(0)));
three->addRdata(generic::TXT("three"));
- cache.cache(three, 0, 30);
+ cache.addPositive(three, 0, 30);
EXPECT_EQ(5, cache.getCount());
RRsetPtr four(new RRset(Name("four"), RRClass::IN(), RRType::TXT(),
RRTTL(0)));
four->addRdata(generic::TXT("four"));
- cache.cache(four, 0, 30);
+ cache.addPositive(four, 0, 30);
EXPECT_EQ(5, cache.getCount());
hit = cache.retrieve(test_name, RRClass::IN(), RRType::A(), r, f);
@@ -237,7 +237,7 @@
TEST_F(CacheTest, ncache) {
Name missing("missing.example.com");
- cache.ncache(missing, RRClass::IN(), RRType::DNSKEY(), 8, 30);
+ cache.addNegative(missing, RRClass::IN(), RRType::DNSKEY(), 8, 30);
RRsetPtr r;
uint32_t f;
@@ -254,7 +254,7 @@
RRsetPtr a(new RRset(test_name, RRClass::IN(), RRType::A(), RRTTL(300)));
a->addRdata(in::A("192.0.2.100"));
- EXPECT_NO_THROW(cache.cache(a, 16, 30));
+ EXPECT_NO_THROW(cache.addPositive(a, 16, 30));
EXPECT_EQ(3, cache.getCount());
RRsetPtr r;
@@ -264,7 +264,7 @@
EXPECT_TRUE(r);
EXPECT_EQ(16, f);
- EXPECT_NO_THROW(cache.ncache(test_name, RRClass::IN(), RRType::A(), 1, 30));
+ EXPECT_NO_THROW(cache.addNegative(test_name, RRClass::IN(), RRType::A(), 1, 30));
EXPECT_EQ(3, cache.getCount());
hit = cache.retrieve(test_name, RRClass::IN(), RRType::A(), r, f);
Modified: branches/trac192/src/lib/datasrc/tests/datasrc_unittest.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/tests/datasrc_unittest.cc (original)
+++ branches/trac192/src/lib/datasrc/tests/datasrc_unittest.cc Wed Jun 23 07:08:57 2010
@@ -69,6 +69,7 @@
void createAndProcessQuery(const Name& qname, const RRClass& qclass,
const RRType& qtype);
+ HotCache cache;
MetaDataSrc meta_source;
OutputBuffer obuffer;
MessageRenderer renderer;
@@ -76,10 +77,10 @@
};
void
-performQuery(DataSrc& data_source, Message& message) {
+performQuery(DataSrc& data_source, HotCache& cache, Message& message) {
message.setHeaderFlag(MessageFlag::AA());
message.setRcode(Rcode::NOERROR());
- Query q(message, true);
+ Query q(message, cache, true);
data_source.doQuery(q);
}
@@ -92,7 +93,7 @@
msg.fromWire(buffer);
msg.makeResponse();
- performQuery(meta_source, msg);
+ performQuery(meta_source, cache, msg);
}
void
@@ -103,7 +104,7 @@
msg.setOpcode(Opcode::QUERY());
msg.addQuestion(Question(qname, qclass, qtype));
msg.setHeaderFlag(MessageFlag::RD());
- performQuery(meta_source, msg);
+ performQuery(meta_source, cache, msg);
}
void
Modified: branches/trac192/src/lib/datasrc/tests/query_unittest.cc
==============================================================================
--- branches/trac192/src/lib/datasrc/tests/query_unittest.cc (original)
+++ branches/trac192/src/lib/datasrc/tests/query_unittest.cc Wed Jun 23 07:08:57 2010
@@ -35,6 +35,8 @@
class QueryTest : public ::testing::Test {
protected:
void readQuery(Message& m, const char* datafile);
+
+ HotCache cache;
};
void
@@ -47,9 +49,9 @@
}
QueryTaskPtr
-createTask(Message& m, const Name& name, const RRType& rrtype0) {
+createTask(Message& m, const Name& name, const RRType& rrtype0, HotCache& c) {
RRType rrtype(rrtype0);
- Query q(m, true);
+ Query q(m, c, true);
return (QueryTaskPtr(new QueryTask(q, name, rrtype,
QueryTask::SIMPLE_QUERY)));
}
@@ -60,13 +62,13 @@
Message m1(Message::PARSE);
readQuery(m1, "q_wild_a");
QueryTaskPtr task_a = createTask(m1, Name("www.wild.example.com"),
- RRType::A());
+ RRType::A(), cache);
EXPECT_EQ(RRType::A(), task_a->qtype);
Message m2(Message::PARSE);
readQuery(m2, "q_wild_aaaa");
QueryTaskPtr task_aaaa = createTask(m2, Name("www.wild.example.com"),
- RRType::AAAA());
+ RRType::AAAA(), cache);
EXPECT_EQ(RRType::AAAA(), task_aaaa->qtype);
}
More information about the bind10-changes
mailing list