../../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)
#include <boost/iostreams/device/back_inserter.hpp>
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
#include <stdio.h>
#include <unistd.h>
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);