]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Close race window during which various flag values might be incorrect. 15696/head
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 23 Jun 2025 08:27:52 +0000 (10:27 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 23 Jun 2025 13:28:00 +0000 (15:28 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/lmdbbackend/lmdbbackend.cc

index a28eac00450d89f6e137fb147ac4fb509da5c187..4433462c2521e8fb614d279077cf54e212438a90 100644 (file)
@@ -685,8 +685,6 @@ LMDBBackend::LMDBBackend(const std::string& suffix)
 
   string syncMode = toLower(getArg("sync-mode"));
 
-  d_random_ids = mustDo("random-ids");
-
   if (syncMode == "nosync")
     d_asyncFlag = MDB_NOSYNC;
   else if (syncMode == "nometasync")
@@ -704,9 +702,6 @@ LMDBBackend::LMDBBackend(const std::string& suffix)
     throw std::runtime_error(std::string("Unable to parse the 'map-size' LMDB value: ") + e.what());
   }
 
-  LMDBLS::s_flag_deleted = mustDo("flag-deleted");
-  d_handle_dups = false;
-
   if (mustDo("lightning-stream")) {
     d_random_ids = true;
     d_handle_dups = true;
@@ -716,6 +711,11 @@ LMDBBackend::LMDBBackend(const std::string& suffix)
       throw std::runtime_error(std::string("running with Lightning Stream support requires shards=1"));
     }
   }
+  else {
+    d_random_ids = mustDo("random-ids");
+    d_handle_dups = false;
+    LMDBLS::s_flag_deleted = mustDo("flag-deleted");
+  }
 
   bool opened = false;