Allow setting the recovery lock file as "", which means that we do not use a file...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 25 Jun 2009 01:50:45 +0000 (11:50 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 25 Jun 2009 01:50:45 +0000 (11:50 +1000)
Update the init script to allow starting without a reclock file.

config/ctdb.init
server/ctdb_server.c
server/ctdbd.c

index 4076c5be8bba3216bd57f4e3fff10a99e94e2d4d..ec71361d5de111a3bcbe00e612fd7cecfb8f4f7f 100755 (executable)
@@ -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"
index 59ed37c6008b97a71eb3d8e635a8f744f0b97b1d..ba156e8f71d21ae0c1f9ea1bd2d0075015702416 100644 (file)
@@ -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);
 
index de6c39fbca7331fb3d3ceef30b092f70a94f63ab..efb3f0801c69dd2673f1ee1799d00486dd2cf7e7 100644 (file)
@@ -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)));