RE: Parallel Apply
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Tomas Vondra <tomas@vondra.me>, Amit Kapila <amit.kapila16@gmail.com>, 'Dilip Kumar' <dilipbalaut@gmail.com>, 'Andrei Lepikhov' <lepihov@gmail.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, 'wenhui qiu' <qiuwenhuifx@gmail.com>
Date: 2026-01-05T07:40:45Z
Lists: pgsql-hackers
Attachments
- v7-0001-Introduce-new-type-of-logical-replication-message.patch (application/octet-stream) patch v7-0001
- v7-0002-Introduce-a-shared-hash-table-to-store-paralleliz.patch (application/octet-stream) patch v7-0002
- v7-0003-Introduce-a-local-hash-table-to-store-replica-ide.patch (application/octet-stream) patch v7-0003
- v7-0004-Parallel-apply-non-streaming-transactions.patch (application/octet-stream) patch v7-0004
- v7-0005-support-2PC.patch (application/octet-stream) patch v7-0005
- v7-0006-Track-dependencies-for-streamed-transactions.patch (application/octet-stream) patch v7-0006
- v7-0007-Wait-applying-transaction-if-one-of-user-defined-.patch (application/octet-stream) patch v7-0007
- v7-0008-Support-dependency-tracking-via-local-unique-inde.patch (application/octet-stream) patch v7-0008
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