Re: Conflict detection and logging in logical replication

2024-08-28 Thread Amit Kapila
On Wed, Aug 28, 2024 at 12:24 PM Peter Smith wrote: > > On Wed, Aug 28, 2024 at 3:53 PM shveta malik wrote: > > > > On Wed, Aug 28, 2024 at 9:44 AM Zhijie Hou (Fujitsu) > > wrote: > > > > > > > > +1 on 'update_origin_differs' instead of 'update_origins_differ' as > > > > > the former is somewhat

Re: Conflict detection and logging in logical replication

2024-08-27 Thread Peter Smith
On Wed, Aug 28, 2024 at 3:53 PM shveta malik wrote: > > On Wed, Aug 28, 2024 at 9:44 AM Zhijie Hou (Fujitsu) > wrote: > > > > > > +1 on 'update_origin_differs' instead of 'update_origins_differ' as > > > > the former is somewhat similar to other conflict names 'insert_exists' > > > > and 'update_

Re: Conflict detection and logging in logical replication

2024-08-27 Thread shveta malik
On Wed, Aug 28, 2024 at 9:44 AM Zhijie Hou (Fujitsu) wrote: > > > > +1 on 'update_origin_differs' instead of 'update_origins_differ' as > > > the former is somewhat similar to other conflict names 'insert_exists' > > > and 'update_exists'. > > > > Since we reached a consensus on this, I am attachi

RE: Conflict detection and logging in logical replication

2024-08-27 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 28, 2024 12:11 PM Zhijie Hou (Fujitsu) wrote: > > > > Peter Smith mentioned to me off-list that the names of conflict > > > > types 'update_differ' and 'delete_differ' are not intuitive as > > > > compared to all other conflict types like insert_exists, > > > > update_missin

RE: Conflict detection and logging in logical replication

2024-08-27 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 28, 2024 11:30 AM shveta malik wrote: > > On Tue, Aug 27, 2024 at 4:37 AM Peter Smith > wrote: > > > > On Mon, Aug 26, 2024 at 7:52 PM Amit Kapila > wrote: > > > > > > On Thu, Aug 22, 2024 at 2:21 PM Amit Kapila > wrote: > > > > > > > > On Thu, Aug 22, 2024 at 1:33 PM Pet

Re: Conflict detection and logging in logical replication

2024-08-27 Thread shveta malik
On Tue, Aug 27, 2024 at 4:37 AM Peter Smith wrote: > > On Mon, Aug 26, 2024 at 7:52 PM Amit Kapila wrote: > > > > On Thu, Aug 22, 2024 at 2:21 PM Amit Kapila wrote: > > > > > > On Thu, Aug 22, 2024 at 1:33 PM Peter Smith wrote: > > > > > > > > Do you think the documentation for the 'column_valu

Re: Conflict detection and logging in logical replication

2024-08-26 Thread Peter Smith
On Mon, Aug 26, 2024 at 7:52 PM Amit Kapila wrote: > > On Thu, Aug 22, 2024 at 2:21 PM Amit Kapila wrote: > > > > On Thu, Aug 22, 2024 at 1:33 PM Peter Smith wrote: > > > > > > Do you think the documentation for the 'column_value' parameter of the > > > conflict logging should say that the displ

RE: Conflict detection and logging in logical replication

2024-08-26 Thread Zhijie Hou (Fujitsu)
On Monday, August 26, 2024 6:36 PM shveta malik wrote: > > On Mon, Aug 26, 2024 at 3:22 PM Amit Kapila > wrote: > > > > On Thu, Aug 22, 2024 at 2:21 PM Amit Kapila > wrote: > > > > > > On Thu, Aug 22, 2024 at 1:33 PM Peter Smith > wrote: > > > > > > > > Do you think the documentation for the '

Re: Conflict detection and logging in logical replication

2024-08-26 Thread shveta malik
On Mon, Aug 26, 2024 at 3:22 PM Amit Kapila wrote: > > On Thu, Aug 22, 2024 at 2:21 PM Amit Kapila wrote: > > > > On Thu, Aug 22, 2024 at 1:33 PM Peter Smith wrote: > > > > > > Do you think the documentation for the 'column_value' parameter of the > > > conflict logging should say that the displ

Re: Conflict detection and logging in logical replication

2024-08-26 Thread Amit Kapila
On Thu, Aug 22, 2024 at 2:21 PM Amit Kapila wrote: > > On Thu, Aug 22, 2024 at 1:33 PM Peter Smith wrote: > > > > Do you think the documentation for the 'column_value' parameter of the > > conflict logging should say that the displayed value might be > > truncated? > > > > I updated the patch to

Re: Conflict detection and logging in logical replication

2024-08-22 Thread Amit Kapila
On Thu, Aug 22, 2024 at 1:33 PM Peter Smith wrote: > > Do you think the documentation for the 'column_value' parameter of the > conflict logging should say that the displayed value might be > truncated? > I updated the patch to mention this and pushed it. -- With Regards, Amit Kapila.

Re: Conflict detection and logging in logical replication

2024-08-22 Thread Peter Smith
Hi Hou-san. I was experimenting with some conflict logging and found that large column values are truncated in the log DETAIL. E.g. Below I have a table where I inserted a 3000 character text value 'bigbigbig..." Then I caused a replication conflict. test_sub=# delete fr2024-08-22 17:50:17.181

