dovecot-2.2: director: Moving a user to another host sometimes c...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 15 13:52:29 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/51ee438392c7
changeset: 18708:51ee438392c7
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 15 16:44:45 2015 +0300
description:
director: Moving a user to another host sometimes caused the move to fail.
It could have given "User hash .. is being redirected to two hosts" error
and afterwards moved the user back to its original host.

diffstat:

 src/director/director-connection.c |  9 +++++++++
 src/director/user-directory.h      |  5 ++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r e0a17714f0c9 -r 51ee438392c7 src/director/director-connection.c
--- a/src/director/director-connection.c	Fri May 15 14:55:21 2015 +0300
+++ b/src/director/director-connection.c	Fri May 15 16:44:45 2015 +0300
@@ -506,6 +506,15 @@
 			  "replacing host %s with %s", username_hash,
 			  net_ip2addr(&user->host->ip), net_ip2addr(&host->ip));
 		ret = TRUE;
+	} else if (user->kill_state != USER_KILL_STATE_NONE &&
+		   user->kill_state < USER_KILL_STATE_DELAY) {
+		/* user is still being moved - ignore conflicting host updates
+		   from other directors who don't yet know about the move. */
+		dir_debug("user refresh: %u is being moved, "
+			  "preserve its host %s instead of replacing with %s",
+			  username_hash, net_ip2addr(&user->host->ip),
+			  net_ip2addr(&host->ip));
+		host = user->host;
 	} else {
 		/* non-weak user received a non-weak update with
 		   conflicting host. this shouldn't happen. */
diff -r e0a17714f0c9 -r 51ee438392c7 src/director/user-directory.h
--- a/src/director/user-directory.h	Fri May 15 14:55:21 2015 +0300
+++ b/src/director/user-directory.h	Fri May 15 16:44:45 2015 +0300
@@ -16,7 +16,10 @@
 	/* We're done killing, but waiting for USER-KILLED-EVERYWHERE
 	   notification until this state gets reset. */
 	USER_KILL_STATE_KILLED_WAITING_FOR_EVERYONE,
-	/* Wait for a while for the user connections to actually die */
+	/* Wait for a while for the user connections to actually die. Note that
+	   only at this stage we can be sure that all the directors know about
+	   the user move (although it could be earlier if we added a new
+	   USER-MOVED notification). */
 	USER_KILL_STATE_DELAY
 };
 


More information about the dovecot-cvs mailing list