Welcome! Log In Create A New Profile

Advanced

[PATCH][REORG/MINOR]: config: Run postparser once per section instance

Posted by Ben Draut 
This changes the parser to run section postparsers once per section
instance, rather than only when the section type changes.

This is motivated by the work discussed in
https://www.mail-archive.com/[email protected]/msg29527.html. It should
make it easy to produce the warning mentioned in the summary at most once
per section.

Thanks,

Ben
Attachments:
open | download - 0001-REORG-MINOR-config-Run-postparser-once-per-section-i.patch (3.9 KB)
Hi Ben,

On Thu, Apr 12, 2018 at 02:25:58PM -0600, Ben Draut wrote:
> This changes the parser to run section postparsers once per section
> instance, rather than only when the section type changes.
>
> This is motivated by the work discussed in
> https://www.mail-archive.com/[email protected]/msg29527.html. It should
> make it easy to produce the warning mentioned in the summary at most once
> per section.

Hmmm I don't much like this principle, because it's not a post-section
parser anymore in this case, it's a post config parser. Note that it is
very possible that you need a different type of post-processing to help
with the resolvers stuff, but I really think this approach is mistaken
because it removes the ability to perform post-section processing. From
what I'm seeing by quickly grepping in the code, at least the cache
relies on this.

I *think* we do have a way to register a post-config call, but to be
honest I really don't remember, as we've added a few such hooks over
time. Maybe you'd need to call this thing before entering
check_config_validity() which resolves every cross-dependency between
the config elements and which detect inconsistencies. We may imagine
having a pre_final_check and a post_final_check callback for this maybe.

Just a few ideas.

Thanks!
Willy
On Thu, Apr 12, 2018 at 3:06 PM, Willy Tarreau <[email protected]> wrote:

> Hi Ben,
>
> On Thu, Apr 12, 2018 at 02:25:58PM -0600, Ben Draut wrote:
> > This changes the parser to run section postparsers once per section
> > instance, rather than only when the section type changes.
> >
> > This is motivated by the work discussed in
> > https://www.mail-archive.com/[email protected]/msg29527.html. It
> should
> > make it easy to produce the warning mentioned in the summary at most once
> > per section.
>
> Hmmm I don't much like this principle, because it's not a post-section
> parser anymore in this case, it's a post config parser. Note that it is
> very possible that you need a different type of post-processing to help
> with the resolvers stuff, but I really think this approach is mistaken
> because it removes the ability to perform post-section processing. From
> what I'm seeing by quickly grepping in the code, at least the cache
> relies on this.
>

Ah, I missed the cache usage, thanks for pointing that out.


> I *think* we do have a way to register a post-config call, but to be
> honest I really don't remember, as we've added a few such hooks over
> time. Maybe you'd need to call this thing before entering
> check_config_validity() which resolves every cross-dependency between
> the config elements and which detect inconsistencies. We may imagine
> having a pre_final_check and a post_final_check callback for this maybe.


Great, I'll dig some more and give it some more thought. Thanks!
Sorry, only registered users may post in this forum.

Click here to login