Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-21 Thread Amit Kapila
On Thu, May 20, 2021 at 12:46 PM tanghy.f...@fujitsu.com wrote: > > On Thursday, May 20, 2021 3:05 PM, Amit Kapila > wrote: > > Okay, I have prepared the patches for all branches (11...HEAD). Each > > version needs minor changes in the test, the code doesn't need much > > change. Some notable ch

RE: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-20 Thread tanghy.f...@fujitsu.com
On Thursday, May 20, 2021 3:05 PM, Amit Kapila wrote: > Okay, I have prepared the patches for all branches (11...HEAD). Each > version needs minor changes in the test, the code doesn't need much > change. Some notable changes in the tests: > 1. I have removed the conf change for max_logical_replic

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-19 Thread Amit Kapila
On Tue, May 18, 2021 at 6:52 AM Peter Smith wrote: > > > > > Yeah, have you checked it in the back branches? > > > > Yes, the apply_handle_truncate function was introduced in April/2018 [1]. > > REL_11_0 was tagged in Oct/2018. > > The "ERROR: deadlock detected" log is reproducible in PG 11.0. >

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Amit Kapila
On Tue, May 18, 2021 at 6:19 AM Peter Smith wrote: > > On Mon, May 17, 2021 at 8:13 PM Amit Kapila wrote: > > > > On Mon, May 17, 2021 at 3:05 PM Dilip Kumar wrote: > > > > > > On Mon, May 17, 2021 at 12:30 PM Peter Smith > > > wrote: > > > > > > > PSA a patch adding a test for this scenario.

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Peter Smith
On Mon, May 17, 2021 at 6:47 PM Amit Kapila wrote: > > On Mon, May 17, 2021 at 12:30 PM Peter Smith wrote: > > [...] > > The essence of the trouble seems to be that the apply_handle_truncate > > function never anticipated it may end up truncating the same table > > from 2 separate workers (subscr

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Peter Smith
On Mon, May 17, 2021 at 8:13 PM Amit Kapila wrote: > > On Mon, May 17, 2021 at 3:05 PM Dilip Kumar wrote: > > > > On Mon, May 17, 2021 at 12:30 PM Peter Smith wrote: > > > > > PSA a patch adding a test for this scenario. > > > > I am not sure this test case is exactly targeting the problematic >

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Dilip Kumar
On Mon, May 17, 2021 at 3:43 PM Amit Kapila wrote: > > On Mon, May 17, 2021 at 3:05 PM Dilip Kumar wrote: > > > > On Mon, May 17, 2021 at 12:30 PM Peter Smith wrote: > > > > > PSA a patch adding a test for this scenario. > > > > I am not sure this test case is exactly targeting the problematic >

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Amit Kapila
On Mon, May 17, 2021 at 3:05 PM Dilip Kumar wrote: > > On Mon, May 17, 2021 at 12:30 PM Peter Smith wrote: > > > PSA a patch adding a test for this scenario. > > I am not sure this test case is exactly targeting the problematic > behavior because that will depends upon the order of execution of t

RE: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread tanghy.f...@fujitsu.com
On Monday, May 17, 2021 5:47 PM, Amit Kapila wrote > +$node_publisher->safe_psql('postgres', > + "ALTER SYSTEM SET synchronous_standby_names TO 'any 2(sub5_1, > sub5_2)'"); > +$node_publisher->safe_psql('postgres', "SELECT pg_reload_conf()"); > > Do you really need these steps to reproduce the pr

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Dilip Kumar
On Mon, May 17, 2021 at 12:30 PM Peter Smith wrote: > The essence of the trouble seems to be that the apply_handle_truncate > function never anticipated it may end up truncating the same table > from 2 separate workers (subscriptions) like this test case is doing. > Probably this is quite an old

Re: "ERROR: deadlock detected" when replicating TRUNCATE

2021-05-17 Thread Amit Kapila
On Mon, May 17, 2021 at 12:30 PM Peter Smith wrote: > > While doing logical replication testing we encountered a problem which > causes a deadlock error to be logged when replicating a TRUNCATE > simultaneously to 2 Subscriptions. > e.g. > -- > 2021-05-12 11:30:19.457 AEST [11393] ERROR: