Simplify parallel apply worker error reporting mechanism

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Zhijie Hou <houzhijie22(at)gmail(dot)com>
Subject: Simplify parallel apply worker error reporting mechanism
Date: 2026-11-16 01:26:47
Message-ID: OS7PR01MB18317CA08E7D389B8A8C5F63AF57C2@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

This is a fork thread for [1]. This patch aims to reduce codes related with
parallel apply.

Background
==========
So far, the error response from parallel apply workers is redirected to a shared
message queue, the leader worker recognizes their exit based on the response code.
It was needed because before 952bab8, leader appended the actual error message
from the parallel workers to the error context.

952bab8 simplified the error reporting style during the parallel apply, the
leader worker does not read error messages from parallel apply workers anymore.
But a shared message queue between the leader and worker is still retained.

Proposal
=======
I propose to introduce an indicator for parallel apply workers on the shared memory.
Parallel apply worker sets the status to FAILED at exit, and leader exits too based
on the change. Instead, the error propagation mechanism between workers can be
dropped. Detailed steps.

0. Assuming that parallel apply worker detects an ERROR
1. The parallel worker set their status to FAILED then send SIGUSR1 to the leader,
in before_shmem_exit callback
2. The leader accepts the signal and check status of launched parallel workers.
3. The leader exits too if one of parallel workers exit.

How do you feel?

[1]: https://www.postgresql.org/message-id/flat/CALDaNm0SSCS5EJ_KNXau_3iCr_KrpKth=ZrTeOf1DCFbE=3=9w(at)mail(dot)gmail(dot)com

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
0001-Simplify-parallel-apply-worker-error-reporting.patch application/octet-stream 22.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-11-16 01:29:48 RE: Incorrect CONTEXT reported for errors from parallel apply worker in logical replication
Previous Message Ishjaap Singh 2026-11-16 01:21:11 Re: psql: Don't offer USING INDEX after REPACK (CONCURRENTLY) or (ANALYZE)