Re: Drop type "smgr"?

From: Shawn Debnath <sdn(at)amazon(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Drop type "smgr"?
Date: 2019-02-28 23:03:49
Message-ID: 20190228230349.GC62457@f01898859afd.ant.amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 01, 2019 at 11:38:49AM +1300, Thomas Munro wrote:

> > Food for thought: if we are going to muck with the smgr APIs, would it
> > make sense to move away from SMgrRelation to something a bit more
> > generic like, say, SMgrHandle to better organize the internal contents
> > of this structure? Internally, we could move things into an union and
> > based on type of handle: relation, undo, slru/generic, translate the
> > contents correctly. As you can guess, SMgrRelationData today is very
> > specific to relations and holding md specific information whose memory
> > would be better served re-used for the other storage managers.
> >
> > Thoughts?
>
> Right, it does contain some md-specific stuff without even
> apologising. Also smgropen() was rendered non-virtual at some point
> (I mean that implementations don't even get a chance to initialise
> anything, which works out only because md-specific code has leaked
> into smgr.c). In one of my undo patches (which I'll post an updated
> version of on the appropriate thread soon) I added a void * called
> private_data so that undo_file.c can keep track of some stuff, but
> yeah I agree that more tidying up could be done.

I can send out a patch for this (on a separate thread!) to unblock us
both. Unless you are closer to completion on this.

I prefer the union approach to make it more readable. I was considering
re-factoring the structure to SMgrHandle and having the relation
specific structure retain SMgrRelationData. For undo we could have
SMgrUndoData, and similarly for SLRU (I will come up with a better name
than generic). Then have these be in the union instead of the
individual members of the struct.

--
Shawn Debnath
Amazon Web Services (AWS)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-02-28 23:09:41 Re: Why don't we have a small reserved OID range for patch revisions?
Previous Message Thomas Munro 2019-02-28 23:03:06 Re: Index Skip Scan