From e17328acabf5515d27f0c5c4152a7ae7bbbc1119 Mon Sep 17 00:00:00 2001 From: Baji Shaik Date: Fri, 23 Oct 2026 12:37:02 -0500 Subject: [PATCH v2 1/2] Fall back to serializing when parallel apply runs out of DSM segments pa_setup_dsm() checked for a NULL segment and the caller falls back to having the leader serialize the streamed transaction, but dsm_create() was called without DSM_CREATE_NULL_IF_MAXSEGMENTS, so running out of DSM segments raised an ERROR instead. The leader apply worker then exited and restarted, failing again at the same STREAM START until segments were freed, and replication made no progress meanwhile. Pass DSM_CREATE_NULL_IF_MAXSEGMENTS, as parallel query does, so the existing fallback is used. Author: Baji Shaik Backpatch-through: 16 Discussion: https://postgr.es/m/CA+fm-RMyb6EoMuk+a4_hZou9cdTHfB6mj1UV-7yb_YuTWLug1g@mail.gmail.com --- src/backend/replication/logical/applyparallelworker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/replication/logical/applyparallelworker.c b/src/backend/replication/logical/applyparallelworker.c index 96bf499e49c..88355be46b3 100644 --- a/src/backend/replication/logical/applyparallelworker.c +++ b/src/backend/replication/logical/applyparallelworker.c @@ -358,7 +358,7 @@ pa_setup_dsm(ParallelApplyWorkerInfo *winfo) segsize = shm_toc_estimate(&e); /* Create the shared memory segment and establish a table of contents. */ - seg = dsm_create(shm_toc_estimate(&e), 0); + seg = dsm_create(shm_toc_estimate(&e), DSM_CREATE_NULL_IF_MAXSEGMENTS); if (!seg) return false; -- 2.54.0 (Apple Git-157)