RE: Conflict detection and logging in logical replication

2024-08-22 Thread Zhijie Hou (Fujitsu)
On Thursday, August 22, 2024 11:25 AM shveta malik wrote: > > On Wed, Aug 21, 2024 at 3:04 PM Zhijie Hou (Fujitsu) > wrote: > > > > > > Attach the V20 patch set which addressed above, Shveta[1][2] and > > Kuroda-san's[3] comments. > > > > Thank You for the patch. Few comments: Thanks for the

Re: Conflict detection and logging in logical replication

2024-08-21 Thread shveta malik
On Wed, Aug 21, 2024 at 3:04 PM Zhijie Hou (Fujitsu) wrote: > > > Attach the V20 patch set which addressed above, Shveta[1][2] and > Kuroda-san's[3] > comments. > Thank You for the patch. Few comments: 1) + The key section includes the key values of the local tuple that violated a unique constr

Re: Conflict detection and logging in logical replication

2024-08-21 Thread Peter Smith
HI Hous-San,. Here is my review of the v20-0001 docs patch. 1. Restructure into sections > I think that's a good idea. But I preferred to do that in a separate > patch(maybe a third patch after the first and second are RFC), because AFAICS > we would need to adjust some existing docs which falls

Re: Conflict detection and logging in logical replication

2024-08-21 Thread Amit Kapila
On Wed, Aug 21, 2024 at 8:35 AM Zhijie Hou (Fujitsu) wrote: > > On Wednesday, August 21, 2024 9:33 AM Jonathan S. Katz > wrote: > > On 8/6/24 4:15 AM, Zhijie Hou (Fujitsu) wrote: > > > > > Thanks for the idea! I thought about few styles based on the suggested > > > format, what do you think abou

RE: Conflict detection and logging in logical replication

2024-08-21 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 21, 2024 2:45 PM Peter Smith wrote: > > Here are some review comments for the v19-0001 docs patch. > > The content seemed reasonable, but IMO it should be presented quite > differently. > > > > 1. Use sub-sections > > I expect this logical replication "Conflicts" sec

RE: Conflict detection and logging in logical replication

2024-08-21 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 21, 2024 1:31 PM Kuroda, Hayato/黒田 隼人 wrote: > > Dear Hou, > > Thanks for updating the patch! I think the patch is mostly good. > Here are minor comments. Thanks for the comments ! > > 02. > ``` > + > + The key section in the second sentence of the > ... > ```

RE: Conflict detection and logging in logical replication

2024-08-21 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 21, 2024 11:40 AM shveta malik wrote: > > On Tue, Aug 20, 2024 at 4:45 PM Zhijie Hou (Fujitsu) > wrote:> Thanks for the comments! > 4) > Shall we give an example LOG message in the end? I feel the current insert_exists log in conflict section seems sufficient as an exam

Re: Conflict detection and logging in logical replication

2024-08-20 Thread Peter Smith
Here are some review comments for the v19-0001 docs patch. The content seemed reasonable, but IMO it should be presented quite differently. 1. Use sub-sections I expect this logical replication "Conflicts" section is going to evolve into something much bigger. Surely, it's not going to be

Re: Conflict detection and logging in logical replication

2024-08-20 Thread shveta malik
On Tue, Aug 20, 2024 at 4:45 PM Zhijie Hou (Fujitsu) wrote: > > Here are the remaining patches. > > 0001 adds additional doc to explain the log format. > 0002 collects statistics about conflicts in logical replication. > 0002 has not changed since I last reviewed it. It seems all my old comments

RE: Conflict detection and logging in logical replication

2024-08-20 Thread Hayato Kuroda (Fujitsu)
Dear Hou, Thanks for updating the patch! I think the patch is mostly good. Here are minor comments. 0001: 01. ``` + +LOG: conflict detected on relation "schemaname.tablename": conflict=conflict_type +DETAIL: detailed explaination. ... + ``` I don't think the label is correct. label should b

Re: Conflict detection and logging in logical replication

2024-08-20 Thread shveta malik
On Tue, Aug 20, 2024 at 4:45 PM Zhijie Hou (Fujitsu) wrote: > > Here are the remaining patches. > > 0001 adds additional doc to explain the log format. Thanks for the patch. Please find few comments on 001: 1) +Key (column_name, ...)=(column_name, ...); existing local tuple (column_name, ...)=(c

RE: Conflict detection and logging in logical replication

2024-08-20 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 21, 2024 9:33 AM Jonathan S. Katz wrote: > On 8/6/24 4:15 AM, Zhijie Hou (Fujitsu) wrote: > > > Thanks for the idea! I thought about few styles based on the suggested > > format, what do you think about the following ? > > Thanks for proposing formats. Before commenting on

Re: Conflict detection and logging in logical replication

2024-08-20 Thread Jonathan S. Katz
On 8/6/24 4:15 AM, Zhijie Hou (Fujitsu) wrote: Thanks for the idea! I thought about few styles based on the suggested format, what do you think about the following ? Thanks for proposing formats. Before commenting on the specifics, I do want to ensure that we're thinking about the following f

RE: Conflict detection and logging in logical replication

2024-08-20 Thread Zhijie Hou (Fujitsu)
On Tuesday, August 20, 2024 12:37 PM Amit Kapila wrote: > > On Mon, Aug 19, 2024 at 4:16 PM Amit Kapila > Pushed. Thanks for pushing. Here are the remaining patches. 0001 adds additional doc to explain the log format. 0002 collects statistics about conflicts in logical replication. Best Reg

Re: Conflict detection and logging in logical replication

2024-08-19 Thread Amit Kapila
On Mon, Aug 19, 2024 at 4:16 PM Amit Kapila wrote: > > > Rest looks good. > > > > Thanks for the review and testing. > Pushed. -- With Regards, Amit Kapila.

Re: Conflict detection and logging in logical replication

2024-08-19 Thread Amit Kapila
On Mon, Aug 19, 2024 at 3:03 PM shveta malik wrote: > > On Mon, Aug 19, 2024 at 12:32 PM Zhijie Hou (Fujitsu) > wrote: > > > > > > Thanks for reporting the bug. I have fixed it and ran pgindent in V17 patch. > > I also adjusted few comments and fixed a typo. > > > > Thanks for the patch. Re-teste

Re: Conflict detection and logging in logical replication

2024-08-19 Thread shveta malik
On Mon, Aug 19, 2024 at 12:32 PM Zhijie Hou (Fujitsu) wrote: > > > Thanks for reporting the bug. I have fixed it and ran pgindent in V17 patch. > I also adjusted few comments and fixed a typo. > Thanks for the patch. Re-tested it, all scenarios seem to work well now. I see that this version has

Re: Conflict detection and logging in logical replication

2024-08-19 Thread shveta malik
On Mon, Aug 19, 2024 at 12:09 PM Amit Kapila wrote: > > On Mon, Aug 19, 2024 at 11:54 AM shveta malik wrote: > > > > On Mon, Aug 19, 2024 at 11:37 AM Amit Kapila > > wrote: > > > > > > On Mon, Aug 19, 2024 at 9:08 AM shveta malik > > > wrote: > > > > > > > > On Sun, Aug 18, 2024 at 2:27 PM Zh

RE: Conflict detection and logging in logical replication

2024-08-19 Thread Zhijie Hou (Fujitsu)
On Monday, August 19, 2024 2:40 PM Amit Kapila wrote: > > On Mon, Aug 19, 2024 at 11:54 AM shveta malik > wrote: > > > > On Mon, Aug 19, 2024 at 11:37 AM Amit Kapila > wrote: > > > > > > On Mon, Aug 19, 2024 at 9:08 AM shveta malik > wrote: > > > > > > > > On Sun, Aug 18, 2024 at 2:27 PM Zhiji

Re: Conflict detection and logging in logical replication

2024-08-18 Thread Amit Kapila
On Mon, Aug 19, 2024 at 11:54 AM shveta malik wrote: > > On Mon, Aug 19, 2024 at 11:37 AM Amit Kapila wrote: > > > > On Mon, Aug 19, 2024 at 9:08 AM shveta malik wrote: > > > > > > On Sun, Aug 18, 2024 at 2:27 PM Zhijie Hou (Fujitsu) > > > wrote: > > > > > > > > Attach the V16 patch which addre

Re: Conflict detection and logging in logical replication

2024-08-18 Thread shveta malik
On Mon, Aug 19, 2024 at 11:37 AM Amit Kapila wrote: > > On Mon, Aug 19, 2024 at 9:08 AM shveta malik wrote: > > > > On Sun, Aug 18, 2024 at 2:27 PM Zhijie Hou (Fujitsu) > > wrote: > > > > > > Attach the V16 patch which addressed the comments we agreed on. > > > I will add a doc patch to explain

Re: Conflict detection and logging in logical replication

2024-08-18 Thread Amit Kapila
On Mon, Aug 19, 2024 at 9:08 AM shveta malik wrote: > > On Sun, Aug 18, 2024 at 2:27 PM Zhijie Hou (Fujitsu) > wrote: > > > > Attach the V16 patch which addressed the comments we agreed on. > > I will add a doc patch to explain the log format after the 0001 is RFC. > > > > Thank You for addressin

Re: Conflict detection and logging in logical replication

2024-08-18 Thread shveta malik
On Mon, Aug 19, 2024 at 9:07 AM shveta malik wrote: > > On Sun, Aug 18, 2024 at 2:27 PM Zhijie Hou (Fujitsu) > wrote: > > > > Attach the V16 patch which addressed the comments we agreed on. > > I will add a doc patch to explain the log format after the 0001 is RFC. > > > > Thank You for addressin

RE: Conflict detection and logging in logical replication

2024-08-18 Thread Zhijie Hou (Fujitsu)
On Friday, August 16, 2024 7:47 PM Michail Nikolaev wrote: > > I think you might misunderstand the behavior of CheckAndReportConflict(), > > even if it found a conflict, it still inserts the tuple into the index which > > means the change is anyway applied. > > > In the above conditions where a

Re: Conflict detection and logging in logical replication

2024-08-18 Thread shveta malik
On Sun, Aug 18, 2024 at 2:27 PM Zhijie Hou (Fujitsu) wrote: > > Attach the V16 patch which addressed the comments we agreed on. > I will add a doc patch to explain the log format after the 0001 is RFC. > Thank You for addressing comments. Please see this scenario: create table tab1(pk int primar

RE: Conflict detection and logging in logical replication

2024-08-18 Thread Zhijie Hou (Fujitsu)
On Friday, August 16, 2024 5:25 PM shveta malik wrote: > > On Fri, Aug 16, 2024 at 12:19 PM Amit Kapila > wrote: > > > > On Fri, Aug 16, 2024 at 11:48 AM shveta malik > wrote: > > > > > > On Fri, Aug 16, 2024 at 10:46 AM shveta malik > wrote: > > > > > > > > 3) > > > > For update_exists(), we

RE: Conflict detection and logging in logical replication

2024-08-18 Thread Zhijie Hou (Fujitsu)
On Friday, August 16, 2024 2:49 PM Amit Kapila wrote: > > > > > > > > One more comment: > > > > 5) > > For insert/update_exists, the sequence is: > > Key .. ; existing local tuple .. ; remote tuple ... > > > > For rest of the conflicts, sequence is: > > Existing local tuple

