RE: Conflict detection for update_deleted in logical replication

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Michail Nikolaev' <michail(dot)nikolaev(at)gmail(dot)com>
Cc: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Subject: RE: Conflict detection for update_deleted in logical replication
Date: 2024-10-30 02:55:21
Message-ID: TYCPR01MB56935E024045AB6E96F72E3AF5542@TYCPR01MB5693.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Mikhail,

Thanks for describing more detail!

> Oh, I actually described the idea a bit incorrectly. The goal isn’t simply to call WaitForOlderSnapshots(slot.xmin);
> rather, it’s to ensure that we wait for slot.xmin in the same way we wait for regular snapshots (xmin).
> ...
> One possible solution here would be to register a snapshot with slot.xmin for the worker backend.
> This way, WaitForOlderSnapshots will account for it.

Note that apply workers can stop due to some reasons (e.g., disabling subscriptions,
error out, deadlock...). In this case, the snapshot cannot eb registered by the
worker and index can be re-built during the period.

If we do not assume the existence of workers, we must directly somehow check slot.xmin
and wait until it is advanced until the REINDEXing transaction. I still think it
is risky and another topic.

Anyway, this topic introduces huge complexity and is not mandatory for update_deleted
detection. We can work on it in later versions based on the needs.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-10-30 03:40:05 Re: Add isolation test template in injection_points for wait/wakeup/detach
Previous Message Andrei Lepikhov 2024-10-30 02:44:52 Re: Cleanup SubPlanstate