-
Notifications
You must be signed in to change notification settings - Fork 393
cache_ban: Forward compatibility for the binary ban representation #4289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bugwash: phk wants to think about it |
Our ban expressions (like "obj.age > 20s") are represented in a binary format (see top of cache_ban.h) which allows for forward compatibility, yet at the respective places we currently just trigger an assertion failure if we hit an unknown argument or operator code. This commit brings forward compatibility such that, when bans are loaded from persistent storage into older code which does not yet support newly introduced binary codes, we no longer panic. Ban evaluation: For bans, evaluating an expression to "true" is always "correct" in that the cache would not deliver banned content. It might cause objects to be removed from cache, but that is at least not incorrect. So the fail safe action this code takes is to always evaluate unknown ban expressions to true. CLI ban.list: For unsupported ban expressions, the unknown argument or operator codes are formatted as "(0x%02x)" with the string "UNSUPPORTED" as the user-specified argument. For example: 1740567193.765849 0 - (0x20) > UNSUPPORTED && obj.http.foo ~ 377.266 (note that here the operator > is supported and printed as such, and the ban contains one unsupported and one supported expression) Logging: For each unsupported argument or operator code, an Error VSL is output exactly once to vxid 0. Statistics: Whenever unsupported argument or operator codes are encountered, the newly added counters MAIN.bans_inval_arg1 and MAIN.bans_inval_oper are incremented, respectively. Fixes varnishcache#4288
a92a597
to
af32ae1
Compare
bugwash:
We should go back to https://github.com/varnishcache/varnish-cache/wiki/VDD23Q1#bans-and-persistent-storages and write down a plan how bans should look like in future, especially considering loading within a cluster and moving storage. IRC log for reference: (15:10:10) slink: So FYI https://gitlab.com/uplex/varnish/slash/-/issues/111 I think is caused by bans in varnish not really using serialized pcres. |
Our ban expressions (like
obj.age > 20s
) are represented in a binary format (see top ofcache_ban.h
) which allows for forward compatibility, yet at the respective places we currently just trigger an assertion failure if we hit an unknown argument or operator code.This commit brings forward compatibility such that, when bans are loaded from persistent storage into older code which does not yet support newly introduced binary codes, we no longer panic.
Ban evaluation:
For bans, evaluating an expression to
true
is always "correct" in that the cache would not deliver banned content. It might cause objects to be removed from cache, but that is at least not incorrect. So the fail safe action this code takes is to always evaluate unknown ban expressions to true.CLI
ban.list
:For unsupported ban expressions, the unknown argument or operator codes are formatted as
(0x%02x)
with the stringUNSUPPORTED
as the user-specified argument. For example:(note that here the operator
>
is supported and printed as such, and the ban contains one unsupported and one supported expression)Logging:
For each unsupported argument or operator code, an
Error
VSL is output exactly once to vxid 0.Statistics:
Whenever unsupported argument or operator codes are encountered, the newly added counters
MAIN.bans_inval_arg1
andMAIN.bans_inval_oper
are incremented, respectively.Fixes #4288