agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix xid_advance_interval when max_retention_duration is 0.
Date: Tue, 28 Apr 2026 09:27:36 +0000
Message-ID: <E1wHejA-003BDK-0u@gemulon.postgresql.org> (raw)

Fix xid_advance_interval when max_retention_duration is 0.

When a subscription has retain_dead_tuples enabled and maxretention is
zero (unlimited), adjust_xid_advance_interval() mistakenly caps
xid_advance_interval to zero.

This zero interval forces get_candidate_xid() to evaluate
TimestampDifferenceExceeds() as always true, causing the apply worker to
call GetOldestActiveTransactionId() for every WAL message. This
leads to unnecessary ProcArrayLock acquisitions.

Fix this by only capping the interval when maxretention > 0, allowing
the exponential back-off to function properly.

Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/CAHg+QDdKVnCLHot=AcoPpEiSyDzGz7wGYjAFHVOw57oDtmUDWQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c210647aeb17692c138014235c7e7a2d9af73b87

Modified Files
--------------
src/backend/replication/logical/worker.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)



Message-ID: <E1wHejA-003BDK-0u@gemulon.postgresql.org>
Permalink:  ../E1wHejA-003BDK-0u@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wHejA-003BDK-0u@gemulon.postgresql.org

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix xid_advance_interval when max_retention_duration is 0.
  In-Reply-To: <E1wHejA-003BDK-0u@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox