changeset 22652:09523ad05bef

director: Log whenever HOST-RESET-USERS is used
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 05 Nov 2017 22:53:23 +0200
parents 61402b07ad0a
children 3ada7f87de9f
files src/director/doveadm-connection.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/doveadm-connection.c	Sun Nov 05 22:38:27 2017 +0200
+++ b/src/director/doveadm-connection.c	Sun Nov 05 22:53:23 2017 +0200
@@ -9,6 +9,7 @@
 #include "str.h"
 #include "strescape.h"
 #include "llist.h"
+#include "time-util.h"
 #include "master-service.h"
 #include "user-directory.h"
 #include "mail-host.h"
@@ -46,9 +47,12 @@
 
 	struct director *dir;
 	struct doveadm_connection *_conn;
+	struct timeval start_time;
+
 	struct director_user_iter *iter;
-	unsigned int host_idx, hosts_count;
+	unsigned int host_start_idx, host_idx, hosts_count;
 	unsigned int max_moving_users;
+	unsigned int reset_count;
 	bool users_killed;
 };
 
@@ -530,11 +534,16 @@
 						   TRUE);
 				cmd->users_killed = TRUE;
 			}
+			cmd->reset_count++;
 		} T_END;
 		if (dir->users_moving_count >= cmd->max_moving_users)
 			break;
 	}
 	if (user == NULL) {
+		int msecs = timeval_diff_msecs(&ioloop_timeval, &cmd->start_time);
+		i_info("Moved %u users in %u hosts in %u.%03u secs (max parallel=%u)",
+		       cmd->reset_count, cmd->hosts_count - cmd->host_start_idx,
+		       msecs / 1000, msecs % 1000, cmd->max_moving_users);
 		director_iterate_users_deinit(&cmd->iter);
 		if (cmd->users_killed) {
 			/* no more backends. we already sent kills. now remove
@@ -611,8 +620,10 @@
 	cmd->dir = conn->dir;
 	cmd->_conn = conn;
 	cmd->max_moving_users = max_moving_users;
+	cmd->host_start_idx = i;
 	cmd->host_idx = i;
 	cmd->hosts_count = count;
+	cmd->start_time = ioloop_timeval;
 	DLLIST_PREPEND(&reset_cmds, cmd);
 
 	if (!director_reset_cmd_run(cmd)) {