From: Remi Gacogne Date: Wed, 28 Feb 2018 10:26:03 +0000 (+0000) Subject: rec: Count a lookup into an internal auth zone as a cache miss X-Git-Tag: dnsdist-1.3.0~70^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7b8cffae1ff94c2e78ac6f3b3ee494735a0c23c;p=pdns rec: Count a lookup into an internal auth zone as a cache miss We only considered a query a cache miss if we had to do at least one outgoing query, but having to look up into one of the internally hosted zone (auth-zones) should count as a cache miss too. --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index c2b916be6..60fc1ccab 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1288,7 +1288,12 @@ static void startDoResolve(void *p) } - sr.d_outqueries ? t_RC->cacheMisses++ : t_RC->cacheHits++; + if (sr.d_outqueries || sr.d_authzonequeries) { + t_RC->cacheMisses++; + } + else { + t_RC->cacheHits++; + } if(spent < 0.001) g_stats.answers0_1++; diff --git a/pdns/syncres.cc b/pdns/syncres.cc index b1b331003..7cd9c5461 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -320,8 +320,10 @@ int SyncRes::AuthDomain::getRecords(const DNSName& qname, uint16_t qtype, std::v return result; } -bool SyncRes::doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector&ret, int& res) const +bool SyncRes::doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector&ret, int& res) { + d_authzonequeries++; + res = domain.getRecords(qname, qtype.getCode(), ret); return true; } diff --git a/pdns/syncres.hh b/pdns/syncres.hh index a73bd7bc5..b297eac07 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -697,6 +697,7 @@ public: std::unordered_map d_discardedPolicies; DNSFilterEngine::Policy d_appliedPolicy; + unsigned int d_authzonequeries; unsigned int d_outqueries; unsigned int d_tcpoutqueries; unsigned int d_throttledqueries; @@ -736,7 +737,7 @@ private: bool processAnswer(unsigned int depth, LWResult& lwr, const DNSName& qname, const QType& qtype, DNSName& auth, bool wasForwarded, const boost::optional ednsmask, bool sendRDQuery, NsSet &nameservers, std::vector& ret, const DNSFilterEngine& dfe, bool* gotNewServers, int* rcode, vState& state); int doResolve(const DNSName &qname, const QType &qtype, vector&ret, unsigned int depth, set& beenthere, vState& state); - bool doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector&ret, int& res) const; + bool doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector&ret, int& res); bool doOOBResolve(const DNSName &qname, const QType &qtype, vector&ret, unsigned int depth, int &res); domainmap_t::const_iterator getBestAuthZone(DNSName* qname) const; bool doCNAMECacheCheck(const DNSName &qname, const QType &qtype, vector&ret, unsigned int depth, int &res, vState& state, bool wasAuthZone);