Re: Conflict detection and logging in logical replication

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Jan Wieck <jan(at)wi3ck(dot)info>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Subject: Re: Conflict detection and logging in logical replication
Date: 2024-08-05 05:01:46
Message-ID: CAA4eK1JEx0x-dK1miyyOxRApXY6MOVVxB9FJi_fScOKmkw765w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 5, 2024 at 10:05 AM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> On Mon, Aug 5, 2024 at 9:19 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Fri, Aug 2, 2024 at 6:28 PM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
> > >
> > > Test Summary -
> > > -- The duration for case-2 was reduced to 2-3 minutes, matching the
> > > times of the other cases.
> > > -- The test revealed that the overhead in case-2 was not due to
> > > commit_ts fetching (GetTupleCommitTs).
> > > -- The additional action in case-2 was the error logging of all 10
> > > million update_differ conflicts.
> > >
> >
> > According to me, this last point is key among all tests which will
> > decide whether we should have a new subscription option like
> > detect_conflict or not. I feel this is the worst case where all the
> > row updates have conflicts and the majority of time is spent writing
> > LOG messages. Now, for this specific case, if one wouldn't have
> > enabled track_commit_timestamp then there would be no difference as
> > seen in case-4. So, I don't see this as a reason to introduce a new
> > subscription option like detect_conflicts, if one wants to avoid such
> > an overhead, she shouldn't have enabled track_commit_timestamp in the
> > first place to detect conflicts. Also, even without this, we would see
> > similar overhead in the case of update/delete_missing where we LOG
> > when the tuple to modify is not found.
> >
>
> Overall, it looks okay to get rid of the 'detect_conflict' parameter.
> My only concern here is the purpose/use-cases of
> 'track_commit_timestamp'. Is the only purpose of enabling
> 'track_commit_timestamp' is to detect conflicts? I couldn't find much
> in the doc on this. Can there be a case where a user wants to enable
> 'track_commit_timestamp' for any other purpose without enabling
> subscription's conflict detection?
>

I am not aware of any other use case for 'track_commit_timestamp' GUC.
As per my understanding, commit timestamp is primarily required for
conflict detection and resolution. We can probably add a description
in 'track_commit_timestamp' GUC about its usage along with this patch.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2024-08-05 05:28:22 Re: relfilenode statistics
Previous Message vignesh C 2024-08-05 04:56:38 Re: Logical Replication of sequences