]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: proxy: remove the unused PR_STFULL state
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Sep 2020 05:35:46 +0000 (07:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2020 09:27:30 +0000 (11:27 +0200)
Since v1.4 or so, it's almost not possible anymore to set this state. The
only exception is by using the CLI to change a frontend's maxconn setting
below its current usage. This case makes no sense, and for other cases it
doesn't make sense either because "full" is a vague concept when only
certain listeners are full and not all. Let's just remove this unused
state and make it clear that it's not reported. The "ready" or "open"
states will continue to be reported without being misleading as they
will be opposed to "stop".

contrib/prometheus-exporter/service-prometheus.c
include/haproxy/proxy-t.h
src/proxy.c
src/stats.c

index 98f6b174c5e584584bb021df649f2d153017ea43..ba1619f47aa34c1258c73241d7107d61a4b2c9b5 100644 (file)
@@ -724,7 +724,7 @@ const struct ist promex_st_metric_desc[ST_F_TOTAL_FIELDS] = {
        [ST_F_ERESP]          = IST("Total number of response errors."),
        [ST_F_WRETR]          = IST("Total number of retry warnings."),
        [ST_F_WREDIS]         = IST("Total number of redispatch warnings."),
-       [ST_F_STATUS]         = IST("Current status of the service (frontend: 0=STOP, 1=UP, 2=FULL - backend: 0=DOWN, 1=UP - server: 0=DOWN, 1=UP, 2=MAINT, 3=DRAIN, 4=NOLB)."),
+       [ST_F_STATUS]         = IST("Current status of the service (frontend: 0=STOP, 1=UP - backend: 0=DOWN, 1=UP - server: 0=DOWN, 1=UP, 2=MAINT, 3=DRAIN, 4=NOLB)."),
        [ST_F_WEIGHT]         = IST("Service weight."),
        [ST_F_ACT]            = IST("Current number of active servers."),
        [ST_F_BCK]            = IST("Current number of backup servers."),
@@ -1551,7 +1551,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
 
                        switch (appctx->st2) {
                                case ST_F_STATUS:
-                                       metric = mkf_u32(FO_STATUS, px->state == PR_STREADY ? 1 : px->state == PR_STFULL ? 2 : 0);
+                                       metric = mkf_u32(FO_STATUS, px->state == PR_STREADY ? 1 : 0);
                                        break;
                                case ST_F_SCUR:
                                        metric = mkf_u32(0, px->feconn);
index 16fee4a2ea2957dee891c95f6e8dc900566399d6..f0c61b3b7aa2dd338197e52c6efde53ca76ffa10 100644 (file)
@@ -46,7 +46,6 @@
 enum pr_state {
        PR_STNEW = 0,           /* proxy has not been initialized yet */
        PR_STREADY,             /* proxy has been initialized and is ready */
-       PR_STFULL,              /* frontend is full (maxconn reached) */
        PR_STPAUSED,            /* frontend is paused (during hot restart) */
        PR_STSTOPPED,           /* proxy is stopped (end of a restart) */
        PR_STERROR,             /* proxy experienced an unrecoverable error */
index a901f53ada640a96399b5d31eb4c5aa450783474..d3c207e7178d716e053edcd593374c8a2f969e7a 100644 (file)
@@ -1118,15 +1118,8 @@ struct task *manage_proxy(struct task *t, void *context, unsigned short state)
                goto out;
 
        /* check the various reasons we may find to block the frontend */
-       if (unlikely(p->feconn >= p->maxconn)) {
-               if (p->state == PR_STREADY)
-                       p->state = PR_STFULL;
+       if (unlikely(p->feconn >= p->maxconn))
                goto out;
-       }
-
-       /* OK we have no reason to block, so let's unblock if we were blocking */
-       if (p->state == PR_STFULL)
-               p->state = PR_STREADY;
 
        if (p->fe_sps_lim &&
            (wait = next_event_delay(&p->fe_sess_per_sec, p->fe_sps_lim, 0))) {
index 8752788ba116f181fe03442f7c4e51d4f40af37c..132011d278d88f95f09288fa7195927ab0e98d94 100644 (file)
@@ -1629,7 +1629,7 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len)
        stats[ST_F_EREQ]     = mkf_u64(FN_COUNTER, px->fe_counters.failed_req);
        stats[ST_F_DCON]     = mkf_u64(FN_COUNTER, px->fe_counters.denied_conn);
        stats[ST_F_DSES]     = mkf_u64(FN_COUNTER, px->fe_counters.denied_sess);
-       stats[ST_F_STATUS]   = mkf_str(FO_STATUS, px->state == PR_STREADY ? "OPEN" : px->state == PR_STFULL ? "FULL" : "STOP");
+       stats[ST_F_STATUS]   = mkf_str(FO_STATUS, px->state == PR_STREADY ? "OPEN" : "STOP");
        stats[ST_F_PID]      = mkf_u32(FO_KEY, relative_pid);
        stats[ST_F_IID]      = mkf_u32(FO_KEY|FS_SERVICE, px->uuid);
        stats[ST_F_SID]      = mkf_u32(FO_KEY|FS_SERVICE, 0);