RE: Conflict detection for update_deleted in logical replication

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: RE: Conflict detection for update_deleted in logical replication
Date: 2025-09-15 07:36:56
Message-ID: TY4PR01MB169079DF3894A84652A1DCA8F9415A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday, September 15, 2025 12:55 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> One concern:
>
> if (should_stop_conflict_info_retention(rdt_data))
> + {
> + /*
> + * Stop retention if not yet. Otherwise, reset to the initial phase to
> + * retry all phases. This is required to recalculate the current wait
> + * time and resume retention if the time falls within
> + * max_retention_duration.
> + */
> + if (MySubscription->retentionactive)
> + rdt_data->phase = RDT_STOP_CONFLICT_INFO_RETENTION;
> + else
> + reset_retention_data_fields(rdt_data);
> +
> return;
> + }
>
> Instead of above code changes, shall we have:
>
> if (should_stop_conflict_info_retention(rdt_data))
> rdt_data->phase = RDT_STOP_CONFLICT_INFO_RETENTION;
> (always)
>
> And then stop_conflict_info_retention() should have these checks:
>
> if (MySubscription->retentionactive)
> {
> ...update flag and perform stop (current functionality)
> }
> else
> {
>
> Assert(!TransactionIdIsValid(MyLogicalRepWorker->oldest_nonremovable_xi
> d));
> reset_retention_data_fields(rdt_data);
> }

Thanks for the suggestion. I refactored the codes according to this.

Here is V65 patch which also addressed Amit's comments[1].

Best Regards,
Hou zj

Attachment Content-Type Size
v75-0001-Allow-conflict-relevant-data-retention-to-resume.patch application/octet-stream 18.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2025-09-15 07:37:06 RE: Conflict detection for update_deleted in logical replication
Previous Message Alexander Korotkov 2025-09-15 07:29:47 Re: Resetting recovery target parameters in pg_createsubscriber