Re: Single transaction in the tablesync worker?

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, Petr Jelinek <petr(dot)jelinek(at)enterprisedb(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Single transaction in the tablesync worker?
Date: 2021-02-24 07:16:34
Message-ID: CAD21AoA7ZEfsOXQ9HQqMv3QYGsEm2H5Wk5ic5S=mvzDf-3a3SA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 12, 2021 at 2:49 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, Feb 12, 2021 at 10:08 AM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
> >
> > On Fri, Feb 12, 2021 at 2:46 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > >
> > > Thanks, I have pushed the patch but getting one failure:
> > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=thorntail&dt=2021-02-12%2002%3A28%3A12
> > >
> > > The reason seems to be that we are trying to connect and
> > > max_wal_senders is set to zero. I think we can write this without
> > > trying to connect. The attached patch fixes the problem for me. What
> > > do you think?
> >
> > Verified this with installcheck and modified configuration to have
> > wal_level = minimal and max_wal_senders = 0.
> > Tests passed. The changes look good to me.
> >
>
> Thanks, I have pushed the fix and the latest run of 'thorntail' has passed.

I got the following WARNING message from a logical replication apply worker:

WARNING: relcache reference leak: relation "pg_subscription_rel" not closed

The cause of this is that GetSubscriptionRelState() doesn't close the
relation in SUBREL_STATE_UNKNOWN case. It seems that commit ce0fdbfe9
forgot to close it. I've attached the patch to fix this issue.

Here is a reproducible step:

1. On both publisher and subscriber:
create table test (a int primary key);

2. On publisher:
create publication test_pub for table test;

3. On subscriber:
create subscription test_sub connection 'dbname=postgres' publication test_pub";
-- wait until table sync finished
drop table test;
create table test (a int primary key);

From this point, you will get the WARNING message when doing
insert/update/delete/truncate to 'test' table on the publisher.

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

Attachment Content-Type Size
fix_relcache_leak.patch application/octet-stream 443 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-02-24 07:18:51 Re: doc review for v14
Previous Message Fujii Masao 2021-02-24 07:14:05 Re: About to add WAL write/fsync statistics to pg_stat_wal view