Thread

Commits

  1. Remove PrintBufferDescs() and PrintPinnedBufs().

  1. Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Jacob Brazeal <jacob.brazeal@gmail.com> — 2025-01-17T22:11:56Z

    Hi,
    
    In bufmgr.c we have the debugging functions PrintBufferDescs
    and PrintPinnedBufs, which are typically hidden behind the flag
    #ifdef NOT_USED. These functions reference the old buf->refcount and
    buf->flags fields, and so they no longer compile. I attached a patch to
    use BUF_STATE_GET_REFCOUNT instead and removed the reference to buf->flags.
    
    Regards,
    Jacob Brazeal
    
  2. Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Jacob Brazeal <jacob.brazeal@gmail.com> — 2025-01-18T02:02:03Z

    Since this patch takes out a lock to read the BufferDesc state, I also need
    to release the lock, which I've added to this patch.
    
    On Fri, Jan 17, 2025 at 2:11 PM Jacob Brazeal <jacob.brazeal@gmail.com>
    wrote:
    
    > Hi,
    >
    > In bufmgr.c we have the debugging functions PrintBufferDescs
    > and PrintPinnedBufs, which are typically hidden behind the flag
    > #ifdef NOT_USED. These functions reference the old buf->refcount and
    > buf->flags fields, and so they no longer compile. I attached a patch to
    > use BUF_STATE_GET_REFCOUNT instead and removed the reference to buf->flags.
    >
    > Regards,
    > Jacob Brazeal
    >
    >
    
  3. Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-01-18T05:53:20Z

    Jacob Brazeal <jacob.brazeal@gmail.com> writes:
    > In bufmgr.c we have the debugging functions PrintBufferDescs
    > and PrintPinnedBufs, which are typically hidden behind the flag
    > #ifdef NOT_USED. These functions reference the old buf->refcount and
    > buf->flags fields, and so they no longer compile. I attached a patch to
    > use BUF_STATE_GET_REFCOUNT instead and removed the reference to buf->flags.
    
    Hmm.  So those functions have not compiled since 48354581a of
    2016-04-10, and nobody's noticed.  Moreover, whatever use-case
    they do have would be reduced a good deal by taking a buffer
    lock (which might not be available, or our own process might
    hold it already).
    
    I'd vote for just removing them...
    
    			regards, tom lane
    
    
    
    
  4. Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Jacob Brazeal <jacob.brazeal@gmail.com> — 2025-01-18T07:14:02Z

    On Fri, Jan 17, 2025 at 9:53 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
    
    > Jacob Brazeal <jacob.brazeal@gmail.com> writes:
    > > In bufmgr.c we have the debugging functions PrintBufferDescs
    > > and PrintPinnedBufs, which are typically hidden behind the flag
    > > #ifdef NOT_USED. These functions reference the old buf->refcount and
    > > buf->flags fields, and so they no longer compile. I attached a patch to
    > > use BUF_STATE_GET_REFCOUNT instead and removed the reference to
    > buf->flags.
    >
    > Hmm.  So those functions have not compiled since 48354581a of
    > 2016-04-10, and nobody's noticed.  Moreover, whatever use-case
    > they do have would be reduced a good deal by taking a buffer
    > lock (which might not be available, or our own process might
    > hold it already).
    >
    > I'd vote for just removing them...
    >
    >                         regards, tom lane
    >
    
    
    Sounds good! v3 attached.
    
  5. Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Michael Paquier <michael@paquier.xyz> — 2025-01-19T00:37:54Z

    On Fri, Jan 17, 2025 at 11:14:02PM -0800, Jacob Brazeal wrote:
    > Sounds good! v3 attached.
    
    Removal sounds good to me.  Any objections from anybody?
    
    Andres, perhaps you have some experience using that and would prefer
    keep them and make them work?
    --
    Michael
    
  6. Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Andres Freund <andres@anarazel.de> — 2025-01-19T18:10:43Z

    Hi,
    
    On 2025-01-19 09:37:54 +0900, Michael Paquier wrote:
    > On Fri, Jan 17, 2025 at 11:14:02PM -0800, Jacob Brazeal wrote:
    > > Sounds good! v3 attached.
    > 
    > Removal sounds good to me.  Any objections from anybody?
    > 
    > Andres, perhaps you have some experience using that and would prefer
    > keep them and make them work?
    
    I think they're pretty useless, tbh. There's too many buffers that just
    printing them out is helpful - pg_buffercache is going to be a better
    bet. When debugging issues where pg_buffercache isn't an option (e.g. because
    it's a hang that doesn't allow running pg_buffercache), using
    DebugPrintBufferRefcount() is much more targeted.
    
    Greetings,
    
    Andres Freund
    
    
    
    
  7. Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-01-19T18:47:34Z

    Andres Freund <andres@anarazel.de> writes:
    > On 2025-01-19 09:37:54 +0900, Michael Paquier wrote:
    >> Removal sounds good to me.  Any objections from anybody?
    >> Andres, perhaps you have some experience using that and would prefer
    >> keep them and make them work?
    
    > I think they're pretty useless, tbh. There's too many buffers that just
    > printing them out is helpful - pg_buffercache is going to be a better
    > bet. When debugging issues where pg_buffercache isn't an option (e.g. because
    > it's a hang that doesn't allow running pg_buffercache), using
    > DebugPrintBufferRefcount() is much more targeted.
    
    Sounds like we're in agreement.  I'll push Jacob's second patch.
    
    			regards, tom lane