]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
if lockwait takes an excessive time to complete. log the time it took to
authorRonnie Sahlberg <sahlberg@ronnie>
Tue, 21 Aug 2007 23:46:48 +0000 (09:46 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Tue, 21 Aug 2007 23:46:48 +0000 (09:46 +1000)
complete and also the name of the database

(This used to be ctdb commit 221ef0348fd8113a017d229d8c2c7aa5c4dfb5c2)

ctdb/server/ctdb_lockwait.c

index 5b0019836e8f097f0ea816222eeee7ed55e74856..ba2e1088eee07b9f785af7be2219c05ea953fc7d 100644 (file)
@@ -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--;