On Fri, May 16, 2025 at 2:40 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Fri, May 16, 2025 at 12:01 PM shveta malik <shveta.ma...@gmail.com> wrote: > > > > On Fri, May 16, 2025 at 11:15 AM Amit Kapila <amit.kapil...@gmail.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.