]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth lmdb: in Lightning Stream mode, during deleteDomain, use RW transaction to get... 12990/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 6 Jul 2023 13:09:07 +0000 (15:09 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 6 Jul 2023 13:09:07 +0000 (15:09 +0200)
modules/lmdbbackend/lmdbbackend.cc

index ada437db984bb181169950626907fde96cd609f4..7a062b24d59b7b35ceaac7a2ccb4b014d3ac2105 100644 (file)
@@ -1321,7 +1321,11 @@ bool LMDBBackend::deleteDomain(const DNSName& domain)
     idvec.push_back(txn.get<0>(domain, di));
   }
   else {
-    auto txn = d_tdomains->getROTransaction();
+    // this transaction used to be RO.
+    // it is now RW to narrow a race window between PowerDNS and Lightning Stream
+    // FIXME: turn the entire delete, including this ID scan, into one RW transaction
+    // when doing that, first do a short RO check to see if we actually have anything to delete
+    auto txn = d_tdomains->getRWTransaction();
 
     txn.get_multi<0>(domain, idvec);
   }