Mercurial > dovecot > core-2.2
changeset 22629:0281041d5067
director: Track show long the last ring sync took.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 26 Oct 2017 14:18:50 +0300 |
parents | 8623737c0129 |
children | 0170e1657f4d |
files | src/director/director-connection.c src/director/director.c src/director/director.h |
diffstat | 3 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/director/director-connection.c Thu Oct 26 14:07:56 2017 +0300 +++ b/src/director/director-connection.c Thu Oct 26 14:18:50 2017 +0300 @@ -1468,6 +1468,10 @@ 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 {
--- a/src/director/director.c Thu Oct 26 14:07:56 2017 +0300 +++ b/src/director/director.c Thu Oct 26 14:18:50 2017 +0300 @@ -370,8 +370,10 @@ { 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",
--- a/src/director/director.h Thu Oct 26 14:07:56 2017 +0300 +++ b/src/director/director.h Thu Oct 26 14:18:50 2017 +0300 @@ -137,9 +137,15 @@ 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;