Re: pgsql: Add a view to show the stats of subscription workers.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Amit Kapila <akapila(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Add a view to show the stats of subscription workers.
Date: 2021-11-30 08:46:22
Message-ID: CAA4eK1KL3UpM4J-q-GOAhJBW-yRM9j4ujh75esdguRSCHpWB1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Tue, Nov 30, 2021 at 12:46 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> On Tue, Nov 30, 2021 at 3:04 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
>
> FWIW, I'm still not investigating why "replication origin with OID 2
> is already active for PID 23706" occurred.
>

I think I know why this error occurred. In process 23706 (which is
doing table sync for one of the tables) after allocating replication
origin with OID 2, we have inserted the entry for same in
pg_replication_origin and associated it with that session. Now, an
expected error happened (Copy failure) which rolled back the
transaction where we allocated and inserted the origin with OID 2.
Before session 23706 could exit where we will disassociate the
replication origin state from the current process, a new process
(table sync for another table) allocated the replication origin OID 2
and tried to associate with its session where it gets the error
(replication origin with OID 2
is already active for PID 23706). The next time it tried there was no
such concurrent process to hold the OID and it succeeded. I think this
is all as per our current implementation of table sync worker. We just
need to be careful in the new test.

I'll review your patch next.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2021-11-30 09:31:17 Re: pgsql: Add a view to show the stats of subscription workers.
Previous Message Masahiko Sawada 2021-11-30 07:15:55 Re: pgsql: Add a view to show the stats of subscription workers.