]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Close race window during which various flag values might be incorrect. 15720/head
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 23 Jun 2025 08:27:52 +0000 (10:27 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 25 Jun 2025 06:20:35 +0000 (08:20 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
(cherry picked from commit 9ca3a5c9f17126d8a2850bf41a457f31f08f4df1)

modules/lmdbbackend/lmdbbackend.cc

index 2997e9911202223fb6559ccb8949de29156e434c..d5e63f00d6d484310bf184523d688442bf90d38f 100644 (file)
@@ -656,8 +656,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")
@@ -675,9 +673,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;
@@ -687,6 +682,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;