RE: Conflict detection and logging in logical replication

2024-08-18 Thread Zhijie Hou (Fujitsu)
On Friday, August 16, 2024 2:31 PM Amit Kapila wrote: > > On Fri, Aug 16, 2024 at 10:46 AM shveta malik > wrote: > > > > On Thu, Aug 15, 2024 at 12:47 PM Zhijie Hou (Fujitsu) > > wrote: > > > > > > Thanks. I have checked and merged the changes. Here is the V15 patch > > > which addressed above

Re: Conflict detection and logging in logical replication

2024-08-16 Thread Michail Nikolaev
Hello! > I think you might misunderstand the behavior of CheckAndReportConflict(), even > if it found a conflict, it still inserts the tuple into the index which means > the change is anyway applied. > In the above conditions where a concurrent tuple insertion is removed > or rolled back before C

Re: Conflict detection and logging in logical replication

2024-08-16 Thread shveta malik
On Fri, Aug 16, 2024 at 12:19 PM Amit Kapila wrote: > > On Fri, Aug 16, 2024 at 11:48 AM shveta malik wrote: > > > > On Fri, Aug 16, 2024 at 10:46 AM shveta malik > > wrote: > > > > > > 3) > > > For update_exists(), we dump: > > > Key (a, b)=(2, 1) > > > > > > For delete_missing, update_missing

Re: Conflict detection and logging in logical replication

2024-08-15 Thread Amit Kapila
On Fri, Aug 16, 2024 at 11:48 AM shveta malik wrote: > > On Fri, Aug 16, 2024 at 10:46 AM shveta malik wrote: > > > > 3) > > For update_exists(), we dump: > > Key (a, b)=(2, 1) > > > > For delete_missing, update_missing, update_differ, we dump: > > Replica identity (a, b)=(2, 1). > > > > For upda

Re: Conflict detection and logging in logical replication

2024-08-15 Thread Amit Kapila
On Fri, Aug 16, 2024 at 10:46 AM shveta malik wrote: > > On Thu, Aug 15, 2024 at 12:47 PM Zhijie Hou (Fujitsu) > wrote: > > > > Thanks. I have checked and merged the changes. Here is the V15 patch > > which addressed above comments. > > Thanks for the patch. Please find few comments and queries:

Re: Conflict detection and logging in logical replication

2024-08-15 Thread shveta malik
On Fri, Aug 16, 2024 at 10:46 AM shveta malik wrote: > > 3) > For update_exists(), we dump: > Key (a, b)=(2, 1) > > For delete_missing, update_missing, update_differ, we dump: > Replica identity (a, b)=(2, 1). > > For update_exists as well, shouldn't we dump 'Replica identity'? Only > for insert c

Re: Conflict detection and logging in logical replication

