pg_subscription_rel entry can be updated concurrently

Started by Masahiko Sawadaover 8 years ago4 messages
#1Masahiko Sawada
sawada.mshk@gmail.com

Hi,

I often get an error "ERROR: tuple concurrently updated" when
changing subscription state(ALTER SUBSCRIPTION or DROP SUBSCRIPTION).
The cause of this error is that table sync worker and apply worker can
try to update the same tuple in pg_subscription_rel. Especially it
often happens when we do initial copy for many tables and change it
during executing.

I think that touching the same tuple by two worker processes happens
when aborting replication for a table or a subscription, so it would
be the same result as when the worker ends up with an error. But I
think since it's not an appropriate behavior we should deal with it.
Any thoughts?

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Michael Paquier
michael.paquier@gmail.com
In reply to: Masahiko Sawada (#1)
Re: pg_subscription_rel entry can be updated concurrently

On Tue, Jun 13, 2017 at 9:52 AM, Masahiko Sawada <sawada.mshk@gmail.com> wrote:

Hi,

I often get an error "ERROR: tuple concurrently updated" when
changing subscription state(ALTER SUBSCRIPTION or DROP SUBSCRIPTION).
The cause of this error is that table sync worker and apply worker can
try to update the same tuple in pg_subscription_rel. Especially it
often happens when we do initial copy for many tables and change it
during executing.

I think that touching the same tuple by two worker processes happens
when aborting replication for a table or a subscription, so it would
be the same result as when the worker ends up with an error. But I
think since it's not an appropriate behavior we should deal with it.
Any thoughts?

Yes, this error is normally not be something that users should see. So
there is something weird around the locking of the parent objects or
in the way the catalog is updated.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Masahiko Sawada (#1)
Re: pg_subscription_rel entry can be updated concurrently

On 13/06/17 02:52, Masahiko Sawada wrote:

Hi,

I often get an error "ERROR: tuple concurrently updated" when
changing subscription state(ALTER SUBSCRIPTION or DROP SUBSCRIPTION).
The cause of this error is that table sync worker and apply worker can
try to update the same tuple in pg_subscription_rel. Especially it
often happens when we do initial copy for many tables and change it
during executing.

I think that touching the same tuple by two worker processes happens
when aborting replication for a table or a subscription, so it would
be the same result as when the worker ends up with an error. But I
think since it's not an appropriate behavior we should deal with it.
Any thoughts?

This has been already reported by tushar in different thread and it's
still on my list to fix.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Masahiko Sawada
sawada.mshk@gmail.com
In reply to: Petr Jelinek (#3)
Re: pg_subscription_rel entry can be updated concurrently

On Tue, Jun 13, 2017 at 2:55 PM, Petr Jelinek
<petr.jelinek@2ndquadrant.com> wrote:

On 13/06/17 02:52, Masahiko Sawada wrote:

Hi,

I often get an error "ERROR: tuple concurrently updated" when
changing subscription state(ALTER SUBSCRIPTION or DROP SUBSCRIPTION).
The cause of this error is that table sync worker and apply worker can
try to update the same tuple in pg_subscription_rel. Especially it
often happens when we do initial copy for many tables and change it
during executing.

I think that touching the same tuple by two worker processes happens
when aborting replication for a table or a subscription, so it would
be the same result as when the worker ends up with an error. But I
think since it's not an appropriate behavior we should deal with it.
Any thoughts?

This has been already reported by tushar in different thread and it's
still on my list to fix.

Okay, I see. I added it to the open item list.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers