]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth, extend the systemd startup timeout during lmdb schema migrations 13552/head
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 28 Nov 2023 19:52:53 +0000 (20:52 +0100)
committermind04 <mind04@monshouwer.org>
Fri, 1 Dec 2023 14:08:36 +0000 (15:08 +0100)
modules/lmdbbackend/Makefile.am
modules/lmdbbackend/OBJECTLIBS
modules/lmdbbackend/lmdbbackend.cc

index 7cfd41ad2bb06cb15ccb489c14589286dee1d3b5..d097aee8df7c13efcfd5bacb3f5e4375ee6db89a 100644 (file)
@@ -9,4 +9,4 @@ liblmdbbackend_la_SOURCES = \
        ../../ext/lmdb-safe/lmdb-typed.hh ../../ext/lmdb-safe/lmdb-typed.cc \
        lmdbbackend.cc lmdbbackend.hh
 liblmdbbackend_la_LDFLAGS = -module -avoid-version $(BOOST_SERIALIZATION_LDFLAGS)
-liblmdbbackend_la_LIBADD = $(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS)
+liblmdbbackend_la_LIBADD = $(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS) $(SYSTEMD_LIBS)
index 72a315ed28a5f746c7a8c364141ab80b337e46b3..e0b0bb3924a8542a1169775a579e6e23acff95eb 100644 (file)
@@ -1 +1 @@
-$(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS)
+$(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS) $(SYSTEMD_LIBS)
index 3cfbf8c4da1de8d0db1651692d569316966e1179..6b795654f7f94d0e62a1716c0bf91a89e563f7e3 100644 (file)
 
 #include <boost/iostreams/device/back_inserter.hpp>
 
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
 #include <stdio.h>
 #include <unistd.h>
 
@@ -385,6 +389,13 @@ bool LMDBBackend::upgradeToSchemav5(std::string& filename)
     throw std::runtime_error("mdb_txn_begin failed");
   }
 
+#ifdef HAVE_SYSTEMD
+  /* A schema migration may take a long time. Extend the startup service timeout to 1 day,
+   * but only if this is beyond the original maximum time of TimeoutStartSec=.
+   */
+  sd_notify(0, "EXTEND_TIMEOUT_USEC=86400000000");
+#endif
+
   std::cerr << "migrating shards" << std::endl;
   for (uint32_t i = 0; i < shards; i++) {
     string shardfile = filename + "-" + std::to_string(i);