# HG changeset patch # User Timo Sirainen # Date 1505399388 -10800 # Node ID 3af1ba6b52488af7b7637c5d3a2dd1caad6bc1e7 # Parent 06361c8455a7c722b1c7fce9d84a0ba9a28e7796 director: Log info line whenever a director is added/removed from ring This can help with debugging problems. diff -r 06361c8455a7 -r 3af1ba6b5248 src/director/director-connection.c --- a/src/director/director-connection.c Thu Sep 14 18:13:33 2017 +0300 +++ b/src/director/director-connection.c Thu Sep 14 17:29:48 2017 +0300 @@ -744,6 +744,7 @@ struct director_host *host; struct ip_addr ip; in_port_t port; + bool log_add = FALSE; if (!director_args_parse_ip_port(conn, args, &ip, &port)) return FALSE; @@ -767,6 +768,7 @@ } else { /* save the director and forward it */ host = director_host_add(conn->dir, &ip, port); + log_add = TRUE; } /* just forward this to the entire ring until it reaches back to itself. some hosts may see this twice, but that's the only way to @@ -782,7 +784,7 @@ "Not forwarding it since it's probably crashed."); } else { director_notify_ring_added(host, - director_connection_get_host(conn)); + director_connection_get_host(conn), log_add); } return TRUE; } diff -r 06361c8455a7 -r 3af1ba6b5248 src/director/director.c --- a/src/director/director.c Thu Sep 14 18:13:33 2017 +0300 +++ b/src/director/director.c Thu Sep 14 17:29:48 2017 +0300 @@ -479,10 +479,15 @@ } void director_notify_ring_added(struct director_host *added_host, - struct director_host *src) + struct director_host *src, bool log) { const char *cmd; + if (log) { + i_info("Adding director %s to ring (requested by %s)", + added_host->name, src->name); + } + added_host->dir->ring_change_counter++; cmd = t_strdup_printf("DIRECTOR\t%s\t%u\n", net_ip2addr(&added_host->ip), added_host->port); @@ -516,6 +521,9 @@ unsigned int i, count; const char *cmd; + i_info("Removing director %s from ring (requested by %s)", + removed_host->name, src->name); + if (removed_host->self) { /* others will just disconnect us */ return; diff -r 06361c8455a7 -r 3af1ba6b5248 src/director/director.h --- a/src/director/director.h Thu Sep 14 18:13:33 2017 +0300 +++ b/src/director/director.h Thu Sep 14 17:29:48 2017 +0300 @@ -181,7 +181,7 @@ bool director_resend_sync(struct director *dir); void director_notify_ring_added(struct director_host *added_host, - struct director_host *src); + struct director_host *src, bool log); void director_ring_remove(struct director_host *removed_host, struct director_host *src); diff -r 06361c8455a7 -r 3af1ba6b5248 src/director/doveadm-connection.c --- a/src/director/doveadm-connection.c Thu Sep 14 18:13:33 2017 +0300 +++ b/src/director/doveadm-connection.c Thu Sep 14 17:29:48 2017 +0300 @@ -261,7 +261,7 @@ if (director_host_lookup(conn->dir, &ip, port) == NULL) { host = director_host_add(conn->dir, &ip, port); - director_notify_ring_added(host, conn->dir->self_host); + director_notify_ring_added(host, conn->dir->self_host, TRUE); } o_stream_nsend(conn->output, "OK\n", 3); return DOVEADM_DIRECTOR_CMD_RET_OK;