commit 094393b8585011ee0afb73db1370fb6bedd86db9
Author: Jim Meyering <meyering(a)redhat.com>
Date: Tue Feb 28 13:48:21 2012 +0100
make --auto (-a) use mongod's --nojournal option when possible, ...
so that we don't have to endure the long journal-initialization delay.
This avoids the failure of the t/auto test on systems where mongod
is configured to use a journal.
* configure.ac: Test whether mongod accepts the --nojournal option.
(MONGOD_NO_JOURNAL): Set/define new variable.
* auto.c (auto_arg_mongod, auto_arg_mongod_quiet): Use it.
auto.c | 2 ++
configure.ac | 9 +++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/auto.c b/auto.c
index 64f6a9a..3f0e827 100644
--- a/auto.c
+++ b/auto.c
@@ -27,6 +27,7 @@ static char auto_arg_port[10];
static const char *const auto_arg_mongod[] = {
"mongod",
+ MONGOD_NO_JOURNAL
"--port", auto_arg_port,
"--dbpath", AUTO_DIR_DB,
/* "--fork", */ /* chdirs god knows where, we cannot use this. */
@@ -39,6 +40,7 @@ static const char *const auto_arg_mongod[] = {
/* The --quiet option in mongod is useless, so redirect instead. */
static const char *const auto_arg_mongod_quiet[] = {
"mongod",
+ MONGOD_NO_JOURNAL
"--port", auto_arg_port,
"--dbpath", AUTO_DIR_DB,
"--logpath", AUTO_MONGOD_LOG,
diff --git a/configure.ac b/configure.ac
index ad9d53d..07e4dc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,15 @@ AC_CHECK_HEADER([mongo/client/dbclient.h], ,
[#undef VERSION])
AC_LANG_POP
+# If mongod supports the --nojournal option, use it.
+case `exec 2>/dev/null; mongod --help` in
+ *--nojournal*) MONGOD_NO_JOURNAL='"--nojournal",';;
+ *) MONGOD_NO_JOURNAL='/* empty */';;
+esac
+AC_DEFINE_UNQUOTED([MONGOD_NO_JOURNAL], [$MONGOD_NO_JOURNAL],
+ [Define to '"--nojournal",' or to a comment;
+ to be used when invoking mongod via iwhd -a.])
+
# Starting in jansson 2.1, file-loading functions require an
# additional "flags" argument. Test for this.
AC_CACHE_CHECK([whether json_load_file takes 3 arguments],
Show replies by date