From: Miod Vallat Date: Thu, 19 Jun 2025 13:30:26 +0000 (+0200) Subject: Use faster logic in deleteDomainRecords(). X-Git-Tag: dnsdist-2.0.0-beta1~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b5dc7f7491540a1e58c3655c7353ee018c3b271;p=thirdparty%2Fpdns.git Use faster logic in deleteDomainRecords(). Signed-off-by: Miod Vallat --- diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 151669dfd9..77e498dfff 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -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().rfind(match, 0) == 0) { + if (cursor.prefix(match, key, val) == 0) { + do { if (qtype == QType::ANY || compoundOrdername::getQType(key.getNoStripHeader()) == qtype) { cursor.del(); } - if (cursor.next(key, val) != 0) { - break; - } - } + } while (cursor.next(key, val) == 0); } }