From: Ronnie Sahlberg Date: Wed, 29 Sep 2010 00:38:41 +0000 (+1000) Subject: Create macros to update the statistics counters and use these macros X-Git-Url: http://git.samba.org/?p=metze%2Fctdb%2Fwip.git;a=commitdiff_plain;h=2e648df890e5713bc575965d87937827b068d0d7 Create macros to update the statistics counters and use these macros everywhere instead of manipulating the coutenrs directly. --- diff --git a/common/ctdb_util.c b/common/ctdb_util.c index 46c737af..4acfa3f3 100644 --- a/common/ctdb_util.c +++ b/common/ctdb_util.c @@ -123,40 +123,6 @@ static void *_idr_find_type(struct idr_context *idp, int id, const char *type, c return p; } - -/* - update a max latency number - */ -void ctdb_latency(struct ctdb_db_context *ctdb_db, const char *name, double *latency, struct timeval t) -{ - double l = timeval_elapsed(&t); - if (l > *latency) { - *latency = l; - } - - if (ctdb_db->ctdb->tunable.log_latency_ms !=0) { - if (l*1000 > ctdb_db->ctdb->tunable.log_latency_ms) { - DEBUG(DEBUG_WARNING, ("High latency %.6fs for operation %s on database %s\n", l, name, ctdb_db->db_name)); - } - } -} - -/* - update a reclock latency number - */ -void ctdb_reclock_latency(struct ctdb_context *ctdb, const char *name, double *latency, double l) -{ - if (l > *latency) { - *latency = l; - } - - if (ctdb->tunable.reclock_latency_ms !=0) { - if (l*1000 > ctdb->tunable.reclock_latency_ms) { - DEBUG(DEBUG_ERR, ("High RECLOCK latency %fs for operation %s\n", l, name)); - } - } -} - uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state) { int id = idr_get_new_above(ctdb->idr, state, ctdb->lastid+1, INT_MAX); diff --git a/include/ctdb_private.h b/include/ctdb_private.h index cd6aeec1..1f247705 100644 --- a/include/ctdb_private.h +++ b/include/ctdb_private.h @@ -276,8 +276,58 @@ struct ctdb_daemon_data { struct ctdb_queue *queue; }; + +#define CTDB_UPDATE_STAT(ctdb, counter, value) \ + { \ + if (value > ctdb->statistics.counter) { \ + ctdb->statistics.counter = c->hopcount; \ + } \ + } + +#define CTDB_INCREMENT_STAT(ctdb, counter) \ + { \ + ctdb->statistics.counter++; \ + } + +#define CTDB_DECREMENT_STAT(ctdb, counter) \ + { \ + if (ctdb->statistics.counter > 0) \ + ctdb->statistics.counter--; \ + } + +#define CTDB_UPDATE_RECLOCK_LATENCY(ctdb, name, counter, value) \ + { \ + if (value > ctdb->statistics.counter) { \ + ctdb->statistics.counter = value; \ + } \ + \ + if (ctdb->tunable.reclock_latency_ms != 0) { \ + if (value*1000 > ctdb->tunable.reclock_latency_ms) { \ + DEBUG(DEBUG_ERR, ("High RECLOCK latency %fs for operation %s\n", value, name)); \ + } \ + } \ + } + + +#define CTDB_UPDATE_LATENCY(ctdb, db, operation, counter, t) \ + { \ + double l = timeval_elapsed(&t); \ + if (l > ctdb->statistics.counter) { \ + ctdb->statistics.counter = l; \ + } \ + \ + if (ctdb->tunable.log_latency_ms !=0) { \ + if (l*1000 > ctdb->tunable.log_latency_ms) { \ + DEBUG(DEBUG_WARNING, ("High latency %.6fs for operation %s on database %s\n", l, operation, db->db_name));\ + } \ + } \ + } + + + + /* - ctdb status information + ctdb statistics information */ struct ctdb_statistics { uint32_t num_clients; @@ -748,9 +798,6 @@ void ctdb_recv_raw_pkt(void *p, uint8_t *data, uint32_t length); int ctdb_socket_connect(struct ctdb_context *ctdb); -void ctdb_latency(struct ctdb_db_context *ctdb_db, const char *name, double *latency, struct timeval t); -void ctdb_reclock_latency(struct ctdb_context *ctdb, const char *name, double *latency, double l); - #define CTDB_BAD_REQID ((uint32_t)-1) uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state); void *_ctdb_reqid_find(struct ctdb_context *ctdb, uint32_t reqid, const char *type, const char *location); @@ -1339,4 +1386,6 @@ int update_ip_assignment_tree(struct ctdb_context *ctdb, int ctdb_init_tevent_logging(struct ctdb_context *ctdb); +int ctdb_update_stat_counter(struct ctdb_context *ctdb, uint32_t *counter, uint32_t value); + #endif diff --git a/server/ctdb_call.c b/server/ctdb_call.c index 84a8c78e..0bb7902d 100644 --- a/server/ctdb_call.c +++ b/server/ctdb_call.c @@ -463,9 +463,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) return; } - if (c->hopcount > ctdb->statistics.max_hop_count) { - ctdb->statistics.max_hop_count = c->hopcount; - } + CTDB_UPDATE_STAT(ctdb, max_hop_count, c->hopcount); /* if this nodes has done enough consecutive calls on the same record then give them the record @@ -827,7 +825,7 @@ void ctdb_send_keepalive(struct ctdb_context *ctdb, uint32_t destnode) r->hdr.destnode = destnode; r->hdr.reqid = 0; - ctdb->statistics.keepalive_packets_sent++; + CTDB_INCREMENT_STAT(ctdb, keepalive_packets_sent); ctdb_queue_packet(ctdb, &r->hdr); diff --git a/server/ctdb_control.c b/server/ctdb_control.c index bfb7bd1c..6dd69f35 100644 --- a/server/ctdb_control.c +++ b/server/ctdb_control.c @@ -461,7 +461,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, case CTDB_CONTROL_RECD_RECLOCK_LATENCY: CHECK_CONTROL_DATA_SIZE(sizeof(double)); - ctdb_reclock_latency(ctdb, "recd reclock", &ctdb->statistics.reclock.recd, *((double *)indata.dptr)); + CTDB_UPDATE_RECLOCK_LATENCY(ctdb, "recd reclock", reclock.recd, *((double *)indata.dptr)); return 0; case CTDB_CONTROL_GET_RECLOCK_FILE: CHECK_CONTROL_DATA_SIZE(0); @@ -720,7 +720,7 @@ static void ctdb_control_timeout(struct event_context *ev, struct timed_event *t struct ctdb_control_state *state = talloc_get_type(private_data, struct ctdb_control_state); TALLOC_CTX *tmp_ctx = talloc_new(ev); - state->ctdb->statistics.timeouts.control++; + CTDB_INCREMENT_STAT(state->ctdb, timeouts.control); talloc_steal(tmp_ctx, state); diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c index 418d91ed..93d6b3ac 100644 --- a/server/ctdb_daemon.c +++ b/server/ctdb_daemon.c @@ -97,7 +97,7 @@ static void block_signal(int signum) */ static int daemon_queue_send(struct ctdb_client *client, struct ctdb_req_header *hdr) { - client->ctdb->statistics.client_packets_sent++; + CTDB_INCREMENT_STAT(client->ctdb, client_packets_sent); if (hdr->operation == CTDB_REQ_MESSAGE) { if (ctdb_queue_length(client->queue) > client->ctdb->tunable.max_queue_depth_drop_msg) { DEBUG(DEBUG_ERR,("CTDB_REQ_MESSAGE queue full - killing client connection.\n")); @@ -184,9 +184,7 @@ static int ctdb_client_destructor(struct ctdb_client *client) ctdb_takeover_client_destructor_hook(client); ctdb_reqid_remove(client->ctdb, client->client_id); - if (client->ctdb->statistics.num_clients) { - client->ctdb->statistics.num_clients--; - } + CTDB_DECREMENT_STAT(client->ctdb, num_clients); if (client->num_persistent_updates != 0) { DEBUG(DEBUG_ERR,(__location__ " Client disconnecting with %u persistent updates in flight. Starting recovery\n", client->num_persistent_updates)); @@ -258,10 +256,9 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state) res = ctdb_daemon_call_recv(state, dstate->call); if (res != 0) { DEBUG(DEBUG_ERR, (__location__ " ctdbd_call_recv() returned error\n")); - if (client->ctdb->statistics.pending_calls > 0) { - client->ctdb->statistics.pending_calls--; - } - ctdb_latency(ctdb_db, "call_from_client_cb 1", &client->ctdb->statistics.max_call_latency, dstate->start_time); + CTDB_DECREMENT_STAT(client->ctdb, pending_calls); + + CTDB_UPDATE_LATENCY(client->ctdb, ctdb_db, "call_from_client_cb 1", max_call_latency, dstate->start_time); return; } @@ -270,10 +267,8 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state) length, struct ctdb_reply_call); if (r == NULL) { DEBUG(DEBUG_ERR, (__location__ " Failed to allocate reply_call in ctdb daemon\n")); - if (client->ctdb->statistics.pending_calls > 0) { - client->ctdb->statistics.pending_calls--; - } - ctdb_latency(ctdb_db, "call_from_client_cb 2", &client->ctdb->statistics.max_call_latency, dstate->start_time); + CTDB_DECREMENT_STAT(client->ctdb, pending_calls); + CTDB_UPDATE_LATENCY(client->ctdb, ctdb_db, "call_from_client_cb 2", max_call_latency, dstate->start_time); return; } r->hdr.reqid = dstate->reqid; @@ -288,11 +283,9 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state) if (res != 0) { DEBUG(DEBUG_ERR, (__location__ " Failed to queue packet from daemon to client\n")); } - ctdb_latency(ctdb_db, "call_from_client_cb 3", &client->ctdb->statistics.max_call_latency, dstate->start_time); + CTDB_UPDATE_LATENCY(client->ctdb, ctdb_db, "call_from_client_cb 3", max_call_latency, dstate->start_time); + CTDB_DECREMENT_STAT(client->ctdb, pending_calls); talloc_free(dstate); - if (client->ctdb->statistics.pending_calls > 0) { - client->ctdb->statistics.pending_calls--; - } } struct ctdb_daemon_packet_wrap { @@ -344,18 +337,14 @@ static void daemon_request_call_from_client(struct ctdb_client *client, struct ctdb_context *ctdb = client->ctdb; struct ctdb_daemon_packet_wrap *w; - ctdb->statistics.total_calls++; - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls++; - } + CTDB_INCREMENT_STAT(ctdb, total_calls); + CTDB_DECREMENT_STAT(ctdb, pending_calls); ctdb_db = find_ctdb_db(client->ctdb, c->db_id); if (!ctdb_db) { DEBUG(DEBUG_ERR, (__location__ " Unknown database in request. db_id==0x%08x", c->db_id)); - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls--; - } + CTDB_DECREMENT_STAT(ctdb, pending_calls); return; } @@ -383,9 +372,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client, daemon_incoming_packet_wrap, w, True); if (ret == -2) { /* will retry later */ - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls--; - } + CTDB_DECREMENT_STAT(ctdb, pending_calls); return; } @@ -393,9 +380,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client, if (ret != 0) { DEBUG(DEBUG_ERR,(__location__ " Unable to fetch record\n")); - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls--; - } + CTDB_DECREMENT_STAT(ctdb, pending_calls); return; } @@ -407,9 +392,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client, } DEBUG(DEBUG_ERR,(__location__ " Unable to allocate dstate\n")); - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls--; - } + CTDB_DECREMENT_STAT(ctdb, pending_calls); return; } dstate->start_time = timeval_current(); @@ -425,10 +408,8 @@ static void daemon_request_call_from_client(struct ctdb_client *client, } DEBUG(DEBUG_ERR,(__location__ " Unable to allocate call\n")); - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls--; - } - ctdb_latency(ctdb_db, "call_from_client 1", &ctdb->statistics.max_call_latency, dstate->start_time); + CTDB_DECREMENT_STAT(ctdb, pending_calls); + CTDB_UPDATE_LATENCY(ctdb, ctdb_db, "call_from_client 1", max_call_latency, dstate->start_time); return; } @@ -451,10 +432,8 @@ static void daemon_request_call_from_client(struct ctdb_client *client, if (state == NULL) { DEBUG(DEBUG_ERR,(__location__ " Unable to setup call send\n")); - if (client->ctdb->statistics.pending_calls > 0) { - ctdb->statistics.pending_calls--; - } - ctdb_latency(ctdb_db, "call_from_client 2", &ctdb->statistics.max_call_latency, dstate->start_time); + CTDB_DECREMENT_STAT(ctdb, pending_calls); + CTDB_UPDATE_LATENCY(ctdb, ctdb_db, "call_from_client 2", max_call_latency, dstate->start_time); return; } talloc_steal(state, dstate); @@ -494,17 +473,17 @@ static void daemon_incoming_packet(void *p, struct ctdb_req_header *hdr) switch (hdr->operation) { case CTDB_REQ_CALL: - ctdb->statistics.client.req_call++; + CTDB_INCREMENT_STAT(ctdb, client.req_call); daemon_request_call_from_client(client, (struct ctdb_req_call *)hdr); break; case CTDB_REQ_MESSAGE: - ctdb->statistics.client.req_message++; + CTDB_INCREMENT_STAT(ctdb, client.req_message); daemon_request_message_from_client(client, (struct ctdb_req_message *)hdr); break; case CTDB_REQ_CONTROL: - ctdb->statistics.client.req_control++; + CTDB_INCREMENT_STAT(ctdb, client.req_control); daemon_request_control_from_client(client, (struct ctdb_req_control *)hdr); break; @@ -530,7 +509,7 @@ static void ctdb_daemon_read_cb(uint8_t *data, size_t cnt, void *args) return; } - client->ctdb->statistics.client_packets_recv++; + CTDB_INCREMENT_STAT(client->ctdb, client_packets_recv); if (cnt < sizeof(*hdr)) { ctdb_set_error(client->ctdb, "Bad packet length %u in daemon\n", @@ -635,7 +614,7 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, talloc_set_destructor(client, ctdb_client_destructor); talloc_set_destructor(client_pid, ctdb_clientpid_destructor); - ctdb->statistics.num_clients++; + CTDB_INCREMENT_STAT(ctdb, num_clients); } diff --git a/server/ctdb_lockwait.c b/server/ctdb_lockwait.c index 9c96bfb4..9bbc25f9 100644 --- a/server/ctdb_lockwait.c +++ b/server/ctdb_lockwait.c @@ -53,8 +53,8 @@ static void lockwait_handler(struct event_context *ev, struct fd_event *fde, key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize); talloc_set_destructor(h, NULL); - ctdb_latency(h->ctdb_db, "lockwait", &h->ctdb->statistics.max_lockwait_latency, h->start_time); - h->ctdb->statistics.pending_lockwait_calls--; + CTDB_UPDATE_LATENCY(h->ctdb, h->ctdb_db, "lockwait", max_lockwait_latency, h->start_time); + CTDB_DECREMENT_STAT(h->ctdb, pending_lockwait_calls); /* the handle needs to go away when the context is gone - when the handle goes away this implicitly closes the pipe, which @@ -77,7 +77,7 @@ static void lockwait_handler(struct event_context *ev, struct fd_event *fde, static int lockwait_destructor(struct lockwait_handle *h) { - h->ctdb->statistics.pending_lockwait_calls--; + CTDB_DECREMENT_STAT(h->ctdb, pending_lockwait_calls); kill(h->child, SIGKILL); return 0; } @@ -101,11 +101,11 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, int ret; pid_t parent = getpid(); - ctdb_db->ctdb->statistics.lockwait_calls++; - ctdb_db->ctdb->statistics.pending_lockwait_calls++; + CTDB_INCREMENT_STAT(ctdb_db->ctdb, lockwait_calls); + CTDB_INCREMENT_STAT(ctdb_db->ctdb, pending_lockwait_calls); if (!(result = talloc_zero(private_data, struct lockwait_handle))) { - ctdb_db->ctdb->statistics.pending_lockwait_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_lockwait_calls); return NULL; } @@ -113,7 +113,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, if (ret != 0) { talloc_free(result); - ctdb_db->ctdb->statistics.pending_lockwait_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_lockwait_calls); return NULL; } @@ -123,7 +123,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, close(result->fd[0]); close(result->fd[1]); talloc_free(result); - ctdb_db->ctdb->statistics.pending_lockwait_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_lockwait_calls); return NULL; } @@ -158,7 +158,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, (void *)result); if (result->fde == NULL) { talloc_free(result); - ctdb_db->ctdb->statistics.pending_lockwait_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_lockwait_calls); return NULL; } tevent_fd_set_auto_close(result->fde); diff --git a/server/ctdb_persistent.c b/server/ctdb_persistent.c index dc05cbfa..8672c5b3 100644 --- a/server/ctdb_persistent.c +++ b/server/ctdb_persistent.c @@ -455,7 +455,7 @@ struct childwrite_handle { static int childwrite_destructor(struct childwrite_handle *h) { - h->ctdb->statistics.pending_childwrite_calls--; + CTDB_DECREMENT_STAT(h->ctdb, pending_childwrite_calls); kill(h->child, SIGKILL); return 0; } @@ -475,8 +475,8 @@ static void childwrite_handler(struct event_context *ev, struct fd_event *fde, int ret; char c; - ctdb_latency(h->ctdb_db, "persistent", &h->ctdb->statistics.max_childwrite_latency, h->start_time); - h->ctdb->statistics.pending_childwrite_calls--; + CTDB_UPDATE_LATENCY(h->ctdb, h->ctdb_db, "persistent", max_childwrite_latency, h->start_time); + CTDB_DECREMENT_STAT(h->ctdb, pending_childwrite_calls); /* the handle needs to go away when the context is gone - when the handle goes away this implicitly closes the pipe, which @@ -508,11 +508,11 @@ struct childwrite_handle *ctdb_childwrite(struct ctdb_db_context *ctdb_db, int ret; pid_t parent = getpid(); - ctdb_db->ctdb->statistics.childwrite_calls++; - ctdb_db->ctdb->statistics.pending_childwrite_calls++; + CTDB_INCREMENT_STAT(ctdb_db->ctdb, childwrite_calls); + CTDB_INCREMENT_STAT(ctdb_db->ctdb, pending_childwrite_calls); if (!(result = talloc_zero(state, struct childwrite_handle))) { - ctdb_db->ctdb->statistics.pending_childwrite_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_childwrite_calls); return NULL; } @@ -520,7 +520,7 @@ struct childwrite_handle *ctdb_childwrite(struct ctdb_db_context *ctdb_db, if (ret != 0) { talloc_free(result); - ctdb_db->ctdb->statistics.pending_childwrite_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_childwrite_calls); return NULL; } @@ -530,7 +530,7 @@ struct childwrite_handle *ctdb_childwrite(struct ctdb_db_context *ctdb_db, close(result->fd[0]); close(result->fd[1]); talloc_free(result); - ctdb_db->ctdb->statistics.pending_childwrite_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_childwrite_calls); return NULL; } @@ -571,7 +571,7 @@ struct childwrite_handle *ctdb_childwrite(struct ctdb_db_context *ctdb_db, (void *)result); if (result->fde == NULL) { talloc_free(result); - ctdb_db->ctdb->statistics.pending_childwrite_calls--; + CTDB_DECREMENT_STAT(ctdb_db->ctdb, pending_childwrite_calls); return NULL; } tevent_fd_set_auto_close(result->fde); diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c index 81e2d4b2..111d7a98 100644 --- a/server/ctdb_recover.c +++ b/server/ctdb_recover.c @@ -575,7 +575,7 @@ static int set_recmode_destructor(struct ctdb_set_recmode_state *state) { double l = timeval_elapsed(&state->start_time); - ctdb_reclock_latency(state->ctdb, "daemon reclock", &state->ctdb->statistics.reclock.ctdbd, l); + CTDB_UPDATE_RECLOCK_LATENCY(state->ctdb, "daemon reclock", reclock.ctdbd, l); if (state->fd[0] != -1) { state->fd[0] = -1; @@ -938,7 +938,7 @@ static void ctdb_end_recovery_callback(struct ctdb_context *ctdb, int status, vo struct recovery_callback_state *state = talloc_get_type(p, struct recovery_callback_state); ctdb_enable_monitoring(ctdb); - ctdb->statistics.num_recoveries++; + CTDB_INCREMENT_STAT(ctdb, num_recoveries); if (status != 0) { DEBUG(DEBUG_ERR,(__location__ " recovered event script failed (status %d)\n", status)); diff --git a/server/ctdb_server.c b/server/ctdb_server.c index e4708eb4..3aae28e3 100644 --- a/server/ctdb_server.c +++ b/server/ctdb_server.c @@ -367,47 +367,47 @@ void ctdb_input_pkt(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) 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: @@ -578,7 +578,7 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) 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", diff --git a/server/ctdb_traverse.c b/server/ctdb_traverse.c index b30af7e2..dcb16b22 100644 --- a/server/ctdb_traverse.c +++ b/server/ctdb_traverse.c @@ -236,7 +236,7 @@ static void ctdb_traverse_all_timeout(struct event_context *ev, struct timed_eve struct ctdb_traverse_all_handle *state = talloc_get_type(private_data, struct ctdb_traverse_all_handle); DEBUG(DEBUG_ERR,(__location__ " Traverse all timeout on database:%s\n", state->ctdb_db->db_name)); - state->ctdb->statistics.timeouts.traverse++; + CTDB_INCREMENT_STAT(state->ctdb, timeouts.traverse); state->callback(state->private_data, tdb_null, tdb_null); } diff --git a/server/ctdbd.c b/server/ctdbd.c index 674ebab6..f8647f09 100644 --- a/server/ctdbd.c +++ b/server/ctdbd.c @@ -73,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)) {