On Sat, Aug 08, 2015 at 02:30:47AM +0200, Andres Freund wrote:
> On 2015-08-07 20:16:20 -0400, Noah Misch wrote:
> > I agree that lock.h offers little to frontend code. Headers that the
> > lockdefs.h patch made usable in the frontend, particularly genam.h and hash.h,
> > are no better.
>
> It's not that simple. Those two, and tuptoaster.h, are actually somewhat
> validly included by frontend code via the rmgr descriptor routines.
genam.h is a dependency of the non-frontend-relevant content of some
frontend-relevant headers, _exactly_ as lock.h has been. I count zero things
in genam.h that a frontend program could harness. The frontend includes
hash.h for two hashdesc.c prototypes, less than the material you moved out of
lock.h for frontend benefit. Yes, it is that simple.
> > The lock.h/lockdefs.h unprincipled split would do more harm
> > than letting frontends continue to pull in lock.h.
>
> Why?
Your header comment for lockdefs.h sums up the harm nicely. Additionally, the
term "defs" does nothing to explain the split. "lock2.h" would be no less
evocative.
> Consider what happens when lock.h/c gets more complicated and
> e.g. grows some atomics. None of the frontend code should see that, and
> it's not much effort to keep it that way. Allowing client code to see
> LOCKMODE isn't something that's going to cause any harm.
Readying the headers for that day brings some value, but you added a worse
mess to achieve it. The overall achievement has negative value.
nm