RE: Parallel Apply
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 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-30T11:18:07Z
Lists: pgsql-hackers
Attachments
- v8-0001-Introduce-new-type-of-logical-replication-message.patch (application/octet-stream) patch v8-0001
- v8-0002-Introduce-a-shared-hash-table-to-store-paralleliz.patch (application/octet-stream) patch v8-0002
- v8-0003-Introduce-a-local-hash-table-to-store-replica-ide.patch (application/octet-stream) patch v8-0003
- v8-0004-Parallel-apply-non-streaming-transactions.patch (application/octet-stream) patch v8-0004
- v8-0005-support-2PC.patch (application/octet-stream) patch v8-0005
- v8-0006-Track-dependencies-for-streamed-transactions.patch (application/octet-stream) patch v8-0006
- v8-0007-Wait-applying-transaction-if-one-of-user-defined-.patch (application/octet-stream) patch v8-0007
- v8-0008-Support-dependency-tracking-via-local-unique-inde.patch (application/octet-stream) patch v8-0008
- v8-0009-Support-dependency-tracking-via-foreign-keys.patch (application/octet-stream) patch v8-0009
Dear Hackers, Here is a rebased version, plus 0009 patch. 0009 contains changes to handle dependencies based on the foreign keys. Without this, parallel apply can violate foreign key constraints if referenced tuples are committed after referencing tuples, leading to replication failures. This patch extends the dependency hash to track dependencies via FKs. Since referenced columns must be unique, information must be already stored to the hash if they have been modified. Based on the point, the leader apply worker checks to determine whether values in referencing columns have already been registered or not if applying tuples refer some columns, and regards that there is a dependency if found. Best regards, Hayato Kuroda FUJITSU LIMITED