From: Bert Hubert Date: Mon, 23 Jun 2008 06:04:18 +0000 (+0000) Subject: implement purging whole lists of domains or suffixes instead of 1 at a time X-Git-Tag: rec-3.1.7.1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e63ea45c2f20655a22e82dab5e6ba18d85879264;p=thirdparty%2Fpdns.git implement purging whole lists of domains or suffixes instead of 1 at a time git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1221 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/communicator.cc b/pdns/communicator.cc index 912535abfa..d536fe9ffc 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -221,7 +221,9 @@ void CommunicatorClass::masterUpdateCheck(PacketHandler *P) for(vector::const_iterator i=cmdomains.begin();i!=cmdomains.end();++i) { extern PacketCache PC; - PC.purge(i->zone); // fixes cvstrac ticket #30 + vector topurge; + topurge.push_back(i->zone); + PC.purge(topurge); // fixes cvstrac ticket #30 queueNotifyDomain(i->zone,P->getBackend()); i->backend->setNotified(i->id,i->serial); } diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 05eb3dad9f..580c1e1803 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -116,7 +116,7 @@ string DLPurgeHandler(const vector&parts, Utility::pid_t ppid) int ret; if(parts.size()>1) - ret=PC.purge(parts[1]); + ret=PC.purge(parts); else ret=PC.purge(); os< &matches) { WriteLock l(&d_mut); int delcount=0; - - if(match.empty()) { + + if(matches.empty()) { delcount = d_map.size(); d_map.clear(); *statnumentries=0; @@ -210,31 +210,33 @@ int PacketCache::purge(const string &match) 'www.userpowerdns.com' */ - if(ends_with(match, "$")) { - string suffix(match); - suffix.resize(suffix.size()-1); - - // cerr<<"Begin dump!"<qname, suffix) && !iends_with(iter->qname, dotsuffix)) { - // cerr<<"Stopping!"<::const_iterator match = ++matches.begin(); match != matches.end() ; ++match) { + if(ends_with(*match, "$")) { + string suffix(*match); + suffix.resize(suffix.size()-1); + + // cerr<<"Begin dump!"<qname, suffix) && !iends_with(iter->qname, dotsuffix)) { + // cerr<<"Stopping!"<qname<<"'\n"; + + delcount++; } - // cerr<<"Will erase '"<qname<<"'\n"; - - delcount++; + // cerr<<"End dump!"< range = d_map.equal_range(tie(*match)); + d_map.erase(range.first, range.second); } - // cerr<<"End dump!"< range = d_map.equal_range(tie(match)); - d_map.erase(range.first, range.second); } *statnumentries=d_map.size(); return delcount; diff --git a/pdns/packetcache.hh b/pdns/packetcache.hh index 2a1412cbae..7ba0b20e3c 100644 --- a/pdns/packetcache.hh +++ b/pdns/packetcache.hh @@ -90,7 +90,7 @@ public: int size(); //!< number of entries in the cache void cleanup(); //!< force the cache to preen itself from expired packets - int purge(const string &prefix=""); + int purge(const vector&matches= vector()); map getCounts(); private: