#include "includes.h"
#include "lib/tdb/include/tdb.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
#include "lib/util/dlinklist.h"
#include "system/network.h"
#include "system/filesys.h"
return 0;
}
+/*
+ set the directory for internal state databases
+*/
+int ctdb_set_tdb_dir_state(struct ctdb_context *ctdb, const char *dir)
+{
+ ctdb->db_directory_state = talloc_strdup(ctdb, dir);
+ if (ctdb->db_directory_state == NULL) {
+ return -1;
+ }
+ return 0;
+}
+
/*
add a node to the list of nodes
*/
DEBUG(DEBUG_INFO, ("This node is configured to start in DISABLED state\n"));
node->flags |= NODE_FLAGS_DISABLED;
}
+ /* do we start out in STOPPED mode? */
+ if (ctdb->start_as_stopped != 0) {
+ DEBUG(DEBUG_INFO, ("This node is configured to start in STOPPED state\n"));
+ node->flags |= NODE_FLAGS_STOPPED;
+ }
}
ctdb->num_nodes++;
switch (hdr->operation) {
case CTDB_REQ_CALL:
- ctdb->statistics.node.req_call++;
+ CTDB_INCREMENT_STAT(ctdb, node.req_call);
ctdb_request_call(ctdb, hdr);
break;
case CTDB_REPLY_CALL:
- ctdb->statistics.node.reply_call++;
+ CTDB_INCREMENT_STAT(ctdb, node.reply_call);
ctdb_reply_call(ctdb, hdr);
break;
case CTDB_REPLY_ERROR:
- ctdb->statistics.node.reply_error++;
+ CTDB_INCREMENT_STAT(ctdb, node.reply_error);
ctdb_reply_error(ctdb, hdr);
break;
case CTDB_REQ_DMASTER:
- ctdb->statistics.node.req_dmaster++;
+ CTDB_INCREMENT_STAT(ctdb, node.req_dmaster);
ctdb_request_dmaster(ctdb, hdr);
break;
case CTDB_REPLY_DMASTER:
- ctdb->statistics.node.reply_dmaster++;
+ CTDB_INCREMENT_STAT(ctdb, node.reply_dmaster);
ctdb_reply_dmaster(ctdb, hdr);
break;
case CTDB_REQ_MESSAGE:
- ctdb->statistics.node.req_message++;
+ CTDB_INCREMENT_STAT(ctdb, node.req_message);
ctdb_request_message(ctdb, hdr);
break;
case CTDB_REQ_CONTROL:
- ctdb->statistics.node.req_control++;
+ CTDB_INCREMENT_STAT(ctdb, node.req_control);
ctdb_request_control(ctdb, hdr);
break;
case CTDB_REPLY_CONTROL:
- ctdb->statistics.node.reply_control++;
+ CTDB_INCREMENT_STAT(ctdb, node.reply_control);
ctdb_reply_control(ctdb, hdr);
break;
case CTDB_REQ_KEEPALIVE:
- ctdb->statistics.keepalive_packets_recv++;
+ CTDB_INCREMENT_STAT(ctdb, keepalive_packets_recv);
break;
default:
/*
- trigered when a deferred packet is due
+ triggered when a deferred packet is due
*/
static void queue_next_trigger(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)
return;
}
- ctdb->statistics.node_packets_sent++;
+ CTDB_INCREMENT_STAT(ctdb, node_packets_sent);
if (!ctdb_validate_pnn(ctdb, hdr->destnode)) {
DEBUG(DEBUG_CRIT,(__location__ " cant send to node %u that does not exist\n",
if (node->pnn == ctdb->pnn) {
ctdb_defer_packet(ctdb, hdr);
- } else {
- if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ALERT, (__location__ " Can not queue packet. Transport is DOWN\n"));
- return;
- }
+ return;
+ }
- node->tx_cnt++;
- if (ctdb->methods->queue_pkt(node, (uint8_t *)hdr, hdr->length) != 0) {
- ctdb_fatal(ctdb, "Unable to queue packet\n");
- }
+ if (ctdb->methods == NULL) {
+ DEBUG(DEBUG_ALERT, (__location__ " Can not queue packet. "
+ "Transport is DOWN\n"));
+ return;
+ }
+
+ node->tx_cnt++;
+ if (ctdb->methods->queue_pkt(node, (uint8_t *)hdr, hdr->length) != 0) {
+ ctdb_fatal(ctdb, "Unable to queue packet\n");
}
}