DEBUG(DEBUG_NOTICE,("CTDB daemon shutting down\n"));
}
+
+
+static void ctdb_time_tick(struct event_context *ev, struct timed_event *te,
+ struct timeval t, void *private_data)
+{
+ struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
+
+ if (getpid() != ctdbd_pid) {
+ return;
+ }
+
+ event_add_timed(ctdb->ev, ctdb,
+ timeval_current_ofs(1, 0),
+ ctdb_time_tick, ctdb);
+}
+
+/* Used to trigger a dummy event once per second, to make
+ * detection of hangs more reliable.
+ */
+static void ctdb_start_time_tickd(struct ctdb_context *ctdb)
+{
+ event_add_timed(ctdb->ev, ctdb,
+ timeval_current_ofs(1, 0),
+ ctdb_time_tick, ctdb);
+}
+
+
/* called when the "startup" event script has finished */
static void ctdb_start_transport(struct ctdb_context *ctdb)
{
/* start listening for recovery daemon pings */
ctdb_control_recd_ping(ctdb);
+
+ /* start listening to timer ticks */
+ ctdb_start_time_tickd(ctdb);
}
static void block_signal(int signum)
/*
start the protocol going as a daemon
*/
-int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
+int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog, const char *public_address_list)
{
int res, ret = -1;
struct fd_event *fde;
DEBUG(DEBUG_ERR, ("Starting CTDBD as pid : %u\n", ctdbd_pid));
- ctdb_high_priority(ctdb);
+ if (ctdb->do_setsched) {
+ /* try to set us up as realtime */
+ ctdb_set_scheduler(ctdb);
+ }
/* ensure the socket is deleted on exit of the daemon */
domain_socket_name = talloc_strdup(talloc_autofree_context(), ctdb->daemon.name);
if (ctdb->methods->initialise(ctdb) != 0) {
ctdb_fatal(ctdb, "transport failed to initialise");
}
+ if (public_address_list) {
+ ret = ctdb_set_public_addresses(ctdb, public_address_list);
+ if (ret == -1) {
+ DEBUG(DEBUG_ALERT,("Unable to setup public address list\n"));
+ exit(1);
+ }
+ }
+
/* attach to existing databases */
if (ctdb_attach_databases(ctdb) != 0) {
tevent_fd_set_auto_close(fde);
/* release any IPs we hold from previous runs of the daemon */
- ctdb_release_all_ips(ctdb);
+ if (ctdb->tunable.disable_ip_failover == 0) {
+ ctdb_release_all_ips(ctdb);
+ }
/* start the transport going */
ctdb_start_transport(ctdb);
size = (length+(CTDB_DS_ALIGNMENT-1)) & ~(CTDB_DS_ALIGNMENT-1);
if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Unable to allocate transport packet for operation %u of length %u. Transport is DOWN.\n",
+ DEBUG(DEBUG_INFO,(__location__ " Unable to allocate transport packet for operation %u of length %u. Transport is DOWN.\n",
operation, (unsigned)length));
return NULL;
}
int len;
if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to send message. Transport is DOWN\n"));
+ DEBUG(DEBUG_INFO,(__location__ " Failed to send message. Transport is DOWN\n"));
return -1;
}