]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth lmdb: in Lightning Stream mode, during deleteDomain, use RW transaction to get... 12996/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 14:59:44 +0000 (16:59 +0200)
(cherry picked from commit 3a99c00de710001bf28b940578ddc8d92272b28a)

modules/lmdbbackend/lmdbbackend.cc

index d6eb3ba0e80c4991a31792941e4b2f3f17ed927f..014768e55b0e878f2ff601366a30e55d3fb86dc2 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);
   }