delay loading the public ip address file until after we have started the transport...
[metze/ctdb/wip.git] / server / ctdbd.c
index 12e754e1bac6e1e5775bc760143a9eb15d1ad184..b90dbcdf1e41683d3f61e30bdb9bf0bf26689a45 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
 #include "system/filesys.h"
 #include "popt.h"
 #include "system/time.h"
@@ -64,6 +64,7 @@ static struct {
 };
 
 int script_log_level;
+bool fast_start;
 
 /*
   called by the transport layer when a packet comes in
@@ -72,7 +73,7 @@ static void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t len
 {
        struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
 
-       ctdb->statistics.node_packets_recv++;
+       CTDB_INCREMENT_STAT(ctdb, node_packets_recv);
 
        /* up the counter for this source node, so we know its alive */
        if (ctdb_validate_pnn(ctdb, hdr->srcnode)) {
@@ -144,6 +145,7 @@ int main(int argc, const char *argv[])
                  &options.max_persistent_check_errors, 0,
                  "max allowed persistent check errors (default 0)", NULL },
                { "log-ringbuf-size", 0, POPT_ARG_INT, &log_ringbuf_size, DEBUG_ERR, "Number of log messages we can store in the memory ringbuffer", NULL },
+               { "sloppy-start", 0, POPT_ARG_NONE, &fast_start, 0, "Do not perform full recovery on start", NULL },
                POPT_TABLEEND
        };
        int opt, ret;
@@ -176,6 +178,7 @@ int main(int argc, const char *argv[])
        fault_setup("ctdbd");
 
        ev = event_context_init(NULL);
+       tevent_loop_allow_nesting(ev);
 
        ctdb = ctdb_cmdline_init(ev);
 
@@ -192,6 +195,7 @@ int main(int argc, const char *argv[])
        }
 
        DEBUG(DEBUG_NOTICE,("Starting CTDB daemon\n"));
+
        gettimeofday(&ctdb->ctdbd_start_time, NULL);
        gettimeofday(&ctdb->last_recovery_started, NULL);
        gettimeofday(&ctdb->last_recovery_finished, NULL);
@@ -203,6 +207,7 @@ int main(int argc, const char *argv[])
 
        ctdb_tunables_set_defaults(ctdb);
 
+       ctdb->tunable.disable_ip_failover = options.no_publicipcheck;
 
        ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file);
        if (ret == -1) {
@@ -295,14 +300,6 @@ int main(int argc, const char *argv[])
                }
        }
 
-       if (options.public_address_list) {
-               ret = ctdb_set_public_addresses(ctdb, options.public_address_list);
-               if (ret == -1) {
-                       DEBUG(DEBUG_ALERT,("Unable to setup public address list\n"));
-                       exit(1);
-               }
-       }
-
        ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
        if (ret == -1) {
                DEBUG(DEBUG_ALERT,("Unable to setup event script directory\n"));
@@ -319,8 +316,6 @@ int main(int argc, const char *argv[])
 
        ctdb->valgrinding = options.valgrinding;
 
-       ctdb->do_checkpublicip = !options.no_publicipcheck;
-
        if (options.max_persistent_check_errors < 0) {
                ctdb->max_persistent_check_errors = 0xFFFFFFFFFFFFFFFFLL;
        } else {
@@ -334,5 +329,5 @@ int main(int argc, const char *argv[])
        }
 
        /* start the protocol running (as a child) */
-       return ctdb_start_daemon(ctdb, interactive?False:True, options.use_syslog);
+       return ctdb_start_daemon(ctdb, interactive?False:True, options.use_syslog, options.public_address_list);
 }