From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
Cc: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, 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> |
Subject: | Re: Conflict detection for update_deleted in logical replication |
Date: | 2025-05-16 10:13:33 |
Message-ID: | CAA4eK1+=ZAf0T2iMg2+ZF4cJdUk=UViqpiOg_kPa8jgK+g94aw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, May 16, 2025 at 2:40 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, May 16, 2025 at 12:01 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > On Fri, May 16, 2025 at 11:15 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > >
> > >
> > > BTW, another related point is that when we decide to stop retaining
> > > dead tuples (via should_stop_conflict_info_retention), should we also
> > > consider the case that the apply worker didn't even try to get the
> > > publisher status because previously it decided that
> > > oldest_nonremovable_xid cannot be advanced due to its
> > > OldestActiveTransactionId?
> > >
> >
> > Do you mean avoid stop-conflict-retention in such a case as apply
> > worker itself did not request status from the publisher? If I
> > understood your point correctly, then we can do that by advancing the
> > timer to a new value even if we did not update candidate-xid and did
> > not ask the status from the publisher.
> >
>
> But candidate_xid_time is also used in wait_for_local_flush() to check
> clock_skew between publisher and subscriber, so for that purpose, it
> is better to set it along with candidate_xid. However, can't we rely
> on the valid value of candidate_xid to ensure that apply worker didn't
> send any request? Note that we always reset candidate_xid once we have
> updated oldest_nonremovable_xid.
>
I think this is automatically taken care of because we call
should_stop_conflict_info_retention() only during 'wait' phase, which
should be done after candidate_xid is set. Having said that, we should
have assert for candidate_xid in should_stop_conflict_info_retention()
and also add in comments that it should be called only during the
'wait' phase. Additionally, we can also have an assert that
should_stop_conflict_info_retention() is called only during the 'wait'
phase.
--
With Regards,
Amit Kapila.
From | Date | Subject | |
---|---|---|---|
Next Message | Shaik Mohammad Mujeeb | 2025-05-16 10:35:01 | Re: Add comment explaining why queryid is int64 in pg_stat_statements |
Previous Message | shveta malik | 2025-05-16 10:12:58 | Re: Conflict detection for update_deleted in logical replication |