Обсуждение: Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

Поиск
Список
Период
Сортировка

Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

От
Tom Lane
Дата:
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



Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

От
Andres Freund
Дата:
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



Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs

От
Tom Lane
Дата:
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