pgsql: Don't clear pendingRecoveryConflicts at end of transaction

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't clear pendingRecoveryConflicts at end of transaction
Date: 2026-03-10 22:10:16
Message-ID: E1w05HM-003NCE-25@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't clear pendingRecoveryConflicts at end of transaction

Commit 17f51ea818 introduced a new pendingRecoveryConflicts field in
PGPROC to replace the various ProcSignals. The new field was cleared
in ProcArrayEndTransaction(), which makes sense for conflicts with
e.g. locks or buffer pins which are gone at end of transaction. But it
is not appropriate for conflicts on a database, or a logical slot.

Because of this, the 035_standby_logical_decoding.pl test was
occasionally getting stuck in the buildfarm. It happens if the startup
process signals recovery conflict with the logical slot just when the
walsender process using the slot calls ProcArrayEndTransaction().

To fix, don't clear pendingRecoveryConflicts in
ProcArrayEndTransaction(). We could still clear certain conflict
flags, like conflicts on locks, but we didn't try to do that before
commit 17f51ea818 either.

In the passing, fix a misspelled comment, and make
InitAuxiliaryProcess() to also clear pendingRecoveryConflicts. I don't
think aux processes can have recovery conflicts, but it seems best to
initialize the field and keep InitAuxiliaryProcess() as close to
InitProcess() as possible.

Analyzed-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/3e07149d-060b-48a0-8f94-3d5e4946ae45@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/138592d1b06634b85d4b0275ba6501676bb8113a

Modified Files
--------------
src/backend/storage/ipc/procarray.c | 7 +------
src/backend/storage/lmgr/proc.c | 1 +
2 files changed, 2 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Melanie Plageman 2026-03-10 22:32:40 pgsql: Remove unused PruneState member frz_conflict_horizon
Previous Message Melanie Plageman 2026-03-10 19:26:49 pgsql: Use the newest to-be-frozen xid as the conflict horizon for free