]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Execute director_flush_socket only from one director.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Oct 2016 21:48:08 +0000 (00:48 +0300)
committerGitLab <gitlab@git.dovecot.net>
Tue, 25 Oct 2016 17:33:27 +0000 (20:33 +0300)
Having each director do it would be redundant since they're all supposed to
be performing the same flush task to the same backend.

src/director/director.c
src/director/user-directory.h

index 4ecca4cc14a9a6992980b82ffbca2d03c1b93fad..42c8347c7c8cbc83f154c04d637227b93fee009f 100644 (file)
@@ -761,8 +761,12 @@ director_flush_user(struct director *dir, struct user *user)
                { '\0', NULL, NULL }
        };
 
-       /* execute flush script, if set */
-       if (*dir->set->director_flush_socket == '\0') {
+       /* Execute flush script, if set. Only the director that started the
+          user moving will call the flush script. Having each director do it
+          would be redundant since they're all supposed to be performing the
+          same flush task to the same backend. */
+       if (*dir->set->director_flush_socket == '\0' ||
+           !user->kill_is_self_initiated) {
                director_user_kill_finish_delayed(dir, user, FALSE);
                return;
        }
@@ -819,6 +823,7 @@ static void director_user_move_free(struct director *dir, struct user *user)
        dir_debug("User %u move finished at state=%s", user->username_hash,
                  user_kill_state_names[user->kill_state]);
 
+       user->kill_is_self_initiated = FALSE;
        user->kill_state = USER_KILL_STATE_NONE;
        timeout_remove(&user->to_move);
 
@@ -1002,6 +1007,7 @@ void director_move_user(struct director *dir, struct director_host *src,
                dir->users_moving_count++;
                user->to_move = timeout_add(DIRECTOR_USER_MOVE_TIMEOUT_MSECS,
                                            director_user_move_timeout, user);
+               user->kill_is_self_initiated = src->self;
                user->kill_state = USER_KILL_STATE_KILLING;
                cmd = t_strdup_printf("proxy\t*\tKICK-DIRECTOR-HASH\t%u",
                                      username_hash);
index bde75d1e860893edb45c10b4cf58c4eebf6ab6f4..2ab1c9f68e0ea4b407678ed4ac2a615555249f84 100644 (file)
@@ -50,6 +50,8 @@ struct user {
           now doing a ring-wide sync for this user to make sure we don't
           assign conflicting hosts to it */
        bool weak:1;
+       /* TRUE, if this server initiated the user's kill. */
+       bool kill_is_self_initiated:1;
 };
 
 /* Create a new directory. Users are dropped if their time gets older