RE: Parallel Apply

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 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-30 11:18:07
Message-ID: TY7PR01MB1455403538191EE4FA429106FF59FA@TY7PR01MB14554.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-01-30 11:28:04 Change default of jit to off
Previous Message Bertrand Drouvot 2026-01-30 11:16:26 Re: Consistently use the XLogRecPtrIsInvalid() macro