]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Count a lookup into an internal auth zone as a cache miss
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 28 Feb 2018 10:26:03 +0000 (10:26 +0000)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 16 May 2018 12:15:15 +0000 (14:15 +0200)
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.

(cherry picked from commit f7b8cffae1ff94c2e78ac6f3b3ee494735a0c23c)

pdns/pdns_recursor.cc
pdns/syncres.cc
pdns/syncres.hh

index 1371ea605ae8aeaab06d4200f4fe664f19c93510..9410796dd5d50c8e3a895b292029b8a478631d62 100644 (file)
@@ -1263,7 +1263,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++;
index d7d46a0a09e13b7b8c6364099ef12fb19626d607..d03be8e807c7b90ec44bfc526d2ef8746cad6959 100644 (file)
@@ -319,8 +319,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<DNSRecord>&ret, int& res) const
+bool SyncRes::doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, int& res)
 {
+  d_authzonequeries++;
+
   res = domain.getRecords(qname, qtype.getCode(), ret);
   return true;
 }
index 33dae04805802a6492774308baa1ce8acaa85687..f53710f2f491535d9679ad38c19ce9ad4d4e0c63 100644 (file)
@@ -693,6 +693,7 @@ public:
 
   std::unordered_map<std::string,bool> d_discardedPolicies;
   DNSFilterEngine::Policy d_appliedPolicy;
+  unsigned int d_authzonequeries;
   unsigned int d_outqueries;
   unsigned int d_tcpoutqueries;
   unsigned int d_throttledqueries;
@@ -730,7 +731,7 @@ private:
   bool processAnswer(unsigned int depth, LWResult& lwr, const DNSName& qname, const QType& qtype, DNSName& auth, bool wasForwarded, const boost::optional<Netmask> ednsmask, bool sendRDQuery, NsSet &nameservers, std::vector<DNSRecord>& ret, const DNSFilterEngine& dfe, bool* gotNewServers, int* rcode, vState& state);
 
   int doResolve(const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, unsigned int depth, set<GetBestNSAnswer>& beenthere, vState& state);
-  bool doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, int& res) const;
+  bool doOOBResolve(const AuthDomain& domain, const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, int& res);
   bool doOOBResolve(const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, unsigned int depth, int &res);
   domainmap_t::const_iterator getBestAuthZone(DNSName* qname) const;
   bool doCNAMECacheCheck(const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, unsigned int depth, int &res, vState& state, bool wasAuthZone);