]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Rename domaincache to zonecache, also ttl to refreshinterval
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Tue, 18 May 2021 19:18:56 +0000 (21:18 +0200)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Tue, 18 May 2021 20:25:55 +0000 (22:25 +0200)
25 files changed:
docs/settings.rst
modules/bindbackend/bindbackend2.cc
modules/remotebackend/Makefile.am
modules/remotebackend/test-remotebackend-http.cc
modules/remotebackend/test-remotebackend-json.cc
modules/remotebackend/test-remotebackend-pipe.cc
modules/remotebackend/test-remotebackend-post.cc
modules/remotebackend/test-remotebackend-unix.cc
modules/remotebackend/test-remotebackend-zeromq.cc
pdns/Makefile.am
pdns/auth-zonecache.cc [moved from pdns/auth-domaincache.cc with 62% similarity]
pdns/auth-zonecache.hh [moved from pdns/auth-domaincache.hh with 78% similarity]
pdns/common_startup.cc
pdns/common_startup.hh
pdns/pdnsutil.cc
pdns/receiver.cc
pdns/test-auth-zonecache_cc.cc [moved from pdns/test-auth-domaincache_cc.cc with 74% similarity]
pdns/test-ueberbackend_cc.cc
pdns/testrunner.cc
pdns/ueberbackend.cc
pdns/ueberbackend.hh
regression-tests/backends/gsql-common
regression-tests/backends/gsqlite3-master
regression-tests/backends/ldap-master
regression-tests/tests/bind-add-zone/command

index 9a3774aeb91e657465acf25156ffbcbf424bca77..4e6ff0fbaf2de67fce373c671c9cbd7de66ab9d0 100644 (file)
@@ -171,18 +171,6 @@ Maximum time in seconds for inbound AXFR to start or be idle after starting.
 
 Also AXFR a zone from a master with a lower serial.
 
-.. _setting-domain-cache-ttl:
-
-``domain-cache-ttl``
---------------------
-
--  Integer
--  Default: 0
-
-Seconds to cache a list of all known domains. A value of 0 will disable the cache.
-
-If your backends do not respond to unknown domains, it is suggested to enable :ref:`setting-consistent-backends` and set this option to `60`.
-
 .. _setting-cache-ttl:
 
 ``cache-ttl``
@@ -1894,3 +1882,15 @@ checking for updates to zones.
 Specifies the maximum number of received megabytes allowed on an
 incoming AXFR/IXFR update, to prevent resource exhaustion. A value of 0
 means no restriction.
+
+.. _setting-zone-cache-refresh-interval:
+
+``zone-cache-refresh-interval``
+-------------------------------
+
+-  Integer
+-  Default: 0
+
+Seconds to cache a list of all known zones. A value of 0 will disable the cache.
+
+If your backends do not respond to unknown or dynamically generated zones, it is suggested to enable :ref:`setting-consistent-backends` and set this option to `60`.
index 750125276f8cd22f2fd8029bc4f40c4bba03c886..80c693532db62e26da423a166f8dadc0fefe7017 100644 (file)
@@ -53,7 +53,7 @@
 #include "pdns/misc.hh"
 #include "pdns/dynlistener.hh"
 #include "pdns/lock.hh"
