Re: pgsql: Preserve conflict-relevant data during logical replication.
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
Cc: Michael Paquier <michael@paquier.xyz>,
Amit Kapila <akapila@postgresql.org>, "pgsql-committers@lists.postgresql.org"
<pgsql-committers@lists.postgresql.org>
Date: 2025-07-24T03:44:31Z
Lists: pgsql-hackers
On Thu, Jul 24, 2025 at 8:27 AM Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com> wrote: > > On Thursday, July 24, 2025 9:25 AM Michael Paquier <michael@paquier.xyz> wrote: > > > > On Wed, Jul 23, 2025 at 03:35:06AM +0000, Amit Kapila wrote: > > > Preserve conflict-relevant data during logical replication. > > > > > > Logical replication requires reliable conflict detection to maintain > > > data consistency across nodes. To achieve this, we must prevent > > > premature removal of tuples deleted by other origins and their > > > associated commit_ts data by VACUUM, which could otherwise lead to > > > incorrect conflict reporting and resolution. > > > > Some of the tests added by this commit are causing blurps in the CI: > > https://cfbot.cputube.org/highlights/all.html > > ... > > I confirmed that the test to enable the retain_dead_tuples option for a > disabled subscription failed due to the apply worker for that subscription still > running, which caused the all subsequent tests to fail. To resolve this issue, > we need to ensure the apply worker has stopped when disabling the subscription. > > > 2025-07-23 21:15:03.128 UTC client backend[39133] 035_conflicts.pl LOG: statement: ALTER SUBSCRIPTION tap_sub_a_b SET (retain_dead_tuples = true); > > 2025-07-23 21:15:03.128 UTC client backend[39133] 035_conflicts.pl ERROR: cannot alter retain_dead_tuples when logical replication worker is still running > > Attached is a patch to address this problem. Apart from the reported failure, > there's another place where we did not wait for the worker to stop after > disabling the subscription. Although this hasn't resulted in a test failure so > far, I added wait logic for it in the patch as well for safety. > The fix looks good to me. I'll push your patch in sometime. -- With Regards, Amit Kapila.
Commits
-
Add test to prevent premature removal of conflict-relevant data.
- 6456c6e2c4ad 19 (unreleased) cited
-
Fix cfbot failure caused by commit 228c370868.
- df335618ed87 19 (unreleased) landed
-
Preserve conflict-relevant data during logical replication.
- 228c37086855 19 (unreleased) cited