On Sun, Feb 25, 2024 at 5:00 PM Julien Rouhaud <rjuju...@gmail.com> wrote: > Yeah, trying to find a generalized solution seems like worth investing some > time to avoid having a bunch of CHECK_FOR_XXX() calls scattered in the code a > few years down the road.
I just don't really see how to do it. I suspect that every task that wants to run at some CFIs but not others is going to have slightly different requirements, and we probably can't foresee what all of those requirements are. Said another way, if in the future we want to call DoSomethingOrOther() from the CFI handler, well then we need to know that we're not already in the middle of using any subsystem that DoSomethingOrOther() might also try to use ... and we also need to know that we're not in the middle of doing anything that's more critical than DoSomethingOrOther(). But both of these are likely to vary in each case. EXPLAIN might be one member of a general class of things that require catalog access (and thus might take locks or lwlocks, access the catalogs, trigger invalidations, etc.) but it's not clear how general that class really is. Also, I think if we try to do too many different kinds of things at CFIs, the whole thing is going to fall apart. You'll end up failing to foresee some interactions, or the stack will get too deep, or ... something. -- Robert Haas EDB: http://www.enterprisedb.com