MEDIUM: listener/config: make the "thread" parser rely on thread_sets
authorWilly Tarreau <w@1wt.eu>
Tue, 31 Jan 2023 18:31:27 +0000 (19:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Feb 2023 17:00:21 +0000 (18:00 +0100)
commitf0de8cacc4777b23223e412a53d0849b358a52e0
tree5427b84b52ec8bdc3a181fe3f61a47669732f11d
parentbef43dfa604c9580230fd3b72f8f719d7a8eba8d
MEDIUM: listener/config: make the "thread" parser rely on thread_sets

Instead of reading and storing a single group and a single mask for a
"thread" directive on a bind line, we now store the complete range in
a thread set that's stored in the bind_conf. The bind_parse_thread()
function now just calls parse_thread_set() to complete the current set,
which starts empty, and thread_resolve_group_mask() was updated to
support retrieving thread group numbers or absolute thread numbers
directly from the pre-filled thread_set, and continue to feed bind_tgroup
and bind_thread. The CLI parsers which were pre-initialized to set the
bind_tgroup to 1 cannot do it anymore as it would prevent one from
restricting the thread set. Instead check_config_validity() now detects
the CLI frontend and passes the info down to thread_resolve_group_mask()
that will automatically use only the group 1's threads for these
listeners. The same is done for the peers listeners for now.

At this step it's already possible to start with all previous valid
configs as well as extended ones supporting comma-delimited thread
sets. In addition the parser already accepts large ranges spanning
multiple groups, but since the underlying listeners infrastructure
is not read, for now we're maintaining a specific check against this
at the higher level of the config validity check.

The patch is a bit large because thread resolution is performed in
multiple steps, so we need to adjust all of them at once to preserve
functional and technical consistency.
doc/configuration.txt
include/haproxy/listener-t.h
include/haproxy/thread.h
src/cfgparse.c
src/cli.c
src/listener.c
src/thread.c