Re: Fix a relcache reference leak in reorderbuffer.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix a relcache reference leak in reorderbuffer.c
Date: 2026-08-18 22:35:18
Message-ID: aoTeJkE2HdxxPLJl@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 18, 2026 at 01:59:01PM +0800, Xuneng Zhou wrote:
> I think this is not a session-level *leak*. The resource owner of
> ongoing txn would take care of the reference once the
> ReorderBufferProcessTXN aborts its internal transaction. Yeah, it
> could be more troublesome if the skipped references keep accumulating
> until the decoding of txn finishes. That said, it's not very clear to
> me whether this code is actually excerised. Can you provide a
> reproducer or a test?

More to the point, looking at code paths producing XLOG_HEAP_TRUNCATE
records in core, we specifically discard any relation that does not
satisfy RelationIsLogicallyLogged().

In short, it is not possible in practice to reach this code at all.
We would do a decoding of the generated record after an historical
snapshot, so something like a SET UNLOGGED should not be seen in
practice. I think that it does not hurt to be defensive in practice
here, still I am wondering about code outside of core that may play it
unfair, even if the consequences are minimal.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-08-18 22:38:31 Re: [PATCH] Several refactorings for pg_dump
Previous Message Daniel Gustafsson 2026-08-18 22:16:55 Re: basebackup: do not verify checksums on pages written before enabling checksums