]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Make sure host's last_updown_change never shrinks.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 20 May 2018 15:20:47 +0000 (18:20 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 21 May 2018 09:08:52 +0000 (09:08 +0000)
Otherwise the ring might get into a loop where two HOST updates keep
fighting each others. This could probably happen if one update comes at
"desynced" state and other one in non-desynced state.

I'm not entirely sure if this is fixing such a loop or not, but it at least
shouldn't hurt.

src/director/director-connection.c

index 1e2b63599738e4aed48bde823c678e97abcac3b4..4f953e6e975d0c140f1a256724e63984a55163fc 100644 (file)
@@ -1169,8 +1169,6 @@ director_cmd_host_int(struct director_connection *conn, const char *const *args,
                        str_append(str, ") - ");
 
                        vhost_count = I_MIN(vhost_count, host->vhost_count);
-                       last_updown_change = I_MAX(last_updown_change,
-                                                  host->last_updown_change);
                        str_printfa(str, "setting to state=%s vhosts=%u",
                                    down ? "down" : "up", vhost_count);
                        i_warning("%s", str_c(str));
@@ -1179,6 +1177,13 @@ director_cmd_host_int(struct director_connection *conn, const char *const *args,
                        dir_host = NULL;
                        src_host = conn->dir->self_host;
                }
+               if (update) {
+                       /* Make sure the host's timestamp never shrinks.
+                          Otherwise we might get into a loop where the up/down
+                          state keeps switching. */
+                       last_updown_change = I_MAX(last_updown_change,
+                                                  host->last_updown_change);
+               }
        }
 
        if (update) {