]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] checks: set server state to one state from failure when leaving maintenance
authorWilly Tarreau <w@1wt.eu>
Fri, 22 Oct 2010 12:39:02 +0000 (14:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Oct 2010 17:04:34 +0000 (19:04 +0200)
When we're enabling a server again (unix CLI or stats interface), we must not mark
it completely up because it can take a while before a failure is detected. So we
mark it one step above failure, which means it's up but will be marked down upon
first failure.
(cherry picked from commit 83c3e06452457ed5660fc814cbda5bf878bf19a2)

src/dumpstats.c
src/proto_http.c

index f0d6c83f5d57b9f88364e56ef86ab7a695a9d18e..f7f3276715215a1ebaa5cb7da23e2f22b430661d 100644 (file)
@@ -755,12 +755,14 @@ int stats_sock_parse_request(struct stream_interface *si, char *line)
                                        */
                                        if (sv->tracked->state & SRV_RUNNING) {
                                                set_server_up(sv);
+                                               sv->health = sv->rise;  /* up, but will fall down at first failure */
                                        } else {
                                                sv->state &= ~SRV_MAINTAIN;
                                                set_server_down(sv);
                                        }
                                } else {
                                        set_server_up(sv);
+                                       sv->health = sv->rise;  /* up, but will fall down at first failure */
                                }
                        }
 
index 0cbfef2661e0c83df2ca4cbba8e3fd569a51c443..3003e5d09f0a0a70e0c72f880ce8cac9d06ceab6 100644 (file)
@@ -2931,6 +2931,7 @@ int http_process_req_stat_post(struct session *s, struct buffer *req)
                                                if ((sv->state & SRV_MAINTAIN)) {
                                                        /* Already in maintenance, we can change the server state */
                                                        set_server_up(sv);
+                                                       sv->health = sv->rise;  /* up, but will fall down at first failure */
                                                        s->data_ctx.stats.st_code = STAT_STATUS_DONE;
                                                }
                                                break;