From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
---|---|
To: | 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Doruk Yilmaz <doruk(at)mixrank(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | RE: [Patch] add new parameter to pg_replication_origin_session_setup |
Date: | 2025-09-17 09:22:45 |
Message-ID: | OS7PR01MB149681B14B2432A9CEA7A3586F517A@OS7PR01MB14968.jpnprd01.prod.outlook.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear Amit,
> Can we think of writing a few tests for this newly exposed functionality?
I considered a test, please see attached files. 0001 was not changed from v6 and
0002 contained tests. Here, two sessions were opened and confirmed that they can
set the same origin.
BTW, while testing I found the existing issue of this function. Since the
session_replication_state is set before the pid check, there is a case that
session origin retains in case of failure. Here is a quick reproducer:
```
postgres=# SELECT pg_replication_origin_create('origin');
pg_replication_origin_create
------------------------------
1
(1 row)
postgres=# -- run origin_session_setup with incorrect parameter
postgres=# SELECT pg_replication_origin_session_setup('origin', -1);
ERROR: could not find replication state slot for replication origin with OID 1 which was acquired by -1
postgres=# -- run origin_session_setup again with correct parameter
postgres=# SELECT pg_replication_origin_session_setup('origin');
ERROR: cannot setup replication origin when one is already setup
```
The issue has exist since we introduces the parallel apply, but it has not been
found till now. Because parallel apply workers have not specified the invalid
pid. It can be more likely to happen so it's time to fix at the same time.
Idea for fix is that use local replication state and then at end assign it to
process-level. 0003 implemented that.
How do you feel?
Best regards,
Hayato Kuroda
FUJITSU LIMITED
Attachment | Content-Type | Size |
---|---|---|
v7-0001-pg_replication_origin_session_setup-pid-parameter.patch | application/octet-stream | 5.9 KB |
v7-0002-add-test.patch | application/octet-stream | 3.3 KB |
v7-0003-Avoid-setting-ReplicationState-in-case-of-ERROR.patch | application/octet-stream | 4.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ilia Evdokimov | 2025-09-17 09:40:01 | Re: Use merge-based matching for MCVs in eqjoinsel |
Previous Message | Tatsuo Ishii | 2025-09-17 09:18:51 | Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options |