Re: Replica Identity check of partition table on subscriber

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: Re: Replica Identity check of partition table on subscriber
Date: 2022-06-09 13:34:29
Message-ID: CA+HiwqF=sCoPy_tVkKh4QU4G0fkTOjZb2LZ2aR4n2KednZY=mA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

On Thu, Jun 9, 2022 at 8:02 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Wed, Jun 8, 2022 at 2:17 PM shiy(dot)fnst(at)fujitsu(dot)com
> <shiy(dot)fnst(at)fujitsu(dot)com> wrote:
> > I saw a problem in logical replication, when the target table on subscriber is a
> > partitioned table, it only checks whether the Replica Identity of partitioned
> > table is consistent with the publisher, and doesn't check Replica Identity of
> > the partition.
> ...
> >
> > It caused an assertion failure on subscriber:
> > TRAP: FailedAssertion("OidIsValid(idxoid) || (remoterel->replident == REPLICA_IDENTITY_FULL)", File: "worker.c", Line: 2088, PID: 1616523)
> >
> > The backtrace is attached.
> >
> > We got the assertion failure because idxoid is invalid, as table child has no
> > Replica Identity or Primary Key. We have a check in check_relation_updatable(),
> > but what it checked is table tbl (the parent table) and it passed the check.
> >
>
> I can reproduce the problem. This seems to be the problem since commit
> f1ac27bf (Add logical replication support to replicate into
> partitioned tables), so adding Amit L. and Peter E.

Thanks, I can see the problem.

I have looked at other mentioned problems with the code too and agree
they look like bugs.

Both patches look to be on the right track to fix the issues, but will
look more closely to see if I've anything to add.

--
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-06-09 13:40:29 Re: BTMaxItemSize seems to be subtly incorrect
Previous Message Peter Eisentraut 2022-06-09 13:33:53 Re: