From 07855ff5eba71e7d607d52e234a42553d9b93605 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 25 Jun 2009 11:50:45 +1000 Subject: [PATCH] Allow setting the recovery lock file as "", which means that we do not use a file and that we implicitely also disable the recovery lock checking. Update the init script to allow starting without a reclock file. --- config/ctdb.init | 5 ++--- server/ctdb_server.c | 11 +++++++++++ server/ctdbd.c | 6 +----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/config/ctdb.init b/config/ctdb.init index 4076c5be..ec71361d 100755 --- a/config/ctdb.init +++ b/config/ctdb.init @@ -47,12 +47,11 @@ loadconfig ctdb [ "${NETWORKING}" = "no" ] && exit 0 [ -z "$CTDB_RECOVERY_LOCK" ] && { - echo "You must configure the location of the CTDB_RECOVERY_LOCK" - exit 1 + echo "No recovery lock specified. Starting CTDB without split brain prevention" } -CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK" # build up CTDB_OPTIONS variable from optional parameters +[ -z "$CTDB_RECOVERY_LOCK" ] || CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK" [ -z "$CTDB_LOGFILE" ] || CTDB_OPTIONS="$CTDB_OPTIONS --logfile=$CTDB_LOGFILE" [ -z "$CTDB_NODES" ] || CTDB_OPTIONS="$CTDB_OPTIONS --nlist=$CTDB_NODES" [ -z "$CTDB_SOCKET" ] || CTDB_OPTIONS="$CTDB_OPTIONS --socket=$CTDB_SOCKET" diff --git a/server/ctdb_server.c b/server/ctdb_server.c index 59ed37c6..ba156e8f 100644 --- a/server/ctdb_server.c +++ b/server/ctdb_server.c @@ -61,6 +61,17 @@ int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip) */ int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file) { + if (ctdb->recovery_lock_file != NULL) { + talloc_free(ctdb->recovery_lock_file); + ctdb->recovery_lock_file = NULL; + } + + if (file == NULL) { + DEBUG(DEBUG_ALERT,("Recovery lock file set to \"\". Disabling recovery lock checking\n")); + ctdb->tunable.verify_recovery_lock = 0; + return 0; + } + ctdb->recovery_lock_file = talloc_strdup(ctdb, file); CTDB_NO_MEMORY(ctdb, ctdb->recovery_lock_file); diff --git a/server/ctdbd.c b/server/ctdbd.c index de6c39fb..efb3f080 100644 --- a/server/ctdbd.c +++ b/server/ctdbd.c @@ -160,11 +160,6 @@ int main(int argc, const char *argv[]) while (extra_argv[extra_argc]) extra_argc++; } - if (!options.recovery_lock_file) { - DEBUG(DEBUG_ALERT,("You must specifiy the location of a recovery lock file with --reclock\n")); - exit(1); - } - talloc_enable_null_tracking(); ctdb_block_signal(SIGPIPE); @@ -196,6 +191,7 @@ int main(int argc, const char *argv[]) ctdb_tunables_set_defaults(ctdb); + ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file); if (ret == -1) { DEBUG(DEBUG_ALERT,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb))); -- 2.34.1