]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: pattern: link all final elements from the reference
authorWilly Tarreau <w@1wt.eu>
Mon, 2 Nov 2020 11:10:48 +0000 (12:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Nov 2020 18:27:09 +0000 (19:27 +0100)
commit4bdd0a13d600c51982f9c204dcce3a09b326f109
treeda7acc567c66db46c8b494e9b16e92e018fec709
parent6d8a68914ea460b06cda2a1b657d7a436588c9ad
MEDIUM: pattern: link all final elements from the reference

There is a data model issue in the current pattern design that makes
pattern deletion extremely expensive: there's no direct way from a
reference to access all indexed occurrences. As such, the only way
to remove all indexed entries corresponding to a reference update
is to scan all expressions's lists and trees to find a link to the
reference. While this was possibly OK when map removal was not
common and most maps were small, this is not conceivable anymore
with GeoIP maps containing 10M+ entries and del-map operations that
are triggered from http-request rulesets.

This patch introduces two list heads from the pattern reference, one
for the objects linked by lists and one for those linked by tree node.
Ideally a single list would be enough but the linked elements are too
much unrelated to be distinguished at the moment, so we'll need two
lists. However for the long term a single-linked list will suffice but
for now it's not possible due to the way elements are removed from
expressions. As such this patch adds 32 bytes of memory usage per
reference plus 16 per indexed entry, but both will be cut in half
later.

The links are not yet used for deletion, this patch only ensures the
list is always consistent.
include/haproxy/pattern-t.h
src/pattern.c