Re: pgsql: Add a view to show the stats of subscription workers. - Mailing list pgsql-committers

From Amit Kapila
Subject Re: pgsql: Add a view to show the stats of subscription workers.
Date
Msg-id CAA4eK1KL3UpM4J-q-GOAhJBW-yRM9j4ujh75esdguRSCHpWB1Q@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Add a view to show the stats of subscription workers.  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-committers
On Tue, Nov 30, 2021 at 12:46 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Tue, Nov 30, 2021 at 3:04 PM Amit Kapila <amit.kapila16@gmail.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.



pgsql-committers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: pgsql: Add a view to show the stats of subscription workers.
Next
From: Amit Kapila
Date:
Subject: Re: pgsql: Add a view to show the stats of subscription workers.