From 5fef81a6f18ce7d6814b5e75a968a93ad77c9af8 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 22 Aug 2007 09:46:48 +1000 Subject: [PATCH] if lockwait takes an excessive time to complete. log the time it took to complete and also the name of the database (This used to be ctdb commit 221ef0348fd8113a017d229d8c2c7aa5c4dfb5c2) --- ctdb/server/ctdb_lockwait.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ctdb/server/ctdb_lockwait.c b/ctdb/server/ctdb_lockwait.c index 5b0019836e8..ba2e1088eee 100644 --- a/ctdb/server/ctdb_lockwait.c +++ b/ctdb/server/ctdb_lockwait.c @@ -38,6 +38,9 @@ struct lockwait_handle { struct timeval start_time; }; + +/* This handler is called when a lockwait child process has completed the lock + */ static void lockwait_handler(struct event_context *ev, struct fd_event *fde, uint16_t flags, void *private_data) { @@ -49,10 +52,20 @@ static void lockwait_handler(struct event_context *ev, struct fd_event *fde, TDB_DATA key = h->key; struct tdb_context *tdb = h->ctdb_db->ltdb->tdb; TALLOC_CTX *tmp_ctx = talloc_new(ev); + double l; key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize); talloc_set_destructor(h, NULL); + + /* If a lockwait takes excessive time to complete we want + this logged + */ + l = timeval_elapsed(&h->start_time); + if (l > 1.0) { + DEBUG(0,("Lockwait took %.6f seconds to complete for database %s\n", l, h->ctdb_db->db_name)); + } + ctdb_latency(&h->ctdb->statistics.max_lockwait_latency, h->start_time); h->ctdb->statistics.pending_lockwait_calls--; -- 2.47.3