From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Treat any negative ws_file as closed in xlogreader.c
Date: Fri, 09 Oct 2026 05:00:18 +0000
Message-ID: <E1xF2iQ-00000000uBe-3Un3@gemulon.postgresql.org> (raw)
Treat any negative ws_file as closed in xlogreader.c
The segment_close() callback is required to set ws_file to a negative
value after closing a WAL segment, as documented in xlogreader.h.
XLogReaderFree() only treated -1 as closed, so it could call
segment_close() again if another negative value was used.
This should not be an issue in practice, but all the other code paths in
the tree use 0 as comparison base when dealing with ws_file, except for
the line updated here. Let's be consistent, at least.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/asNr203eue0R4zpZ@bdtpg
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/412848dac37f2e4455e1505f83f0af0f3d28a67d
Modified Files
--------------
src/backend/access/transam/xlogreader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz
Subject: Re: pgsql: Treat any negative ws_file as closed in xlogreader.c
In-Reply-To: <E1xF2iQ-00000000uBe-3Un3@gemulon.postgresql.org>
References: <E1xF2iQ-00000000uBe-3Un3@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox