diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-10-30 12:49:53 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-10-30 12:49:53 +1100 |
commit | e1b0cea427dd8d6927ccd64d53f9e3779d249790 (patch) | |
tree | be95a1f9bba786f0ecd08010c4952b732cdd8e25 /ctdb/common | |
parent | 0e7fa751affa7a74dbdb3e5dfbe6adc3f21ec8d4 (diff) | |
download | samba-e1b0cea427dd8d6927ccd64d53f9e3779d249790.tar.gz |
add control and logging of very high latencies.
log the type of operation and the database name for all latencies higher
than a treshold
(This used to be ctdb commit 1d581dcd507e8e13d7ae085ff4d6a9f3e2aaeba5)
Diffstat (limited to 'ctdb/common')
-rw-r--r-- | ctdb/common/ctdb_util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 7c2b171fa1a..efa8969fb97 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -124,12 +124,18 @@ static void *_idr_find_type(struct idr_context *idp, int id, const char *type, c /* update a max latency number */ -void ctdb_latency(double *latency, struct timeval t) +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 > ctdb_db->ctdb->tunable.log_latency_ms) { + DEBUG(DEBUG_WARNING, ("High latency %f for operation %s on database %s\n", l, name, ctdb_db->db_name)); + } + } } uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state) |