From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add optional pid parameter to pg_replication_origin_session_setu
Date: Fri, 19 Sep 2025 05:48:41 +0000
Message-ID: <E1uzTz7-001ReG-0Q@gemulon.postgresql.org> (raw)
Add optional pid parameter to pg_replication_origin_session_setup().
Commit 216a784829c introduced parallel apply workers, allowing multiple
processes to share a replication origin. To support this,
replorigin_session_setup() was extended to accept a pid argument
identifying the process using the origin.
This commit exposes that capability through the SQL interface function
pg_replication_origin_session_setup() by adding an optional pid parameter.
This enables multiple processes to coordinate replication using the same
origin when using SQL-level replication functions.
This change allows the non-builtin logical replication solutions to
implement parallel apply for large transactions.
Additionally, an existing internal error was made user-facing, as it can
now be triggered via the exposed SQL API.
Author: Doruk Yilmaz <doruk@mixrank.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/CAMPB6wfe4zLjJL8jiZV5kjjpwBM2=rTRme0UCL7Ra4L8MTVdOg@mail.gmail.com
Discussion: https://postgr.es/m/CAE2gYzyTSNvHY1+iWUwykaLETSuAZsCWyryokjP6rG46ZvRgQA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5b148706c5c8ffffe5662fe569a0f0bcef2351d9
Modified Files
--------------
contrib/test_decoding/Makefile | 2 +-
.../expected/parallel_session_origin.out | 79 ++++++++++++++++++++++
contrib/test_decoding/expected/replorigin.out | 3 +
contrib/test_decoding/meson.build | 1 +
.../specs/parallel_session_origin.spec | 56 +++++++++++++++
contrib/test_decoding/sql/replorigin.sql | 3 +
doc/src/sgml/func/func-admin.sgml | 23 ++++++-
src/backend/catalog/system_functions.sql | 9 ++-
src/backend/replication/logical/origin.c | 23 +++++--
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 2 +-
11 files changed, 193 insertions(+), 10 deletions(-)
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: Add optional pid parameter to pg_replication_origin_session_setu
In-Reply-To: <E1uzTz7-001ReG-0Q@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