]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use faster logic in deleteDomainRecords(). 15693/head
authorMiod Vallat <miod.vallat@powerdns.com>
Thu, 19 Jun 2025 13:30:26 +0000 (15:30 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 19 Jun 2025 13:30:26 +0000 (15:30 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/lmdbbackend/lmdbbackend.cc

index 151669dfd94c6123f02069051196c2045c176cbb..77e498dfffbc4e8d1468eab19b31e9020db7cc05 100644 (file)
@@ -1117,15 +1117,12 @@ void LMDBBackend::deleteDomainRecords(RecordsRWTransaction& txn, uint16_t qtype,
   MDBOutVal key{};
   MDBOutVal val{};
 
-  if (cursor.lower_bound(match, key, val) == 0) {
-    while (key.getNoStripHeader<StringView>().rfind(match, 0) == 0) {
+  if (cursor.prefix(match, key, val) == 0) {
+    do {
       if (qtype == QType::ANY || compoundOrdername::getQType(key.getNoStripHeader<StringView>()) == qtype) {
         cursor.del();
       }
-      if (cursor.next(key, val) != 0) {
-        break;
-      }
-    }
+    } while (cursor.next(key, val) == 0);
   }
 }