]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth, extend the systemd startup timeout during lmdb schema migrations 13626/head
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 28 Nov 2023 19:52:53 +0000 (20:52 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 14 Dec 2023 12:00:54 +0000 (13:00 +0100)
(cherry picked from commit bd61829b3fbaf654129be0b77183d0b2ab966fe7)

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 2d15773af99fb62a36e289299f91f59d189a753a..15bd624269bb0d4d158e9e99072b3715efbf124b 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);