-#include "pdns/auth-domaincache.hh"
+#include "pdns/auth-zonecache.hh"
 
 /* 
    All instances of this backend share one s_state, which is indexed by zone name and zone id.
@@ -704,7 +704,7 @@ string Bind2Backend::DLAddDomainHandler(const vector<string>& parts, Utility::pi
 
   safePutBBDomainInfo(bbd);
 
-  g_domainCache.add(domainname, bbd.d_id); // make new domain visible
+  g_zoneCache.add(domainname, bbd.d_id); // make new zone visible
 
   g_log << Logger::Warning << "Zone " << domainname << " loaded" << endl;
   return "Loaded zone " + domainname.toLogString() + " from " + filename;
index f0218cfc440f7f904f55299f4ebdf3851e6ce898..c544005905ea27d42a353ac42ff4c2398aa9daa2 100644 (file)
@@ -95,9 +95,9 @@ BUILT_SOURCES = ../../pdns/dnslabeltext.cc
 
 libtestremotebackend_la_SOURCES = \
        ../../pdns/arguments.hh ../../pdns/arguments.cc \
-       ../../pdns/auth-domaincache.cc ../../pdns/auth-domaincache.hh \
        ../../pdns/auth-packetcache.cc ../../pdns/auth-packetcache.hh \
        ../../pdns/auth-querycache.cc ../../pdns/auth-querycache.hh \
+       ../../pdns/auth-zonecache.cc ../../pdns/auth-zonecache.hh \
        ../../pdns/base32.cc \
        ../../pdns/base64.cc \
        ../../pdns/dns.hh ../../pdns/dns.cc \
index babf1359906851ffd6628c45bc894914019d7470..bcfb51e7c5fbc6540571bd372b80fd1418365b0f 100644 (file)
 #include "pdns/arguments.hh"
 #include "pdns/json.hh"
 #include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
 #include "pdns/auth-packetcache.hh"
 #include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
 
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 ArgvMap& arg()
 {
   static ArgvMap arg;
index 87a8234ef12f7577ce10bf285e652433597381af..266b73aca61cb257e16920541644adc55e7b1809 100644 (file)
 #include "pdns/arguments.hh"
 #include "pdns/json.hh"
 #include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
 #include "pdns/auth-packetcache.hh"
 #include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
 
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 ArgvMap& arg()
 {
   static ArgvMap arg;
index a32dfd0019d8540a43ba63ba1cd4b122f6e6bde0..e293a48ad8bcbb1ee5e155cecdaa46205dbd1d08 100644 (file)
 #include "pdns/dnsrecords.hh"
 #include "pdns/json.hh"
 #include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
 #include "pdns/auth-packetcache.hh"
 #include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
 
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 ArgvMap& arg()
 {
   static ArgvMap arg;
index 0f80df4851a24a32b63c5894aef6681a5373d612..10e5e09932fb3f687599e2d2f04956a37a0c3afd 100644 (file)
 #include "pdns/arguments.hh"
 #include "pdns/json.hh"
 #include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
 #include "pdns/auth-packetcache.hh"
 #include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
 
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 ArgvMap& arg()
 {
   static ArgvMap arg;
index 7a0142aa75c0b69373c5ad75296d487b60c1e34a..5ccdf1aef621b1e44ffba8992cc3ffac753f8b80 100644 (file)
 #include "pdns/dnsrecords.hh"
 #include "pdns/json.hh"
 #include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
 #include "pdns/auth-packetcache.hh"
 #include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
 
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 ArgvMap& arg()
 {
   static ArgvMap arg;
index 01fed7f67cbc4757532030581d8febc415c30c74..dc346b7035a1345474da97f068cf0d50a5924e25 100644 (file)
 #include "pdns/dnsrecords.hh"
 #include "pdns/json.hh"
 #include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
 #include "pdns/auth-packetcache.hh"
 #include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
 
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 ArgvMap& arg()
 {
   static ArgvMap arg;
index d8f6dd3ac439162dc4d44ec9fcfeef5e06839d7c..7fa3b20418f49f8158e40be3b865275d48b6bfdc 100644 (file)
@@ -185,9 +185,9 @@ pdns_server_SOURCES = \
        ascii.hh \
        auth-caches.cc auth-caches.hh \
        auth-carbon.cc \
-       auth-domaincache.cc auth-domaincache.hh \
        auth-packetcache.cc auth-packetcache.hh \
        auth-querycache.cc auth-querycache.hh \
+       auth-zonecache.cc auth-zonecache.hh \
        axfr-retriever.cc axfr-retriever.hh \
        backends/gsql/gsqlbackend.cc backends/gsql/gsqlbackend.hh \
        backends/gsql/ssql.hh \
@@ -322,9 +322,9 @@ endif
 pdnsutil_SOURCES = \
        arguments.cc \
        auth-caches.cc auth-caches.hh \
-       auth-domaincache.cc auth-domaincache.hh \
        auth-packetcache.cc auth-packetcache.hh \
        auth-querycache.cc auth-querycache.hh \
+       auth-zonecache.cc auth-zonecache.hh \
        backends/gsql/gsqlbackend.cc backends/gsql/gsqlbackend.hh \
        backends/gsql/ssql.hh \
        base32.cc \
@@ -1306,9 +1306,9 @@ pdns.conf-dist: pdns_server
 testrunner_SOURCES = \
        arguments.cc \
        auth-caches.cc auth-caches.hh \
-       auth-domaincache.cc auth-domaincache.hh \
        auth-packetcache.cc auth-packetcache.hh \
        auth-querycache.cc auth-querycache.hh \
+       auth-zonecache.cc auth-zonecache.hh \
        base32.cc \
        base64.cc \
        bindlexer.l \
@@ -1353,7 +1353,7 @@ testrunner_SOURCES = \
        stubresolver.hh stubresolver.cc \
        svc-records.cc svc-records.hh \
        test-arguments_cc.cc \
-       test-auth-domaincache_cc.cc \
+       test-auth-zonecache_cc.cc \
        test-base32_cc.cc \
        test-base64_cc.cc \
        test-bindparser_cc.cc \
similarity index 62%
rename from pdns/auth-domaincache.cc
rename to pdns/auth-zonecache.cc
index d3c55bbf5c77292f5e37cf92652f8773fb31b095..c4c6d6d22ca76308262535aed95bf2ffe9b3031d 100644 (file)
 #include "config.h"
 #endif
 
-#include "auth-domaincache.hh"
+#include "auth-zonecache.hh"
 #include "logger.hh"
 #include "statbag.hh"
 #include "arguments.hh"
 #include "cachecleaner.hh"
 extern StatBag S;
 
-AuthDomainCache::AuthDomainCache(size_t mapsCount) :
+AuthZoneCache::AuthZoneCache(size_t mapsCount) :
   d_maps(mapsCount)
 {
-  S.declare("domain-cache-hit", "Number of domain cache hits");
-  S.declare("domain-cache-miss", "Number of domain cache misses");
-  S.declare("domain-cache-size", "Number of entries in the domain cache", StatType::gauge);
+  S.declare("zone-cache-hit", "Number of zone cache hits");
+  S.declare("zone-cache-miss", "Number of zone cache misses");
+  S.declare("zone-cache-size", "Number of entries in the zone cache", StatType::gauge);
 
-  d_statnumhit = S.getPointer("domain-cache-hit");
-  d_statnummiss = S.getPointer("domain-cache-miss");
-  d_statnumentries = S.getPointer("domain-cache-size");
-
-  d_ttl = 0;
+  d_statnumhit = S.getPointer("zone-cache-hit");
+  d_statnummiss = S.getPointer("zone-cache-miss");
+  d_statnumentries = S.getPointer("zone-cache-size");
 }
 
-AuthDomainCache::~AuthDomainCache()
+AuthZoneCache::~AuthZoneCache()
 {
   try {
     vector<WriteLock> locks;
@@ -57,13 +55,13 @@ AuthDomainCache::~AuthDomainCache()
   }
 }
 
-bool AuthDomainCache::getEntry(const DNSName& domain, int& zoneId)
+bool AuthZoneCache::getEntry(const DNSName& zone, int& zoneId)
 {
-  auto& mc = getMap(domain);
+  auto& mc = getMap(zone);
   bool found = false;
   {
     ReadLock rl(mc.d_mut);
-    auto iter = mc.d_map.find(domain);
+    auto iter = mc.d_map.find(zone);
     if (iter != mc.d_map.end()) {
       found = true;
       zoneId = iter->second.zoneId;
@@ -79,43 +77,43 @@ bool AuthDomainCache::getEntry(const DNSName& domain, int& zoneId)
   return found;
 }
 
-bool AuthDomainCache::isEnabled() const
+bool AuthZoneCache::isEnabled() const
 {
-  return d_ttl > 0;
+  return d_refreshinterval > 0;
 }
 
-void AuthDomainCache::clear()
+void AuthZoneCache::clear()
 {
   purgeLockedCollectionsVector(d_maps);
 }
 
-void AuthDomainCache::replace(const vector<tuple<DNSName, int>>& domain_indices)
+void AuthZoneCache::replace(const vector<tuple<DNSName, int>>& zone_indices)
 {
-  if (!d_ttl)
+  if (!d_refreshinterval)
     return;
 
-  size_t count = domain_indices.size();
+  size_t count = zone_indices.size();
   vector<MapCombo> newMaps(d_maps.size());
 
   // build new maps
-  for (const tuple<DNSName, int>& tup : domain_indices) {
-    const DNSName& domain = tup.get<0>();
+  for (const tuple<DNSName, int>& tup : zone_indices) {
+    const DNSName& zone = tup.get<0>();
     CacheValue val;
     val.zoneId = tup.get<1>();
-    auto& mc = newMaps[getMapIndex(domain)];
-    mc.d_map.emplace(domain, val);
+    auto& mc = newMaps[getMapIndex(zone)];
+    mc.d_map.emplace(zone, val);
   }
 
   {
     WriteLock globalLock(d_mut);
     if (d_replacePending) {
-      // add/replace all domains created while data collection for replace() was already in progress.
+      // add/replace all zones created while data collection for replace() was already in progress.
       for (const tuple<DNSName, int>& tup : d_pendingAdds) {
-        const DNSName& domain = tup.get<0>();
+        const DNSName& zone = tup.get<0>();
         CacheValue val;
         val.zoneId = tup.get<1>();
-        auto& mc = newMaps[getMapIndex(domain)];
-        mc.d_map[domain] = val;
+        auto& mc = newMaps[getMapIndex(zone)];
+        mc.d_map[zone] = val;
       }
     }
 
@@ -132,32 +130,32 @@ void AuthDomainCache::replace(const vector<tuple<DNSName, int>>& domain_indices)
   d_statnumentries->store(count);
 }
 
-void AuthDomainCache::add(const DNSName& domain, const int zoneId)
+void AuthZoneCache::add(const DNSName& zone, const int zoneId)
 {
-  if (!d_ttl)
+  if (!d_refreshinterval)
     return;
 
   {
     WriteLock globalLock(d_mut);
     if (d_replacePending) {
-      d_pendingAdds.push_back({domain, zoneId});
+      d_pendingAdds.push_back({zone, zoneId});
     }
   }
 
   CacheValue val;
   val.zoneId = zoneId;
 
-  int mapIndex = getMapIndex(domain);
+  int mapIndex = getMapIndex(zone);
   {
     auto& mc = d_maps[mapIndex];
     WriteLock mcLock(mc.d_mut);
-    mc.d_map.emplace(domain, val);
+    mc.d_map.emplace(zone, val);
   }
 }
 
-void AuthDomainCache::setReplacePending()
+void AuthZoneCache::setReplacePending()
 {
-  if (!d_ttl)
+  if (!d_refreshinterval)
     return;
 
   {
similarity index 78%
rename from pdns/auth-domaincache.hh
rename to pdns/auth-zonecache.hh
index ba6432c15a7b3b9e0e447886dbf01a192649329a..e5ace8b265e1bbdf65e0c3ec22ffe715870ef55c 100644 (file)
 #include "lock.hh"
 #include "misc.hh"
 
-class AuthDomainCache : public boost::noncopyable
+class AuthZoneCache : public boost::noncopyable
 {
 public:
-  AuthDomainCache(size_t mapsCount = 1024);
-  ~AuthDomainCache();
+  AuthZoneCache(size_t mapsCount = 1024);
+  ~AuthZoneCache();
 
-  void replace(const vector<tuple<DNSName, int>>& domains);
-  void add(const DNSName& domain, const int zoneId);
+  void replace(const vector<tuple<DNSName, int>>& zone);
+  void add(const DNSName& zone, const int zoneId);
   void setReplacePending(); //!< call this when data collection for the subsequent replace() call starts.
 
-  bool getEntry(const DNSName& domain, int& zoneId);
+  bool getEntry(const DNSName& zone, int& zoneId);
 
   size_t size() { return *d_statnumentries; } //!< number of entries in the cache
 
-  uint32_t getTTL() const
+  uint32_t getRefreshInterval() const
   {
-    return d_ttl;
+    return d_refreshinterval;
   }
 
-  void setTTL(uint32_t ttl)
+  void setRefreshInterval(uint32_t interval)
   {
-    d_ttl = ttl;
+    d_refreshinterval = interval;
   }
 
   bool isEnabled() const;
@@ -75,9 +75,9 @@ private:
   };
 
   vector<MapCombo> d_maps;
-  size_t getMapIndex(const DNSName& domain)
+  size_t getMapIndex(const DNSName& zone)
   {
-    return domain.hash() % d_maps.size();
+    return zone.hash() % d_maps.size();
   }
   MapCombo& getMap(const DNSName& qname)
   {
@@ -88,11 +88,11 @@ private:
   AtomicCounter* d_statnummiss;
   AtomicCounter* d_statnumentries;
 
-  time_t d_ttl{0};
+  time_t d_refreshinterval{0};
 
   ReadWriteLock d_mut;
   std::vector<tuple<DNSName, int>> d_pendingAdds;
   bool d_replacePending{false};
 };
 
-extern AuthDomainCache g_domainCache;
+extern AuthZoneCache g_zoneCache;
index dfbb2dd473f873df24c657962a4d6a83d28c57f6..114a1b2e01cf7395abae1205b897fe26fd135d4c 100644 (file)
@@ -55,7 +55,7 @@ ArgvMap theArg;
 StatBag S;  //!< Statistics are gathered across PDNS via the StatBag class S
 AuthPacketCache PC; //!< This is the main PacketCache, shared across all threads
 AuthQueryCache QC;
-AuthDomainCache g_domainCache;
+AuthZoneCache g_zoneCache;
 std::unique_ptr<DNSProxy> DP{nullptr};
 std::unique_ptr<DynListener> dl{nullptr};
 CommunicatorClass Communicator;
@@ -181,7 +181,7 @@ void declareArguments()
   ::arg().set("cache-ttl","Seconds to store packets in the PacketCache")="20";
   ::arg().set("negquery-cache-ttl","Seconds to store negative query results in the QueryCache")="60";
   ::arg().set("query-cache-ttl","Seconds to store query results in the QueryCache")="20";
-  ::arg().set("domain-cache-ttl", "Seconds to cache list of known domains") = "0";
+  ::arg().set("zone-cache-refresh-interval", "Seconds to cache list of known zones") = "0";
   ::arg().set("server-id", "Returned when queried for 'id.server' TXT or NSID, defaults to hostname - disabled or custom")="";
   ::arg().set("default-soa-content","Default SOA content")="a.misconfigured.dns.server.invalid hostmaster.@ 0 10800 3600 604800 3600";
   ::arg().set("default-soa-edit","Default SOA-EDIT value")="";
@@ -680,23 +680,23 @@ void mainthread()
 
   const uint32_t secpollInterval = 1800;
   uint32_t secpollSince = 0;
-  uint32_t domainCacheUpdateSince = 0;
+  uint32_t zoneCacheUpdateSince = 0;
   for(;;) {
-    const uint32_t sleeptime = g_domainCache.getTTL() == 0 ? secpollInterval : std::min(secpollInterval, g_domainCache.getTTL());
+    const uint32_t sleeptime = g_zoneCache.getRefreshInterval() == 0 ? secpollInterval : std::min(secpollInterval, g_zoneCache.getRefreshInterval());
     sleep(sleeptime);  // if any signals arrive, we might run more often than expected.
 
-    domainCacheUpdateSince += sleeptime;
-    if (domainCacheUpdateSince >= g_domainCache.getTTL()) {
+    zoneCacheUpdateSince += sleeptime;
+    if (zoneCacheUpdateSince >= g_zoneCache.getRefreshInterval()) {
       try {
         UeberBackend B;
-        B.updateDomainCache();
-        domainCacheUpdateSince = 0;
+        B.updateZoneCache();
+        zoneCacheUpdateSince = 0;
       }
       catch(PDNSException &e) {
-        g_log<<Logger::Error<<"PDNSException while updating domain cache: "<<e.reason<<endl;
+        g_log<<Logger::Error<<"PDNSException while updating zone cache: "<<e.reason<<endl;
       }
       catch(std::exception &e) {
-        g_log<<Logger::Error<<"STL Exception while updating domain cache: "<<e.what()<<endl;
+        g_log<<Logger::Error<<"STL Exception while updating zone cache: "<<e.what()<<endl;
       }
     }
 
index 6e49e861bd3d6d2471f16d38e0794288c85a2d27..c2e46ad6001386ce2565370e0fd8b992cbd88991 100644 (file)
@@ -20,9 +20,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #pragma once
-#include "auth-domaincache.hh"
 #include "auth-packetcache.hh"
 #include "auth-querycache.hh"
+#include "auth-zonecache.hh"
 #include "utility.hh"
 #include "arguments.hh"
 #include "communicator.hh"
index c2a7ac1f107dc0263994e5660645ba0867315751..8eaceeb7a0acb76dd4f7aa8853d56302b078ee9c 100644 (file)
@@ -18,9 +18,9 @@
 #include "dnsbackend.hh"
 #include "ueberbackend.hh"
 #include "arguments.hh"
-#include "auth-domaincache.hh"
 #include "auth-packetcache.hh"
 #include "auth-querycache.hh"
+#include "auth-zonecache.hh"
 #include "zoneparser-tng.hh"
 #include "signingpipe.hh"
 #include "dns_random.hh"
@@ -41,7 +41,7 @@
 StatBag S;
 AuthPacketCache PC;
 AuthQueryCache QC;
-AuthDomainCache g_domainCache;
+AuthZoneCache g_zoneCache;
 
 namespace po = boost::program_options;
 po::variables_map g_vm;
index edadbbc3abb5edeb97d51b4b855ff7af45adb5f2..545117eff5fc077224f8af448755206aeb76ab04 100644 (file)
@@ -624,10 +624,10 @@ int main(int argc, char **argv)
       }
     }
 
-    g_domainCache.setTTL(::arg().asNum("domain-cache-ttl"));
+    g_zoneCache.setRefreshInterval(::arg().asNum("zone-cache-refresh-interval"));
     {
       UeberBackend B;
-      B.updateDomainCache();
+      B.updateZoneCache();
     }
 
     UeberBackend::go();
similarity index 74%
rename from pdns/test-auth-domaincache_cc.cc
rename to pdns/test-auth-zonecache_cc.cc
index bfbf19fb244e238c9c1415d160e23cdea969ddd0..d2734e200c0cc79bf64b78fe593965a50413e8a5 100644 (file)
 
 #include <boost/test/unit_test.hpp>
 
-#include "auth-domaincache.hh"
+#include "auth-zonecache.hh"
 #include "misc.hh"
 
-BOOST_AUTO_TEST_SUITE(test_auth_domaincache_cc)
+BOOST_AUTO_TEST_SUITE(test_auth_zonecache_cc)
 
 BOOST_AUTO_TEST_CASE(test_replace)
 {
-  AuthDomainCache cache;
-  cache.setTTL(3600);
+  AuthZoneCache cache;
+  cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> domain_indices{
+  vector<tuple<DNSName, int>> zone_indices{
     {DNSName("example.org."), 1},
   };
-  cache.replace(domain_indices);
+  cache.replace(zone_indices);
 
   int zoneId = 0;
   bool found = cache.getEntry(DNSName("example.org."), zoneId);
   if (!found || zoneId != 1) {
-    BOOST_FAIL("domain added in replace() not found");
+    BOOST_FAIL("zone added in replace() not found");
   }
 }
 
 BOOST_AUTO_TEST_CASE(test_add_while_pending_replace)
 {
-  AuthDomainCache cache;
-  cache.setTTL(3600);
+  AuthZoneCache cache;
+  cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> domain_indices{
+  vector<tuple<DNSName, int>> zone_indices{
     {DNSName("powerdns.org."), 1}};
   cache.setReplacePending();
   cache.add(DNSName("example.org."), 2);
-  cache.replace(domain_indices);
+  cache.replace(zone_indices);
 
   int zoneId = 0;
   bool found = cache.getEntry(DNSName("example.org."), zoneId);
   if (!found || zoneId != 2) {
-    BOOST_FAIL("domain added while replace was pending not found");
+    BOOST_FAIL("zone added while replace was pending not found");
   }
 }
 
-// Add domain using .add(), but also in the .replace() data
+// Add zone using .add(), but also in the .replace() data
 BOOST_AUTO_TEST_CASE(test_add_while_pending_replace_duplicate)
 {
-  AuthDomainCache cache;
-  cache.setTTL(3600);
+  AuthZoneCache cache;
+  cache.setRefreshInterval(3600);
 
-  vector<tuple<DNSName, int>> domain_indices{
+  vector<tuple<DNSName, int>> zone_indices{
     {DNSName("powerdns.org."), 1},
     {DNSName("example.org."), 2},
   };
   cache.setReplacePending();
   cache.add(DNSName("example.org."), 3);
-  cache.replace(domain_indices);
+  cache.replace(zone_indices);
 
   int zoneId = 0;
   bool found = cache.getEntry(DNSName("example.org."), zoneId);
   if (!found || zoneId == 0) {
-    BOOST_FAIL("domain added while replace was pending not found");
+    BOOST_FAIL("zone added while replace was pending not found");
   }
   if (zoneId != 3) {
     BOOST_FAIL(string("zoneId got overwritten using replace() data (zoneId=") + std::to_string(zoneId) + ")");
index da63913da18b0ad31aa230f1a860f2d3e8dbd8c1..23e302bc8d595d5dc64b2a6ab419d7a84574039e 100644 (file)
@@ -16,8 +16,8 @@
 #include <boost/multi_index/key_extractors.hpp>
 
 #include "arguments.hh"
-#include "auth-domaincache.hh"
 #include "auth-querycache.hh"
+#include "auth-zonecache.hh"
 #include "ueberbackend.hh"
 
 class SimpleBackend : public DNSBackend
@@ -338,8 +338,8 @@ struct UeberBackendSetupArgFixture {
     ::arg().set("negquery-cache-ttl")="0";
     ::arg().set("consistent-backends")="no";
     QC.cleanup();
-    ::arg().set("domain-cache-ttl")="0";
-    g_domainCache.clear();
+    ::arg().set("zone-cache-refresh-interval")="0";
+    g_zoneCache.clear();
     BackendMakers().clear();
     SimpleBackend::s_zones.clear();
     SimpleBackend::s_metadata.clear();
@@ -355,9 +355,9 @@ static void testWithoutThenWithAuthCache(std::function<void(UeberBackend& ub)> f
     ::arg().set("query-cache-ttl")="0";
     ::arg().set("negquery-cache-ttl")="0";
     QC.cleanup();
-    /* keep domain cache disabled */
-    ::arg().set("domain-cache-ttl")="0";
-    g_domainCache.clear();
+    /* keep zone cache disabled */
+    ::arg().set("zone-cache-refresh-interval")="0";
+    g_zoneCache.clear();
 
     UeberBackend ub;
     func(ub);
