From: Kees Monshouwer Date: Tue, 28 Nov 2023 19:52:53 +0000 (+0100) Subject: auth, extend the systemd startup timeout during lmdb schema migrations X-Git-Tag: auth-4.9.0-alpha1~43^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd61829b3fbaf654129be0b77183d0b2ab966fe7;p=thirdparty%2Fpdns.git auth, extend the systemd startup timeout during lmdb schema migrations --- diff --git a/modules/lmdbbackend/Makefile.am b/modules/lmdbbackend/Makefile.am index 7cfd41ad2b..d097aee8df 100644 --- a/modules/lmdbbackend/Makefile.am +++ b/modules/lmdbbackend/Makefile.am @@ -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) diff --git a/modules/lmdbbackend/OBJECTLIBS b/modules/lmdbbackend/OBJECTLIBS index 72a315ed28..e0b0bb3924 100644 --- a/modules/lmdbbackend/OBJECTLIBS +++ b/modules/lmdbbackend/OBJECTLIBS @@ -1 +1 @@ -$(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS) +$(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS) $(SYSTEMD_LIBS) diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 3cfbf8c4da..6b795654f7 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -48,6 +48,10 @@ #include +#ifdef HAVE_SYSTEMD +#include +#endif + #include #include @@ -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);