]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: resolvers: replace the answer_list with a (flat) tree
authorWilly Tarreau <w@1wt.eu>
Thu, 21 Oct 2021 05:39:57 +0000 (07:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 21 Oct 2021 06:02:08 +0000 (08:02 +0200)
commit7893ae117f2d367e0b2aee286a5eee980497c2d8
tree76eaddfb612190c21840194d6aae6f4c74d8cb3f
parenta89c19127d2c355a549f4e124a71c6285c51cd3e
MEDIUM: resolvers: replace the answer_list with a (flat) tree

With SRV records, a huge amount of time is spent looking for records
by walking long lists. It is possible to reduce this by indexing values
in trees instead. However the whole code relies a lot on the list
ordering, and even implements some round-robin on it to distribute IP
addresses to servers.

This patch starts carefully by replacing the list with a an eb32 tree
that is still used like a list, with a constant key 0. Since ebtrees
preserve insertion order for duplicates, the tree walk visits the nodes
in the exact same order it did with the lists. This allows to implement
the required infrastructure without changing the behavior.
include/haproxy/resolvers-t.h
src/resolvers.c