]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do a mdb_readers_check to clean up stale readers on database load 9888/head
authorRobin Geuze <robing@transip.nl>
Thu, 17 Dec 2020 10:51:24 +0000 (11:51 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 11 Jan 2021 20:07:25 +0000 (21:07 +0100)
ext/lmdb-safe/lmdb-safe.cc

index ccb090127aee304a3c2d0a3ac136cb35b4bd7769..7b968e20d655baf94a877febc808b7a7408ab410 100644 (file)
@@ -46,6 +46,12 @@ Various other options may also need to be set before opening the handle, e.g. md
     mdb_env_close(d_env);
     throw std::runtime_error("Unable to open database file "+std::string(fname)+": " + MDBError(rc));
   }
+
+  if ((flags & MDB_RDONLY) == 0) {
+    // Check for stale readers to prevent unbridled database growth.
+    // Only do this when in RW mode since it affects the file.
+    mdb_reader_check(d_env, nullptr);
+  }
 }
 
 void MDBEnv::incROTX()