run the "init" event before we freeze the databases
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 24 Aug 2010 22:34:35 +0000 (08:34 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 24 Aug 2010 22:35:24 +0000 (08:35 +1000)
so that we can read from databases during this event

server/ctdb_daemon.c

index 1d803058e9877d053960a860dc17f5ee2e466f40..5d73b0d5d9b99a21dba6cc7cb3246b99949f6a08 100644 (file)
@@ -810,17 +810,17 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
                ctdb_fatal(ctdb, "Failed to attach to databases\n");
        }
 
-       /* start frozen, then let the first election sort things out */
-       if (ctdb_blocking_freeze(ctdb)) {
-               ctdb_fatal(ctdb, "Failed to get initial freeze\n");
-       }
-
        ret = ctdb_event_script(ctdb, CTDB_EVENT_INIT);
        if (ret != 0) {
                ctdb_fatal(ctdb, "Failed to run init event\n");
        }
        ctdb_run_notification_script(ctdb, "init");
 
+       /* start frozen, then let the first election sort things out */
+       if (ctdb_blocking_freeze(ctdb)) {
+               ctdb_fatal(ctdb, "Failed to get initial freeze\n");
+       }
+
        /* now start accepting clients, only can do this once frozen */
        fde = event_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd, 
                           EVENT_FD_READ,