@@ -368,9 +368,9 @@ static void testWithoutThenWithAuthCache(std::function<void(UeberBackend& ub)> f
     ::arg().set("query-cache-ttl")="20";
     ::arg().set("negquery-cache-ttl")="60";
     QC.cleanup();
-    /* keep domain cache disabled */
-    ::arg().set("domain-cache-ttl")="0";
-    g_domainCache.clear();
+    /* keep zone cache disabled */
+    ::arg().set("zone-cache-refresh-interval")="0";
+    g_zoneCache.clear();
 
     UeberBackend ub;
     /* a first time to fill the cache */
@@ -380,14 +380,14 @@ static void testWithoutThenWithAuthCache(std::function<void(UeberBackend& ub)> f
   }
 }
 
-static void testWithoutThenWithDomainCache(std::function<void(UeberBackend& ub)> func)
+static void testWithoutThenWithZoneCache(std::function<void(UeberBackend& ub)> func)
 {
   extern AuthQueryCache QC;
 
   {
-    /* disable domain cache */
-    ::arg().set("domain-cache-ttl")="0";
-    g_domainCache.clear();
+    /* disable zone cache */
+    ::arg().set("zone-cache-refresh-interval")="0";
+    g_zoneCache.clear();
     /* keep auth caches disabled */
     ::arg().set("query-cache-ttl")="0";
     ::arg().set("negquery-cache-ttl")="0";
@@ -398,16 +398,16 @@ static void testWithoutThenWithDomainCache(std::function<void(UeberBackend& ub)>
   }
 
   {
-    /* enable domain cache */
-    ::arg().set("domain-cache-ttl")="0";
-    g_domainCache.clear();
+    /* enable zone cache */
+    ::arg().set("zone-cache-refresh-interval")="0";
+    g_zoneCache.clear();
     /* keep auth caches disabled */
     ::arg().set("query-cache-ttl")="0";
     ::arg().set("negquery-cache-ttl")="0";
     QC.cleanup();
 
     UeberBackend ub;
-    ub.updateDomainCache();
+    ub.updateZoneCache();
     /* a first time to fill the cache */
     func(ub);
     /* a second time to make sure every call has been tried with the cache filled */
@@ -535,7 +535,7 @@ BOOST_AUTO_TEST_CASE(test_simple) {
 
     };
     testWithoutThenWithAuthCache(testFunction);
-    testWithoutThenWithDomainCache(testFunction);
+    testWithoutThenWithZoneCache(testFunction);
   }
   catch(const PDNSException& e) {
     cerr<<e.reason<<endl;
@@ -682,7 +682,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_separate_zones) {
 
     };
     testWithoutThenWithAuthCache(testFunction);
-    testWithoutThenWithDomainCache(testFunction);
+    testWithoutThenWithZoneCache(testFunction);
   }
   catch(const PDNSException& e) {
     cerr<<e.reason<<endl;
@@ -808,7 +808,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_overlay) {
 
     };
     testWithoutThenWithAuthCache(testFunction);
-    testWithoutThenWithDomainCache(testFunction);
+    testWithoutThenWithZoneCache(testFunction);
   }
   catch(const PDNSException& e) {
     cerr<<e.reason<<endl;
@@ -931,7 +931,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_overlay_name) {
 
     };
     testWithoutThenWithAuthCache(testFunction);
