ctdbd_pid : dont assign the ctdbd_pid until we have finished startup and thus dont...
authorroot <root@int001st001.VSOFS1.COM>
Mon, 4 Apr 2011 23:20:10 +0000 (09:20 +1000)
committerroot <root@int001st001.VSOFS1.COM>
Mon, 4 Apr 2011 23:20:10 +0000 (09:20 +1000)
During startup there are some initial setup and commands done synchronous which means it is semi-normal to have the eventsystem blocked for some situations.

Once startup has finished, all handling should be asynchronous so activate the monitoring of the eventsystems at that stage.

CQ S1021936

server/ctdb_daemon.c
server/ctdb_monitor.c

index 75344ad386c73bd2ea8b52fa9d859e2e14eb42c9..f0c7ec9f6cee9b61b86fc849eca40f203edcb181 100644 (file)
@@ -50,7 +50,7 @@ static void ctdb_time_tick(struct event_context *ev, struct timed_event *te,
 {
        struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
 
-       if (getpid() != ctdbd_pid) {
+       if (getpid() != ctdb->ctdbd_pid) {
                return;
        }
 
@@ -776,11 +776,10 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
        }
        block_signal(SIGPIPE);
 
-       ctdbd_pid = getpid();
-       ctdb->ctdbd_pid = ctdbd_pid;
+       ctdb->ctdbd_pid = getpid();
 
 
-       DEBUG(DEBUG_ERR, ("Starting CTDBD as pid : %u\n", ctdbd_pid));
+       DEBUG(DEBUG_ERR, ("Starting CTDBD as pid : %u\n", ctdb->ctdbd_pid));
 
        if (ctdb->do_setsched) {
                /* try to set us up as realtime */
index 820e082bc8a563f37176df0f5c0d0f7d12327146..89fa886690dbb53a7f98c7e6d62cd7320c5f9371 100644 (file)
@@ -203,6 +203,7 @@ static void ctdb_startup_callback(struct ctdb_context *ctdb, int status, void *p
        } else if (status == 0) {
                DEBUG(DEBUG_NOTICE,("startup event OK - enabling monitoring\n"));
                ctdb->done_startup = true;
+               ctdbd_pid = ctdb->ctdbd_pid;
                ctdb->monitor->next_interval = 2;
                ctdb_run_notification_script(ctdb, "startup");
        }