]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Track show long the last ring sync took.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 26 Oct 2017 11:18:50 +0000 (14:18 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 1 Nov 2017 15:54:24 +0000 (17:54 +0200)
src/director/director-connection.c
src/director/director.c
src/director/director.h

index 8903e0a3a95a0d016fef9b5dbf523dee5166153b..128f297987412a6ad0a7a8ed2435edbcfdbac80a 100644 (file)
@@ -1466,6 +1466,10 @@ director_connection_sync_host(struct director_connection *conn,
                        dir_debug("Ring is synced (%s sent seq=%u, hosts_hash=%u)",
                                  conn->name, seq,
                                  mail_hosts_hash(dir->mail_hosts));
+                       int sync_msecs =
+                               timeval_diff_msecs(&ioloop_timeval, &dir->last_sync_start_time);
+                       if (sync_msecs >= 0)
+                               dir->last_sync_msecs = sync_msecs;
                        director_set_ring_synced(dir);
                }
        } else {
index 1441cace4ccbbf2bfdfdede416e0ab3028ad4776..972a85860b40832f4b689e196d48b9cef2736072 100644 (file)
@@ -362,8 +362,10 @@ void director_sync_send(struct director *dir, struct director_host *host,
 {
        string_t *str;
 
-       if (host == dir->self_host)
+       if (host == dir->self_host) {
                dir->last_sync_sent_ring_change_counter = dir->ring_change_counter;
+               dir->last_sync_start_time = ioloop_timeval;
+       }
 
        str = t_str_new(128);
        str_printfa(str, "SYNC\t%s\t%u\t%u",
index bfd37e61255a2349cff2487f73294eda2a1999c9..fff719ad48d19a5d873a0f947c8123b0e87824ca 100644 (file)
@@ -137,9 +137,15 @@ struct director {
        unsigned int sync_seq;
        unsigned int ring_change_counter;
        unsigned int last_sync_sent_ring_change_counter;
+       /* Timestamp when the last SYNC was initiated by us */
+       struct timeval last_sync_start_time;
        /* the lowest minor version supported by the ring */
        unsigned int ring_min_version;
+       /* Timestamp when ring became synced or unsynced the last time */
        time_t ring_last_sync_time;
+       /* How many milliseconds it took for the last SYNC to travel through
+          the ring. */
+       unsigned int last_sync_msecs;
 
        time_t ring_first_alone;