RE: Parallel Apply

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, 'Dilip Kumar' <dilipbalaut(at)gmail(dot)com>, 'Andrei Lepikhov' <lepihov(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, 'wenhui qiu' <qiuwenhuifx(at)gmail(dot)com>
Subject: RE: Parallel Apply
Date: 2026-01-05 07:40:45
Message-ID: TY7PR01MB145541DD6F5BE4CD403BA39FDF586A@TY7PR01MB14554.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Happy new year hackers,

I found that CFbot sometimes failed tests. Per my analysis, there were two
issues in the 0005 patch. The following describes two changes.

1)
Took care of the case where an empty prepared transaction was replicated.
The leader worker would gather even such transactions in get_flush_position()
and try to clean up a replica identity hash. If the empty transaction is firstly
replicated after the worker is launched, however, the replica identity hash is
not yet initialized, which causes the segmentation fault. To address the issue,
a guard was added to the cleanup function.

As far as I know, an empty prepared transaction can happen if
a) the prepared transaction has already been rolled back while decoding, or
b) all changes are skipped.
Added test sometimes meets a) due to the timing issue.

2)
Fixed a timing issue in 050_parallel_apply.pl. The test sets the two_phase
option to true, but sometimes it fails if the apply workers are not yet finished
after the subscription is disabled. Now the test ensures there are no apply workers.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
v7-0001-Introduce-new-type-of-logical-replication-message.patch application/octet-stream 6.0 KB
v7-0002-Introduce-a-shared-hash-table-to-store-paralleliz.patch application/octet-stream 8.7 KB
v7-0003-Introduce-a-local-hash-table-to-store-replica-ide.patch application/octet-stream 27.7 KB
v7-0004-Parallel-apply-non-streaming-transactions.patch application/octet-stream 51.7 KB
v7-0005-support-2PC.patch application/octet-stream 13.9 KB
v7-0006-Track-dependencies-for-streamed-transactions.patch application/octet-stream 10.7 KB
v7-0007-Wait-applying-transaction-if-one-of-user-defined-.patch application/octet-stream 11.8 KB
v7-0008-Support-dependency-tracking-via-local-unique-inde.patch application/octet-stream 23.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-01-05 07:53:33 Re: Use Python "Limited API" in PL/Python
Previous Message Nikhil Kumar Veldanda 2026-01-05 07:39:28 Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem)