Re: Deadlock between logrep apply worker and tablesync worker

2023-02-08 Thread Peter Smith
On Fri, Feb 3, 2023 at 6:58 PM houzj.f...@fujitsu.com wrote: > > On Thursday, February 2, 2023 7:21 PM Amit Kapila > wrote: > > > > On Thu, Feb 2, 2023 at 12:05 PM houzj.f...@fujitsu.com > > wrote: > > > > > > On Tuesday, January 31, 2023 1:07 AM vignesh C > > wrote: > > > > On Mon, 30 Jan 202

Re: Deadlock between logrep apply worker and tablesync worker

2023-02-08 Thread Peter Smith
On Tue, Feb 7, 2023 at 6:46 PM houzj.f...@fujitsu.com wrote: > > On Tuesday, February 7, 2023 12:12 PM Peter Smith > wrote: > > On Fri, Feb 3, 2023 at 6:58 PM houzj.f...@fujitsu.com > > > > wrote: > > > > > ... > > > > Right, I think that case could be addressed by Tom's patch to some > > > >

RE: Deadlock between logrep apply worker and tablesync worker

2023-02-06 Thread houzj.f...@fujitsu.com
On Tuesday, February 7, 2023 12:12 PM Peter Smith wrote: > On Fri, Feb 3, 2023 at 6:58 PM houzj.f...@fujitsu.com > wrote: > > > ... > > > Right, I think that case could be addressed by Tom's patch to some > > > extent but I am thinking we should also try to analyze if we can > > > completely avoi

Re: Deadlock between logrep apply worker and tablesync worker

2023-02-06 Thread Peter Smith
On Fri, Feb 3, 2023 at 6:58 PM houzj.f...@fujitsu.com wrote: > ... > > Right, I think that case could be addressed by Tom's patch to some extent > > but > > I am thinking we should also try to analyze if we can completely avoid the > > need > > to remove origins from both processes. One idea cou

RE: Deadlock between logrep apply worker and tablesync worker

2023-02-02 Thread houzj.f...@fujitsu.com
On Thursday, February 2, 2023 7:21 PM Amit Kapila wrote: > > On Thu, Feb 2, 2023 at 12:05 PM houzj.f...@fujitsu.com > wrote: > > > > On Tuesday, January 31, 2023 1:07 AM vignesh C > wrote: > > > On Mon, 30 Jan 2023 at 17:30, vignesh C wrote: > > > > > > > I also tried to test the time of "src

Re: Deadlock between logrep apply worker and tablesync worker

2023-02-02 Thread Amit Kapila
On Thu, Feb 2, 2023 at 4:51 PM Amit Kapila wrote: > > Thanks for the tests. I also see a reduction in test time variability > with Vignesh's patch. I think we can release the locks in case the > origin is concurrently dropped as in the attached patch. I am planning > to commit this patch tomorrow

Re: Deadlock between logrep apply worker and tablesync worker

2023-02-02 Thread Amit Kapila
On Thu, Feb 2, 2023 at 12:05 PM houzj.f...@fujitsu.com wrote: > > On Tuesday, January 31, 2023 1:07 AM vignesh C wrote: > > On Mon, 30 Jan 2023 at 17:30, vignesh C wrote: > > > > I also tried to test the time of "src/test/subscription/t/002_types.pl" > before and after the patch(change the lock

RE: Deadlock between logrep apply worker and tablesync worker

2023-02-01 Thread houzj.f...@fujitsu.com
On Tuesday, January 31, 2023 1:07 AM vignesh C wrote: > On Mon, 30 Jan 2023 at 17:30, vignesh C wrote: > > > > On Mon, 30 Jan 2023 at 13:00, houzj.f...@fujitsu.com > > wrote: > > > > > > On Monday, January 30, 2023 2:32 PM Amit Kapila > wrote: > > > > > > > > On Mon, Jan 30, 2023 at 9:20 AM vig

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-30 Thread vignesh C
On Mon, 30 Jan 2023 at 17:30, vignesh C wrote: > > On Mon, 30 Jan 2023 at 13:00, houzj.f...@fujitsu.com > wrote: > > > > On Monday, January 30, 2023 2:32 PM Amit Kapila > > wrote: > > > > > > On Mon, Jan 30, 2023 at 9:20 AM vignesh C wrote: > > > > > > > > On Sat, 28 Jan 2023 at 11:26, Amit Ka

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-30 Thread vignesh C
On Mon, 30 Jan 2023 at 13:00, houzj.f...@fujitsu.com wrote: > > On Monday, January 30, 2023 2:32 PM Amit Kapila > wrote: > > > > On Mon, Jan 30, 2023 at 9:20 AM vignesh C wrote: > > > > > > On Sat, 28 Jan 2023 at 11:26, Amit Kapila wrote: > > > > > > > > One thing that looks a bit odd is that

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-30 Thread vignesh C
On Mon, 30 Jan 2023 at 13:00, houzj.f...@fujitsu.com wrote: > > On Monday, January 30, 2023 2:32 PM Amit Kapila > wrote: > > > > On Mon, Jan 30, 2023 at 9:20 AM vignesh C wrote: > > > > > > On Sat, 28 Jan 2023 at 11:26, Amit Kapila wrote: > > > > > > > > One thing that looks a bit odd is that

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-30 Thread vignesh C
On Mon, 30 Jan 2023 at 13:00, houzj.f...@fujitsu.com wrote: > > On Monday, January 30, 2023 2:32 PM Amit Kapila > wrote: > > > > On Mon, Jan 30, 2023 at 9:20 AM vignesh C wrote: > > > > > > On Sat, 28 Jan 2023 at 11:26, Amit Kapila wrote: > > > > > > > > One thing that looks a bit odd is that

RE: Deadlock between logrep apply worker and tablesync worker

2023-01-29 Thread houzj.f...@fujitsu.com
On Monday, January 30, 2023 2:32 PM Amit Kapila wrote: > > On Mon, Jan 30, 2023 at 9:20 AM vignesh C wrote: > > > > On Sat, 28 Jan 2023 at 11:26, Amit Kapila wrote: > > > > > > One thing that looks a bit odd is that we will anyway have a similar > > > check in replorigin_drop_guts() which is a

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-29 Thread Amit Kapila
On Mon, Jan 30, 2023 at 9:20 AM vignesh C wrote: > > On Sat, 28 Jan 2023 at 11:26, Amit Kapila wrote: > > > > One thing that looks a bit odd is that we will anyway have a similar > > check in replorigin_drop_guts() which is a static function and called > > from only one place, so, will it be requ

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-29 Thread vignesh C
On Fri, 27 Jan 2023 at 17:46, Amit Kapila wrote: > > On Fri, Jan 27, 2023 at 3:45 PM vignesh C wrote: > > > > On Mon, 23 Jan 2023 at 10:52, Amit Kapila wrote: > > > > > > IIRC, this is done to prevent concurrent drops of origin drop say by > > > exposed API pg_replication_origin_drop(). See the

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-29 Thread vignesh C
On Sat, 28 Jan 2023 at 11:26, Amit Kapila wrote: > > On Sat, Jan 28, 2023 at 9:36 AM houzj.f...@fujitsu.com > wrote: > > > > On Friday, January 27, 2023 8:16 PM Amit Kapila > > > > > > On Fri, Jan 27, 2023 at 3:45 PM vignesh C wrote: > > > > > > > > On Mon, 23 Jan 2023 at 10:52, Amit Kapila >

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-27 Thread Amit Kapila
On Sat, Jan 28, 2023 at 9:36 AM houzj.f...@fujitsu.com wrote: > > On Friday, January 27, 2023 8:16 PM Amit Kapila > > > > On Fri, Jan 27, 2023 at 3:45 PM vignesh C wrote: > > > > > > On Mon, 23 Jan 2023 at 10:52, Amit Kapila > > wrote: > > > > > > > > IIRC, this is done to prevent concurrent dr

RE: Deadlock between logrep apply worker and tablesync worker

2023-01-27 Thread houzj.f...@fujitsu.com
On Friday, January 27, 2023 8:16 PM Amit Kapila > > On Fri, Jan 27, 2023 at 3:45 PM vignesh C wrote: > > > > On Mon, 23 Jan 2023 at 10:52, Amit Kapila > wrote: > > > > > > IIRC, this is done to prevent concurrent drops of origin drop say by > > > exposed API pg_replication_origin_drop(). See th

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-27 Thread Amit Kapila
On Fri, Jan 27, 2023 at 3:45 PM vignesh C wrote: > > On Mon, 23 Jan 2023 at 10:52, Amit Kapila wrote: > > > > IIRC, this is done to prevent concurrent drops of origin drop say by > > exposed API pg_replication_origin_drop(). See the discussion in [1] > > related to it. If we want we can optimize

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-27 Thread vignesh C
On Mon, 23 Jan 2023 at 10:52, Amit Kapila wrote: > > IIRC, this is done to prevent concurrent drops of origin drop say by > exposed API pg_replication_origin_drop(). See the discussion in [1] > related to it. If we want we can optimize it so that we can acquire > the lock on the specific origin as

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-22 Thread Amit Kapila
On Mon, Jan 23, 2023 at 1:29 AM Tom Lane wrote: > > Another thing that has a bad smell about it is the fact that > process_syncing_tables_for_sync uses two transactions in the first > place. There's a comment there claiming that it's for crash safety, > but I can't help suspecting it's really bec

Re: Deadlock between logrep apply worker and tablesync worker

2023-01-22 Thread Amit Kapila
On Mon, Jan 23, 2023 at 1:29 AM Tom Lane wrote: > > On my machine, the src/test/subscription/t/002_types.pl test > usually takes right about 1.5 seconds: > > $ time make check PROVE_FLAGS=--timer PROVE_TESTS=t/002_types.pl > ... > [14:22:12] t/002_types.pl .. ok 1550 ms ( 0.00 usr 0.00 sys +

Deadlock between logrep apply worker and tablesync worker

2023-01-22 Thread Tom Lane
On my machine, the src/test/subscription/t/002_types.pl test usually takes right about 1.5 seconds: $ time make check PROVE_FLAGS=--timer PROVE_TESTS=t/002_types.pl ... [14:22:12] t/002_types.pl .. ok 1550 ms ( 0.00 usr 0.00 sys + 0.70 cusr 0.25 csys = 0.95 CPU) [14:22:13] I noticed how