From: Willy Tarreau Date: Tue, 30 Jun 2026 08:49:54 +0000 (+0200) Subject: MAJOR: mworker: remove deprecated "master-worker" global keyword X-Git-Tag: v3.5-dev2~14 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/$%7BGITURL%7D$%7Bcid%7D?a=commitdiff_plain;h=5a6ce048109b2a762614acbe4494397f11f208c6;p=haproxy.git MAJOR: mworker: remove deprecated "master-worker" global keyword This keyword, when alone, was already deprecated in 3.3 and marked for removal in 3.5. Now using it results in an error message inviting to start haproxy with -W or -Ws instead. In addition, "master-worker exit-on-failure", which used to automatically enable the master-worker mode, now doesn't set it and complains if used without. -W/-Ws. A special case was made for config checks though (-c). Also worth noting that "daemon" applies to master as well as max-reloads, and will soon need to be adjusted. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 45d405145..84fffe760 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -970,9 +970,9 @@ HAProxy is launched in master-worker mode. and it may as well condition some worker process parameters (see examples from section 2.4 "Conditional blocks"). -In standalone mode (without "-W" option nor the "master-worker" keyword) the -process behaves like a worker, except for variables "HAPROXY_MASTER_CLI" and -"HAPROXY_MWORKER" which are not defined. +In standalone mode (without "-W" option) the process behaves like a worker, +except for variables "HAPROXY_MASTER_CLI" and "HAPROXY_MWORKER" which are not +defined. Some variables are marked as not usable and not modifiable: @@ -1255,8 +1255,6 @@ Example: # 2.3. Environment variables). Its presence enables an additional listener. global - master-worker - .if defined(HAPROXY_MWORKER) listen mwcli_px bind :1111 @@ -1269,8 +1267,6 @@ Example: # mworker-max-reloads parameter. global - master-worker - .if streq("$HAPROXY_BRANCH",3.1) mworker-max-reloads 5 .endif @@ -3036,32 +3032,6 @@ lua-prepend-path [] See https://www.lua.org/pil/8.1.html for the details within the Lua documentation. -master-worker (deprecated) - Master-worker mode. It is equivalent to the command line "-W" argument. - - This keyword is deprecated, please start in master-worker mode using "-W" or - "-Ws". - - This mode will launch a "master" which will fork a "worker" after reading the - configuration to process the traffic. The master is used as a process manager - which will monitor the "workers". - - Using this mode, you can reload HAProxy directly by sending a SIGUSR2 signal - to the master. Reloading will ask the master to read the configuration again - and fork a new worker. The previous worker will be kept until the end of its - jobs. - - The master-worker mode is compatible either with the foreground or daemon - mode. - - By default, if a worker exits with a bad return code, in the case of a - segfault for example, all workers will be killed, and the master will leave. - It is convenient to combine this behavior with Restart=on-failure in a - systemd unit file in order to relaunch the whole process. If you don't want - this behavior, you must use the keyword "no-exit-on-failure". - - See also "-W" in the management guide. - master-worker no-exit-on-failure In master-worker mode, by default, if a worker exits with a bad return code, in the case of a segfault for example, all workers will be killed, and the @@ -3157,7 +3127,7 @@ pidfile Writes PIDs of all daemons into file when daemon mode or writes PID of master process into file when master-worker mode. This option is equivalent to the "-p" command line argument. The file must be accessible to - the user starting the process. See also "daemon" and "master-worker". + the user starting the process. See also "daemon". pp2-never-send-local A bug in the PROXY protocol v2 implementation was present in HAProxy up to diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index e10117c00..d9f25afd0 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -970,10 +970,13 @@ static int cfg_parse_global_master_worker(char **args, int section_type, return -1; if (!*args[1]) { - if (global.mode & MODE_MWORKER) { - ha_warning("master-worker mode is already configured.\n"); - } - ha_warning("The '%s' keyword is deprecated in 3.3 and will be removed in 3.5. Use -W or -Ws in the startup script instead.\n", args[0]); + memprintf(err, "support for '%s' was removed in version 3.5. Use -W or -Ws in the startup script instead.\n", args[0]); + return -1; + } + + if (!(global.mode & (MODE_MWORKER | MODE_CHECK))) { + memprintf(err, "'%s %s' is only supported in master-worker mode. Use -W or -Ws in the startup script.\n", args[0], args[1]); + return -1; } if (*args[1]) { @@ -985,7 +988,6 @@ static int cfg_parse_global_master_worker(char **args, int section_type, return -1; } } - global.mode |= MODE_MWORKER; return 0; }