]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Skip reading SOA in LMDBBackend::getAllDomains() whenever possible. 16573/head
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 28 Nov 2025 10:38:23 +0000 (11:38 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 28 Nov 2025 12:57:49 +0000 (13:57 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/lmdbbackend/lmdbbackend.cc

index 68de6e8bb2174ee062b2388dbedee59829296c86..f2aabcbe3c1a9aa2e1b6779c818e5c8ee03eb5fe 100644 (file)
@@ -2270,15 +2270,20 @@ void LMDBBackend::getAllDomainsFiltered(vector<DomainInfo>* domains, const std::
   }
 }
 
-void LMDBBackend::getAllDomains(vector<DomainInfo>* domains, bool /* doSerial */, bool include_disabled)
-{
-  getAllDomainsFiltered(domains, [this, include_disabled](DomainInfo& di) {
-    if (!getSerial(di) && !include_disabled) {
-      return false;
+void LMDBBackend::getAllDomains(vector<DomainInfo>* domains, bool doSerial, bool include_disabled)
+{
+  getAllDomainsFiltered(domains, [this, doSerial, include_disabled](DomainInfo& info) {
+    // We need to read the SOA record in order to know if the domain is
+    // disabled. If we don't care about serials and want all domains to be
+    // returned, skip the SOA record retrieval.
+    if (doSerial || !include_disabled) {
+      if (!getSerial(info) && !include_disabled) {
+        return false;
+      }
     }
 
     // Skip domains with variants if views are disabled.
-    if (di.zone.hasVariant() && !d_views) {
+    if (info.zone.hasVariant() && !d_views) {
       return false;
     }