2024-08-15 Thread shveta malik
On Thu, Aug 15, 2024 at 12:47 PM Zhijie Hou (Fujitsu) wrote: > > Thanks. I have checked and merged the changes. Here is the V15 patch > which addressed above comments. Thanks for the patch. Please find few comments and queries: 1) For various conflicts , we have these in Logs: Replica identity (

Re: Conflict detection and logging in logical replication

2024-08-15 Thread Amit Kapila
On Wed, Aug 14, 2024 at 7:45 PM Michail Nikolaev wrote: > > > This is as expected, and we have documented this in the code comments. We > > don't > > need to report a conflict if the conflicting tuple has been removed or > > updated > > due to concurrent transaction. The same is true if the tran

RE: Conflict detection and logging in logical replication

2024-08-15 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 14, 2024 10:15 PM Michail Nikolaev wrote: > > This is as expected, and we have documented this in the code comments. We > > don't > > need to report a conflict if the conflicting tuple has been removed or > > updated > > due to concurrent transaction. The same is true if t

RE: Conflict detection and logging in logical replication

2024-08-15 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 14, 2024 7:02 PM Amit Kapila wrote: > > On Wed, Aug 14, 2024 at 8:05 AM Zhijie Hou (Fujitsu) > wrote: > > > > Here is the V14 patch. > > > > Review comments: > 1. > ReportApplyConflict() > { > ... > + ereport(elevel, > + errcode(ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION), > +

Re: Conflict detection and logging in logical replication

2024-08-14 Thread Michail Nikolaev
Hello, Hou! > This is as expected, and we have documented this in the code comments. We don't > need to report a conflict if the conflicting tuple has been removed or updated > due to concurrent transaction. The same is true if the transaction that > inserted the conflicting tuple is rolled back b

Re: Conflict detection and logging in logical replication

2024-08-14 Thread Amit Kapila
On Wed, Aug 14, 2024 at 8:05 AM Zhijie Hou (Fujitsu) wrote: > > Here is the V14 patch. > Review comments: 1. ReportApplyConflict() { ... + ereport(elevel, + errcode(ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION), + errmsg("conflict detected on relation \"%s.%s\": conflict=%s", +get_namespace_name(Re

RE: Conflict detection and logging in logical replication

2024-08-13 Thread Zhijie Hou (Fujitsu)
On Tuesday, August 13, 2024 7:04 PM Amit Kapila wrote: > > On Tue, Aug 13, 2024 at 10:09 AM Zhijie Hou (Fujitsu) > wrote: > > > > Here is V13 patch set which addressed above comments. > > > > 1. > +ReportApplyConflict(int elevel, ConflictType type, EState *estate, > +ResultRelInfo *relinfo, >

RE: Conflict detection and logging in logical replication

2024-08-13 Thread Zhijie Hou (Fujitsu)
On Tuesday, August 13, 2024 7:33 PM Michail Nikolaev wrote: > I think this is an independent issue which can be discussed separately in the > original thread[1], and I have replied to that thread. >Thanks! But it seems like this part is still relevant to the current thread: > > It also seems

Re: Conflict detection and logging in logical replication

2024-08-13 Thread Michail Nikolaev
Hello! > I think this is an independent issue which can be discussed separately in the > original thread[1], and I have replied to that thread. Thanks! But it seems like this part is still relevant to the current thread: > It also seems possible that a conflict could be resolved by a concurrent

Re: Conflict detection and logging in logical replication

2024-08-13 Thread Amit Kapila
On Tue, Aug 13, 2024 at 10:09 AM Zhijie Hou (Fujitsu) wrote: > > Here is V13 patch set which addressed above comments. > 1. +ReportApplyConflict(int elevel, ConflictType type, EState *estate, + ResultRelInfo *relinfo, The change looks better but it would still be better to keep elevel and type a

RE: Conflict detection and logging in logical replication

2024-08-12 Thread Zhijie Hou (Fujitsu)
On Monday, August 12, 2024 7:41 PM Amit Kapila wrote: > > On Fri, Aug 9, 2024 at 12:29 PM Zhijie Hou (Fujitsu) > wrote: > > > > Here is the V12 patch that improved the log format as discussed. > > > > Review comments: Thanks for the comments. > === > 1. The patch doesn't display t

Re: Conflict detection and logging in logical replication

2024-08-12 Thread Nisha Moond
On Mon, Aug 5, 2024 at 10:05 AM shveta malik wrote: > > On Mon, Aug 5, 2024 at 9:19 AM Amit Kapila wrote: > > > > On Fri, Aug 2, 2024 at 6:28 PM Nisha Moond wrote: > > > > > > Performance tests done on the v8-0001 and v8-0002 patches, available at > > > [1]. > > > > > > > Thanks for doing the d

Re: Conflict detection and logging in logical replication

2024-08-12 Thread Amit Kapila
On Fri, Aug 9, 2024 at 12:29 PM Zhijie Hou (Fujitsu) wrote: > > Here is the V12 patch that improved the log format as discussed. > Review comments: === 1. The patch doesn't display the remote tuple for delete_differ case. However, it shows the remote tuple correctly for update_differ.

Re: Conflict detection and logging in logical replication

2024-08-11 Thread Amit Kapila
On Fri, Aug 9, 2024 at 12:29 PM Zhijie Hou (Fujitsu) wrote: > > Here is the V12 patch that improved the log format as discussed. > * diff --git a/src/test/subscription/out b/src/test/subscription/out new file mode 100644 index 00..2b68e9264a --- /dev/null +++ b/src/test/subscription/out @

RE: Conflict detection and logging in logical replication

2024-08-11 Thread Zhijie Hou (Fujitsu)
On Friday, August 9, 2024 7:45 PM Michail Nikolaev wrote: > There are some comments on this patch related to issue [0]. In short: any > DirtySnapshot index scan may fail to find an existing tuple in the case of a > concurrent update. > > - FindConflictTuple may return false negative result in t

Re: Conflict detection and logging in logical replication

2024-08-09 Thread Michail Nikolaev
Hello, everyone. There are some comments on this patch related to issue [0]. In short: any DirtySnapshot index scan may fail to find an existing tuple in the case of a concurrent update. - FindConflictTuple may return false negative result in the case of concurrent update because ExecCheckIndexCo

RE: Conflict detection and logging in logical replication

2024-08-09 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 7, 2024 1:24 PM Amit Kapila wrote: > > On Tue, Aug 6, 2024 at 1:45 PM Zhijie Hou (Fujitsu) > > Thanks for the idea! I thought about few styles based on the suggested > format, > > what do you think about the following ? > > > > --- > > Version 1 > > --- > > LOG: CONFLICT: in

Re: Conflict detection and logging in logical replication

2024-08-07 Thread shveta malik
On Wed, Aug 7, 2024 at 1:08 PM Zhijie Hou (Fujitsu) wrote: > > On Wednesday, August 7, 2024 3:00 PM Kuroda, Hayato/黒田 隼人 > wrote: > > > > While playing with the 0003 patch (the patch may not be ready), I found that > > when the insert_exists event occurred, both apply_error_count and > > insert_

RE: Conflict detection and logging in logical replication

2024-08-07 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 7, 2024 3:00 PM Kuroda, Hayato/黒田 隼人 wrote: > > While playing with the 0003 patch (the patch may not be ready), I found that > when the insert_exists event occurred, both apply_error_count and > insert_exists_count was counted. Thanks for testing. 0003 is a separate feature

RE: Conflict detection and logging in logical replication

2024-08-07 Thread Hayato Kuroda (Fujitsu)
Dear Hou, While playing with the 0003 patch (the patch may not be ready), I found that when the insert_exists event occurred, both apply_error_count and insert_exists_count was counted. ``` -- insert a tuple on the subscriber subscriber =# INSERT INTO tab VALUES (1); -- insert the same tuple on

Re: Conflict detection and logging in logical replication

2024-08-06 Thread Amit Kapila
On Tue, Aug 6, 2024 at 1:45 PM Zhijie Hou (Fujitsu) wrote: > > On Monday, August 5, 2024 6:52 PM Amit Kapila wrote: > > > > On Sun, Aug 4, 2024 at 1:22 PM Zhijie Hou (Fujitsu) > > wrote: > > > > > > On Friday, August 2, 2024 7:03 PM Amit Kapila > > wrote: > > > > > > > > > > Here is the V11 pat

RE: Conflict detection and logging in logical replication

2024-08-06 Thread Hayato Kuroda (Fujitsu)
Dear Hou, > > Here is the V11 patch set which addressed above and Kuroda-san[1] comments. > Thanks for updating the patch. I read 0001 again and I don't have critical comments for now. I found some cosmetic issues (e.g., lines should be shorter than 80 columns) and attached the fix patch. Feel

RE: Conflict detection and logging in logical replication

2024-08-06 Thread Zhijie Hou (Fujitsu)
On Monday, August 5, 2024 6:52 PM Amit Kapila wrote: > > On Sun, Aug 4, 2024 at 1:22 PM Zhijie Hou (Fujitsu) > wrote: > > > > On Friday, August 2, 2024 7:03 PM Amit Kapila > wrote: > > > > > > > Here is the V11 patch set which addressed above and Kuroda-san[1] > comments. > > > > A few design-

Re: Conflict detection and logging in logical replication

2024-08-05 Thread Amit Kapila
On Sun, Aug 4, 2024 at 1:22 PM Zhijie Hou (Fujitsu) wrote: > > On Friday, August 2, 2024 7:03 PM Amit Kapila wrote: > > > > Here is the V11 patch set which addressed above and Kuroda-san[1] comments. > A few design-level points: * @@ -525,10 +602,33 @@ ExecSimpleRelationInsert(ResultRelInfo *re

Re: Conflict detection and logging in logical replication

2024-08-04 Thread Amit Kapila
On Mon, Aug 5, 2024 at 10:05 AM shveta malik wrote: > > On Mon, Aug 5, 2024 at 9:19 AM Amit Kapila wrote: > > > > On Fri, Aug 2, 2024 at 6:28 PM Nisha Moond wrote: > > > > > > Test Summary - > > > -- The duration for case-2 was reduced to 2-3 minutes, matching the > > > times of the other cases.

Re: Conflict detection and logging in logical replication

2024-08-04 Thread shveta malik
On Mon, Aug 5, 2024 at 9:19 AM Amit Kapila wrote: > > On Fri, Aug 2, 2024 at 6:28 PM Nisha Moond wrote: > > > > Performance tests done on the v8-0001 and v8-0002 patches, available at [1]. > > > > Thanks for doing the detailed tests for this patch. > > > The purpose of the performance tests is to

Re: Conflict detection and logging in logical replication

2024-08-04 Thread Amit Kapila
On Sun, Aug 4, 2024 at 1:04 PM Zhijie Hou (Fujitsu) wrote: > > On Friday, July 26, 2024 2:26 PM Amit Kapila wrote: > > > > > > I agree that displaying pk where applicable should be okay as we display it > > at > > other places but the same won't be possible when we do sequence scan to > > fetch

Re: Conflict detection and logging in logical replication

2024-08-04 Thread shveta malik
On Sun, Aug 4, 2024 at 1:22 PM Zhijie Hou (Fujitsu) wrote: > > Here is the V11 patch set which addressed above and Kuroda-san[1] comments. > Thanks for the patch. Few comments: 1) Can you please recheck conflict.h inclusion. I think, these are not required: #include "access/xlogdefs.h" #include

Re: Conflict detection and logging in logical replication

2024-08-04 Thread Amit Kapila
On Fri, Aug 2, 2024 at 6:28 PM Nisha Moond wrote: > > Performance tests done on the v8-0001 and v8-0002 patches, available at [1]. > Thanks for doing the detailed tests for this patch. > The purpose of the performance tests is to measure the impact on > logical replication with track_commit_time

RE: Conflict detection and logging in logical replication

2024-08-04 Thread Zhijie Hou (Fujitsu)
On Friday, July 26, 2024 2:26 PM Amit Kapila wrote: > > On Fri, Jul 26, 2024 at 9:39 AM shveta malik wrote: > > > > On Thu, Jul 11, 2024 at 7:47 AM Zhijie Hou (Fujitsu) > > wrote: > > > > > > On Wednesday, July 10, 2024 5:39 PM shveta malik > wrote: > > > > > > > > > > 2) > > > > Another case

Re: Conflict detection and logging in logical replication

2024-08-02 Thread Nisha Moond
Performance tests done on the v8-0001 and v8-0002 patches, available at [1]. The purpose of the performance tests is to measure the impact on logical replication with track_commit_timestamp enabled, as this involves fetching the commit_ts data to determine delete_differ/update_differ conflicts. F

Re: Conflict detection and logging in logical replication

2024-08-02 Thread Amit Kapila
On Thu, Aug 1, 2024 at 5:23 PM Amit Kapila wrote: > > On Thu, Aug 1, 2024 at 2:26 PM Hayato Kuroda (Fujitsu) > wrote: > > > > 04. general > > > > According to the documentation [1], there is another constraint "exclude", > > which > > can cause another type of conflict. But this pattern cannot b

Re: Conflict detection and logging in logical replication

2024-08-01 Thread Amit Kapila
On Thu, Aug 1, 2024 at 2:26 PM Hayato Kuroda (Fujitsu) wrote: > > 04. general > > According to the documentation [1], there is another constraint "exclude", > which > can cause another type of conflict. But this pattern cannot be logged in > detail. > As per docs, "exclusion constraints can spe

RE: Conflict detection and logging in logical replication

2024-08-01 Thread Hayato Kuroda (Fujitsu)
Dear Hou, Let me contribute the great feature. I read only the 0001 patch and here are initial comments. 01. logical-replication.sgml track_commit_timestamp must be specified only on the subscriber, but it is not clarified. Can you write down that? 02. logical-replication.sgml I felt that th

RE: Conflict detection and logging in logical replication

2024-07-31 Thread Zhijie Hou (Fujitsu)
On Wednesday, July 31, 2024 1:36 PM shveta malik wrote: > > On Wed, Jul 31, 2024 at 7:40 AM Zhijie Hou (Fujitsu) > > wrote: > > > > > > > > 2) > > > apply_handle_delete_internal() > > > > > > --Do we need to check "(!edata->mtstate || > > > edata->mtstate->operation != CMD_UPDATE)" in the else

Re: Conflict detection and logging in logical replication

2024-07-31 Thread Amit Kapila
On Wed, Jul 31, 2024 at 7:40 AM Zhijie Hou (Fujitsu) wrote: > > Here is the V8 patch set. It includes the following changes: > A few more comments: 1. I think in FindConflictTuple() the patch is locking the tuple so that after finding a conflict if there is a concurrent delete, it can retry to fi

Re: Conflict detection and logging in logical replication

2024-07-30 Thread shveta malik
On Wed, Jul 31, 2024 at 7:40 AM Zhijie Hou (Fujitsu) wrote: > > > > > 2) > > apply_handle_delete_internal() > > > > --Do we need to check "(!edata->mtstate || edata->mtstate->operation != > > CMD_UPDATE)" in the else part as well? Can there be a scenario where during > > update flow, it is trying

Re: Conflict detection and logging in logical replication

2024-07-30 Thread shveta malik
On Mon, Jul 29, 2024 at 11:44 AM Zhijie Hou (Fujitsu) wrote: > > Here is the V7 patch set that addressed all the comments so far[1][2][3]. Thanks for the patch, few comments: 1) build_index_value_desc() /* Assume the index has been locked */ indexDesc = index_open(indexoid, NoLoc

Re: Conflict detection and logging in logical replication

2024-07-30 Thread Dilip Kumar
On Tue, Jul 30, 2024 at 1:49 PM Zhijie Hou (Fujitsu) wrote: > > > On Monday, July 29, 2024 6:59 PM Dilip Kumar > > wrote: > > > > > > On Mon, Jul 29, 2024 at 11:44 AM Zhijie Hou (Fujitsu) > > > wrote: > > > > > > > > > > I was going through v7-0001, and I have some initial comments. > > > > Than

RE: Conflict detection and logging in logical replication

2024-07-30 Thread Zhijie Hou (Fujitsu)
> On Monday, July 29, 2024 6:59 PM Dilip Kumar > wrote: > > > > On Mon, Jul 29, 2024 at 11:44 AM Zhijie Hou (Fujitsu) > > wrote: > > > > > > > I was going through v7-0001, and I have some initial comments. > > Thanks for the comments ! > > > > > @@ -536,11 +542,9 @@ ExecCheckIndexConstraints(Re

RE: Conflict detection and logging in logical replication

2024-07-29 Thread Zhijie Hou (Fujitsu)
On Monday, July 29, 2024 6:59 PM Dilip Kumar wrote: > > On Mon, Jul 29, 2024 at 11:44 AM Zhijie Hou (Fujitsu) > wrote: > > > > I was going through v7-0001, and I have some initial comments. Thanks for the comments ! > > @@ -536,11 +542,9 @@ ExecCheckIndexConstraints(ResultRelInfo > *resultRe

Re: Conflict detection and logging in logical replication

2024-07-29 Thread shveta malik
On Mon, Jul 29, 2024 at 9:31 AM Amit Kapila wrote: > > On Fri, Jul 26, 2024 at 4:28 PM shveta malik wrote: > > > > On Fri, Jul 26, 2024 at 3:56 PM Amit Kapila wrote: > > > > > > > > One more thing we need to consider is whether we should LOG or ERROR > > > for update/delete_differ conflicts. If

Re: Conflict detection and logging in logical replication

2024-07-29 Thread Dilip Kumar
On Mon, Jul 29, 2024 at 11:44 AM Zhijie Hou (Fujitsu) wrote: > I was going through v7-0001, and I have some initial comments. @@ -536,11 +542,9 @@ ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, ExprContext *econtext; Datum values[INDEX_MAX_KEYS]; bool isnull[

Re: Conflict detection and logging in logical replication

2024-07-29 Thread Amit Kapila
On Mon, Jul 29, 2024 at 11:44 AM Zhijie Hou (Fujitsu) wrote: > > On Friday, July 26, 2024 7:34 PM Amit Kapila wrote: > > > > On Thu, Jul 25, 2024 at 4:12 PM Amit Kapila > > wrote: > > > > > > A few more comments: > > Thanks for the comments. > > > 1. > > For duplicate key, the patch reports conf

Re: Conflict detection and logging in logical replication

2024-07-28 Thread Amit Kapila
On Fri, Jul 26, 2024 at 4:28 PM shveta malik wrote: > > On Fri, Jul 26, 2024 at 3:56 PM Amit Kapila wrote: > > > > > One more thing we need to consider is whether we should LOG or ERROR > > for update/delete_differ conflicts. If we LOG as the patch is doing > > then we are intentionally overwriti

Re: Conflict detection and logging in logical replication

2024-07-26 Thread Amit Kapila
On Thu, Jul 25, 2024 at 4:12 PM Amit Kapila wrote: > > On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) > wrote: > > > > Here is the V6 patch set which addressed Shveta and Nisha's comments > > in [1][2][3][4]. > > > > Do we need an option detect_conflict for logging conflicts? The > possibl

Re: Conflict detection and logging in logical replication

2024-07-26 Thread shveta malik
On Fri, Jul 26, 2024 at 3:56 PM Amit Kapila wrote: > > On Fri, Jul 26, 2024 at 3:37 PM shveta malik wrote: > > > > On Fri, Jul 26, 2024 at 3:03 PM Nisha Moond > > wrote: > > > > > > On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) > > > wrote: > > > > Here is the V6 patch set which addres

Re: Conflict detection and logging in logical replication

2024-07-26 Thread Amit Kapila
On Fri, Jul 26, 2024 at 3:37 PM shveta malik wrote: > > On Fri, Jul 26, 2024 at 3:03 PM Nisha Moond wrote: > > > > On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) > > wrote: > > > Here is the V6 patch set which addressed Shveta and Nisha's comments > > > in [1][2][3][4]. > > > > Thanks for

Re: Conflict detection and logging in logical replication

2024-07-26 Thread shveta malik
On Fri, Jul 26, 2024 at 3:03 PM Nisha Moond wrote: > > On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) > wrote: > > Here is the V6 patch set which addressed Shveta and Nisha's comments > > in [1][2][3][4]. > > Thanks for the patch. > I tested the v6-0001 patch with partition table scenarios

Re: Conflict detection and logging in logical replication

2024-07-26 Thread Nisha Moond
On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) wrote: > Here is the V6 patch set which addressed Shveta and Nisha's comments > in [1][2][3][4]. Thanks for the patch. I tested the v6-0001 patch with partition table scenarios. Please review the following scenario where Pub updates a tuple, c

Re: Conflict detection and logging in logical replication

2024-07-25 Thread Amit Kapila
On Fri, Jul 26, 2024 at 9:39 AM shveta malik wrote: > > On Thu, Jul 11, 2024 at 7:47 AM Zhijie Hou (Fujitsu) > wrote: > > > > On Wednesday, July 10, 2024 5:39 PM shveta malik > > wrote: > > > > > > > 2) > > > Another case which might confuse user: > > > > > > CREATE TABLE t1 (pk integer primary

Re: Conflict detection and logging in logical replication

2024-07-25 Thread shveta malik
On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) wrote: > > On Monday, July 22, 2024 5:03 PM shveta malik wrote: > > > > On Fri, Jul 19, 2024 at 2:06 PM shveta malik wrote: > > > > > > On Thu, Jul 18, 2024 at 7:52 AM Zhijie Hou (Fujitsu) > > > wrote: > > > > > > > > Attach the V5 patch set

Re: Conflict detection and logging in logical replication

2024-07-25 Thread shveta malik
On Thu, Jul 11, 2024 at 7:47 AM Zhijie Hou (Fujitsu) wrote: > > On Wednesday, July 10, 2024 5:39 PM shveta malik > wrote: > > > > 2) > > Another case which might confuse user: > > > > CREATE TABLE t1 (pk integer primary key, val1 integer, val2 integer); > > > > On PUB: insert into t1 values(1,1

Re: Conflict detection and logging in logical replication

2024-07-25 Thread Amit Kapila
On Thu, Jul 25, 2024 at 12:04 PM Zhijie Hou (Fujitsu) wrote: > > Here is the V6 patch set which addressed Shveta and Nisha's comments > in [1][2][3][4]. > Do we need an option detect_conflict for logging conflicts? The possible reason to include such an option is to avoid any overhead during appl

Re: Conflict detection and logging in logical replication

2024-07-23 Thread Nisha Moond
On Thu, Jul 18, 2024 at 7:52 AM Zhijie Hou (Fujitsu) wrote: > > Attach the V5 patch set which changed the following: > Tested v5-0001 patch, and it fails to detect the update_exists conflict for a setup where Pub has a non-partitioned table and Sub has the same table partitioned. Below is a testc

  1   2   >