]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
add a command line flag to ctdbd to start a recovery daemon.
authorRonnie Sahlberg <sahlberg@ronnie>
Tue, 8 May 2007 23:59:23 +0000 (09:59 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Tue, 8 May 2007 23:59:23 +0000 (09:59 +1000)
update the recovery test script to start all ctdb daemons with a
recovery daemon

(This used to be ctdb commit 47794e16df285cacefc30208d892d931a6e46b96)

ctdb/common/cmdline.c
ctdb/common/ctdb_daemon.c
ctdb/include/ctdb.h
ctdb/tests/recover.sh

index 6a8cdb51f31038c224f06d03a2a37efe81625fd3..3b95f7cc60ae2e2773fac5d1570b2ca8a24ea879 100644 (file)
@@ -38,6 +38,7 @@ static struct {
        int torture;
        const char *logfile;
        const char *events;
+       int recovery_daemon;
 } ctdb_cmdline = {
        .nlist = NULL,
        .transport = "tcp",
@@ -47,6 +48,7 @@ static struct {
        .db_dir = NULL,
        .torture = 0,
        .logfile = NULL,
+       .recovery_daemon = 0,
 };
 
 enum {OPT_EVENTSYSTEM=1};
@@ -71,6 +73,7 @@ struct poptOption popt_ctdb_cmdline[] = {
        { "socket", 0, POPT_ARG_STRING, &ctdb_cmdline.socketname, 0, "local socket name", "filename" },
        { "transport", 0, POPT_ARG_STRING, &ctdb_cmdline.transport, 0, "protocol transport", NULL },
        { "self-connect", 0, POPT_ARG_NONE, &ctdb_cmdline.self_connect, 0, "enable self connect", "boolean" },
+       { "recovery-daemon", 0, POPT_ARG_NONE, &ctdb_cmdline.recovery_daemon, 0, "enable recovery daemon", "boolean" },
        { "debug", 'd', POPT_ARG_INT, &LogLevel, 0, "debug level"},
        { "dbdir", 0, POPT_ARG_STRING, &ctdb_cmdline.db_dir, 0, "directory for the tdb files", NULL },
        { "torture", 0, POPT_ARG_NONE, &ctdb_cmdline.torture, 0, "enable nastiness in library", NULL },
@@ -112,6 +115,9 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
        if (ctdb_cmdline.torture) {
                ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE);
        }
+       if (ctdb_cmdline.recovery_daemon) {
+               ctdb_set_flags(ctdb, CTDB_FLAG_RECOVERY);
+       }
 
        ret = ctdb_set_transport(ctdb, ctdb_cmdline.transport);
        if (ret == -1) {
index 476f34d0a7d263b1303055bfd061cada868e1161..ce5cc73eaa68f38680cd53938272a8ed29bcd5cb 100644 (file)
@@ -720,6 +720,15 @@ int ctdb_start_daemon(struct ctdb_context *ctdb)
        ctdb->ev = event_context_init(NULL);
        fde = event_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, 
                           ctdb_accept_client, ctdb);
+
+       /* start the recovery daemon */
+       if (ctdb->flags & CTDB_FLAG_RECOVERY) {
+               char cmdstr[256];
+
+               sprintf(cmdstr, "ctdb_recoverd --socket=%s &",domain_socket_name); 
+               system(cmdstr);
+       }
+
        ctdb_main_loop(ctdb);
 
        return 0;
index ad3c8d2ab182254f3cc68a67a5b3d1cec43fd864..f5e02ebdee118514543c5952f424719ef5f9b8e2 100644 (file)
@@ -51,6 +51,7 @@ struct ctdb_call_info {
 */
 #define CTDB_FLAG_SELF_CONNECT (1<<0)
 #define CTDB_FLAG_TORTURE      (1<<1)
+#define CTDB_FLAG_RECOVERY     (1<<2)
 
 
 /* 
index 57e2f422fe2f6e44446021ba036a4549d39c9a3a..23603cc39676989f3b65da1d8635060c28c84eac 100755 (executable)
@@ -1,15 +1,13 @@
 #!/bin/sh
 
 killall -q ctdbd
-killall -q recoverd
+killall -q ctdb_recoverd
 
 echo "Starting 4 ctdb daemons"
-bin/ctdbd --nlist direct/4nodes.txt
-bin/ctdbd --nlist direct/4nodes.txt --listen=127.0.0.2:9001 --socket=/tmp/ctdb.socket.127.0.0.2
-bin/ctdbd --nlist direct/4nodes.txt --listen=127.0.0.3:9001 --socket=/tmp/ctdb.socket.127.0.0.3
-bin/ctdbd --nlist direct/4nodes.txt --listen=127.0.0.4:9001 --socket=/tmp/ctdb.socket.127.0.0.4
-echo "Starting one recovery daemon on node 0"
-bin/recoverd --socket=/tmp/ctdb.socket >/dev/null 2>/dev/null &
+bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt
+bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.2:9001 --socket=/tmp/ctdb.socket.127.0.0.2
+bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.3:9001 --socket=/tmp/ctdb.socket.127.0.0.3
+bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.4:9001 --socket=/tmp/ctdb.socket.127.0.0.4
 
 echo
 echo "Attaching to some databases"