From: Otto Date: Tue, 16 Nov 2021 12:35:58 +0000 (+0100) Subject: Do not count notifies in record cache hits/misses X-Git-Tag: dnsdist-1.7.0-beta2~16^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fd8cf215c84b814f86673d58ed12142e0c36f0f;p=thirdparty%2Fpdns.git Do not count notifies in record cache hits/misses --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index f3ac0a08dc..a0f81e59fd 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -2412,11 +2412,13 @@ static void startDoResolve(void *p) g_log<cacheMisses++; - } - else { - g_recCache->cacheHits++; + if (dc->d_mdp.d_header.opcode != Opcode::Notify) { + if (sr.d_outqueries || sr.d_authzonequeries) { + g_recCache->cacheMisses++; + } + else { + g_recCache->cacheHits++; + } } g_stats.answers(spentUsec); diff --git a/regression-tests.recursor-dnssec/test_Notify.py b/regression-tests.recursor-dnssec/test_Notify.py index 4c2d82445b..6ff0ea346f 100644 --- a/regression-tests.recursor-dnssec/test_Notify.py +++ b/regression-tests.recursor-dnssec/test_Notify.py @@ -106,7 +106,7 @@ f 3600 IN CNAME f ; CNAME loop: dirty trick to get a ServFail in an a print(res) self.assertEquals(res.question[0].to_text(), 'example. IN SOA') - self.checkRecordCacheMetrics(5, 1) # FIXME + self.checkRecordCacheMetrics(3, 1) for method in ("sendUDPQuery", "sendTCPQuery"): sender = getattr(self, method) @@ -114,4 +114,4 @@ f 3600 IN CNAME f ; CNAME loop: dirty trick to get a ServFail in an a self.assertRcodeEqual(res, dns.rcode.NOERROR) self.assertRRsetInAnswer(res, expected) - self.checkRecordCacheMetrics(6, 2) + self.checkRecordCacheMetrics(4, 2)