Skip to content

Commit

Permalink
Merge pull request #13626 from Habbie/backport-13552-to-auth-4.8.x
Browse files Browse the repository at this point in the history
auth-4.8: extend the systemd startup timeout during lmdb schema migrations
  • Loading branch information
Habbie authored Dec 18, 2023
2 parents 173aa06 + 3291f5a commit 98f45e2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/lmdbbackend/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion modules/lmdbbackend/OBJECTLIBS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS)
$(LMDB_LIBS) $(BOOST_SERIALIZATION_LIBS) $(SYSTEMD_LIBS)
11 changes: 11 additions & 0 deletions modules/lmdbbackend/lmdbbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@

#include <boost/iostreams/device/back_inserter.hpp>

#ifdef HAVE_SYSTEMD
#include <systemd/sd-daemon.h>
#endif

#include <stdio.h>
#include <unistd.h>

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 98f45e2

Please sign in to comment.