]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] pxid/puid/luid: don't shift IDs when some of them are forced
authorKrzysztof Piotr Oledzki <ole@ans.pl>
Fri, 5 Feb 2010 19:58:27 +0000 (20:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 6 Feb 2010 08:50:24 +0000 (09:50 +0100)
[WT: it was not a bug, I did it on purpose to leave no hole between IDs,
 though it's not very practical when admins want to force some entries
 after they have been used, because they'd rather leave a hole than
 renumber everything ]

Forcing some of IDs should not shift others.

Regression introduced in 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5

---cut here---
global
        stats socket /home/ole/haproxy.stat user ole group ole mode 660

frontend F1
        bind 127.0.0.1:9999
        mode http

backend B1
        mode http

backend B2
        mode http
        id 9999

backend B3
        mode http

backend B4
        mode http
---cut here---

Before 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5:
$ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28
iid
1
2
9999
4
5

After 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5:
$ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28
iid
1
2
9999
3
4

With this patch:
$ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28
iid
1
2
9999
4
5

src/cfgparse.c

index 2980ae10de92c9a662d9e2e691196d28c9dc5667..9bdfb3e3d579a03cf09a90e1220b3aeb74fe1d97 100644 (file)
@@ -4493,8 +4493,9 @@ int check_config_validity()
                        next_pxid = get_next_id(&used_proxy_id, next_pxid);
                        curproxy->conf.id.key = curproxy->uuid = next_pxid;
                        eb32_insert(&used_proxy_id, &curproxy->conf.id);
-                       next_pxid++;
                }
+               next_pxid++;
+
 
                if (curproxy->state == PR_STSTOPPED) {
                        /* ensure we don't keep listeners uselessly bound */
@@ -4914,8 +4915,8 @@ out_uri_auth_compat:
                                next_id = get_next_id(&curproxy->conf.used_server_id, next_id);
                                newsrv->conf.id.key = newsrv->puid = next_id;
                                eb32_insert(&curproxy->conf.used_server_id, &newsrv->conf.id);
-                               next_id++;
                        }
+                       next_id++;
 
                        if ((curproxy->mode != PR_MODE_HTTP) && (newsrv->rdr_len || newsrv->cklen)) {
                                Alert("config : %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n",
@@ -5067,8 +5068,8 @@ out_uri_auth_compat:
                                next_id = get_next_id(&curproxy->conf.used_listener_id, next_id);
                                listener->conf.id.key = listener->luid = next_id;
                                eb32_insert(&curproxy->conf.used_listener_id, &listener->conf.id);
-                               next_id++;
                        }
+                       next_id++;
 
                        /* enable separate counters */
                        if (curproxy->options2 & PR_O2_SOCKSTAT) {