Skip to content

Commit

Permalink
director: Track show long the last ring sync took.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Nov 1, 2017
1 parent f1551f4 commit 3dc72a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/director/director-connection.c
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/director/director.c
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions src/director/director.h
Expand Up @@ -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;

Expand Down

0 comments on commit 3dc72a4

Please sign in to comment.