pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fall back to serializing when parallel apply runs out of DSM seg
Date: Wed, 18 Nov 2026 18:30:41 +0000
Message-ID: <E1xTkQa-00000000HCd-3aDB@gemulon.postgresql.org> (raw)

Fall back to serializing when parallel apply runs out of DSM segments.

Commit 216a784829c made the leader apply worker serialize a streamed
transaction to a file if it fails to set up the shared memory for a
parallel apply worker. However, it called dsm_create() without
DSM_CREATE_NULL_IF_MAXSEGMENTS, so running out of DSM segments raised
an ERROR instead. The leader apply worker then exited and failed again
at the same STREAM START after restarting, so replication made no
progress until segments were freed.

Fix by passing DSM_CREATE_NULL_IF_MAXSEGMENTS, as parallel query does.

Backpatch to v16, where parallel apply was introduced.

Author: Baji Shaik <baji.pgdev@gmail.com>
Reviewed-by: Zhijie Hou <houzhijie22@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CA+fm-RMyb6EoMuk+a4_hZou9cdTHfB6mj1UV-7yb_YuTWLug1g@mail.gmail.com
Backpatch-through: 16

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/083f30f4763c60013b6f90deb3d4ee57bbf03db4

Modified Files
--------------
src/backend/replication/logical/applyparallelworker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1xTkQa-00000000HCd-3aDB@gemulon.postgresql.org>
Permalink:  ../E1xTkQa-00000000HCd-3aDB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xTkQa-00000000HCd-3aDB@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 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: msawada@postgresql.org
  Subject: Re: pgsql: Fall back to serializing when parallel apply runs out of DSM seg
  In-Reply-To: <E1xTkQa-00000000HCd-3aDB@gemulon.postgresql.org>
  References: <E1xTkQa-00000000HCd-3aDB@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