-    testWithoutThenWithDomainCache(testFunction);
+    testWithoutThenWithZoneCache(testFunction);
   }
   catch(const PDNSException& e) {
     cerr<<e.reason<<endl;
@@ -1009,7 +1009,7 @@ BOOST_AUTO_TEST_CASE(test_child_zone) {
 
     };
     testWithoutThenWithAuthCache(testFunction);
-    testWithoutThenWithDomainCache(testFunction);
+    testWithoutThenWithZoneCache(testFunction);
   }
   catch(const PDNSException& e) {
     cerr<<e.reason<<endl;
@@ -1061,7 +1061,7 @@ BOOST_AUTO_TEST_CASE(test_multi_backends_best_soa) {
 
     };
     testWithoutThenWithAuthCache(testFunction);
-    testWithoutThenWithDomainCache(testFunction);
+    testWithoutThenWithZoneCache(testFunction);
   }
   catch(const PDNSException& e) {
     cerr<<e.reason<<endl;
index 91b481169d5479816a71ce0b1bff37bb5fd2e0dd..7adf7bb1b8437aef6af15e903a65b19e6e19bce9 100644 (file)
@@ -5,14 +5,14 @@
 #endif
 #include <boost/test/unit_test.hpp>
 #include "arguments.hh"
-#include "auth-domaincache.hh"
 #include "auth-packetcache.hh"
 #include "auth-querycache.hh"
+#include "auth-zonecache.hh"
 #include "statbag.hh"
 StatBag S;
-AuthDomainCache g_domainCache;
 AuthPacketCache PC;
 AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
 
 ArgvMap &arg()
 {
index fce557f5cf553440e06362960f94121e4aa2d85d..e4c28d044643f52462034088c6b995c30a1a13ac 100644 (file)
@@ -26,7 +26,7 @@
 #include <boost/archive/binary_oarchive.hpp>
 
 #include "auth-querycache.hh"
-#include "auth-domaincache.hh"
+#include "auth-zonecache.hh"
 #include "utility.hh"
 
 
@@ -130,7 +130,7 @@ bool UeberBackend::createDomain(const DNSName &domain, const DomainInfo::DomainK
     }
   }
   if (success) {
-    g_domainCache.add(domain, zoneId);  // make new domain visible
+    g_zoneCache.add(domain, zoneId);  // make new zone visible
   }
   return success;
 }
@@ -280,23 +280,23 @@ void UeberBackend::reload()
   }
 }
 
-void UeberBackend::updateDomainCache() {
-  if (!g_domainCache.isEnabled()) {
+void UeberBackend::updateZoneCache() {
+  if (!g_zoneCache.isEnabled()) {
     return;
   }
 
-  vector<tuple<DNSName, int>> domain_indices;
-  g_domainCache.setReplacePending();
+  vector<tuple<DNSName, int>> zone_indices;
+  g_zoneCache.setReplacePending();
 
   for (vector<DNSBackend*>::iterator i = backends.begin(); i != backends.end(); ++i )
   {
-    vector<DomainInfo> domains;
-    (*i)->getAllDomains(&domains, true);
-    for(auto& di: domains) {
-      domain_indices.push_back({std::move(di.zone), (int)di.id});  // this cast should not be necessary
+    vector<DomainInfo> zones;
+    (*i)->getAllDomains(&zones, true);
+    for(auto& di: zones) {
+      zone_indices.push_back({std::move(di.zone), (int)di.id});  // this cast should not be necessary
     }
   }
-  g_domainCache.replace(domain_indices);
+  g_zoneCache.replace(zone_indices);
 }
 
 void UeberBackend::rediscover(string *status)
@@ -309,7 +309,7 @@ void UeberBackend::rediscover(string *status)
       *status+=tmpstr + (i!=backends.begin() ? "\n" : "");
   }
 
-  updateDomainCache();
+  updateZoneCache();
 }
 
 
@@ -355,16 +355,16 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
   vector<pair<size_t, SOAData> > bestmatch (backends.size(), make_pair(target.wirelength()+1, SOAData()));
   do {
     int zoneId{-1};
-    if(cachedOk && g_domainCache.isEnabled()) {
-      if (g_domainCache.getEntry(shorter, zoneId)) {
-        // Zone exists in domain cache, directly look up SOA.
+    if(cachedOk && g_zoneCache.isEnabled()) {
+      if (g_zoneCache.getEntry(shorter, zoneId)) {
+        // Zone exists in zone cache, directly look up SOA.
         // XXX: this code path and the cache lookup below should be merged; but that needs the code path below to also use ANY.
         // Or it should just also use lookup().
         DNSZoneRecord zr;
         lookup(QType(QType::SOA), shorter, zoneId, nullptr);
         if (!get(zr)) {
-          // domain has somehow vanished
-          DLOG(g_log << Logger::Info << "Backend returned no SOA for domain '" << shorter.toLogString() << "', which it reported as existing " << endl);
+          // zone has somehow vanished
+          DLOG(g_log << Logger::Info << "Backend returned no SOA for zone '" << shorter.toLogString() << "', which it reported as existing " << endl);
           continue;
         }
         if (zr.dr.d_name != shorter) {
@@ -377,7 +377,7 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
           ;
         goto found;
       }
-      // domain does not exist, try again with shorter name
+      // zone does not exist, try again with shorter name
       continue;
     }
 
index 92963176f1b484c5a424486ace5f44e72d26b487..b3b688aac68a47c9eec1b5142fe5a61fd8327a46 100644 (file)
@@ -132,7 +132,7 @@ public:
   bool searchRecords(const string &pattern, int maxResults, vector<DNSResourceRecord>& result);
   bool searchComments(const string &pattern, int maxResults, vector<Comment>& result);
 
-  void updateDomainCache();
+  void updateZoneCache();
 
   bool inTransaction();
 private:
index 63e1a23ce86d44f09a8118c48a1a7cf5af5fb219..90d70ee9d107ace4fae2eefd2e9a3f0fd03ddd81 100644 (file)
@@ -50,7 +50,7 @@ gsql_master()
         --config-name=$backend --socket-dir=./ --no-shuffle \
         --dnsupdate=yes --resolver=$RESOLVERIP --outgoing-axfr-expand-alias=yes \
         --expand-alias=yes \
-        --cache-ttl=$cachettl --domain-cache-ttl=$cachettl --dname-processing \
+        --cache-ttl=$cachettl --zone-cache-refresh-interval=$cachettl --dname-processing \
         --disable-axfr-rectify=yes $lua_prequery &
 
     if [ $context = ${backend}-nsec3 ]
index c0821264564fc45d565302e7a18bce35db3339b7..2a3a67b506480e71aa996b58a4b79e8ef1732c4a 100644 (file)
@@ -13,7 +13,7 @@ launch=gsqlite3
 gsqlite3-database=pdns.sqlite3
 consistent-backends
 cache-ttl=30
-domain-cache-ttl=30
+zone-cache-refresh-interval=30
 direct-dnskey
 __EOF__
 
index c607fdf706cb5f8b7c988fd002cbc76f6b48bcc7..791e38a76418afecad590ba258d43908abe71bbc 100644 (file)
@@ -31,7 +31,7 @@ __EOF__
                        --query-logging --dnsupdate=yes \
       --expand-alias=yes --outgoing-axfr-expand-alias=yes \
       --resolver=$RESOLVERIP \
-      --domain-cache-ttl=0 \
+      --zone-cache-refresh-interval=0 \
                        --cache-ttl=$cachettl --dname-processing $lua_prequery &
 
                skipreasons="nodnssec noent nodyndns nometa noaxfr"
index 1462e274ded35936de23fe286d63fdd479f57a96..2e28426c2584becb2c64b4a072ab8a23a99f0912 100755 (executable)
@@ -7,7 +7,7 @@ fi
 cleandig ns1.addzone.com A
 cleandig ns1.test.com A
 $PDNSCONTROL --config-name=bind --socket-dir=. --no-config bind-add-zone addzone.com ${PWD}/zones/addzone.com >/dev/null 2>&1
-# output of purge changes if domain-cache-ttl is set
+# output of purge changes if zone-cache-refresh-interval is set
 $PDNSCONTROL --config-name=bind --socket-dir=. --no-config purge addzone.com >/dev/null
 sleep 1
 $PDNSCONTROL --config-name=bind --socket-dir=. --no-config bind-add-zone addzone.com ${PWD}/zones/addzone.com