From: Bert Hubert Date: Tue, 17 Jun 2008 21:33:18 +0000 (+0000) Subject: implement wiping of the negative query cache, plus document it. suggested by simon... X-Git-Tag: rec-3.1.7.1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=400ca6db4a109240b328429d4c24968fd5726d90;p=thirdparty%2Fpdns.git implement wiping of the negative query cache, plus document it. suggested by simon kirby git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1204 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/docs/pdns.sgml b/pdns/docs/pdns.sgml index 8e53246bf5..b096e4a389 100644 --- a/pdns/docs/pdns.sgml +++ b/pdns/docs/pdns.sgml @@ -138,6 +138,13 @@ Sten Spans spotted that for outgoing TCP/IP queries, the query-local-address setting was not honored. Fixed in c1190. + + + rec_control wipe-cache now also wipes domains from the negative cache, hurrying up the expiry + of negatively cached records. Suggested by Simon Kirby, implemented in c1204. + + + Marcus Rueckert of OpenSUSE reported that very recent gcc versions emitted a (correct) warning on an overly complicated line diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 5b5ea02b51..c33088c9c1 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -90,11 +90,16 @@ string doDumpCache(T begin, T end) template string doWipeCache(T begin, T end) { - int count=0; - for(T i=begin; i != end; ++i) + int count=0, countNeg=0; + for(T i=begin; i != end; ++i) { count+=RC.doWipeCache(toCanonic("", *i)); + string canon=toCanonic("", *i); + countNeg+=SyncRes::s_negcache.count(tie(canon)); + pair range=SyncRes::s_negcache.equal_range(tie(canon)); + SyncRes::s_negcache.erase(range.first, range.second); + } - return "wiped "+lexical_cast(count)+" records\n"; + return "wiped "+lexical_cast(count)+" records, "+lexical_cast(countNeg)+" negative records\n"; } template