Re: [Logical Replication] TRAP: FailedAssertion("rel->rd_rel->relreplident == REPLICA_IDENTITY_DEFAULT || rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL || rel->rd_rel->relreplident == REPLICA_IDENTITY_INDEX"

Dilip Kumar <dilipbalaut@gmail.com>

From: Dilip Kumar <dilipbalaut@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael@paquier.xyz>, Neha Sharma <neha.sharma@enterprisedb.com>, Peter Eisentraut <peter_e@gmx.net>, Petr Jelinek <petr@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-01-10T02:00:34Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove incorrect assertion for INSERT in logical replication's publisher

  2. Have logical replication subscriber fire column triggers

On Thu, 9 Jan 2020 at 10:43 PM, Andres Freund <andres@anarazel.de> wrote:

> Hi,
>
> On 2020-01-09 13:17:59 +0530, Dilip Kumar wrote:
> > I am able to reproduce the failure,  I think the assert in the
> > 'logicalrep_write_insert' is not correct.  IMHO even if the replica
> > identity is set to NOTHING we should be able to replicate INSERT?
> >
> > This will fix the issue.
> >
> > diff --git a/src/backend/replication/logical/proto.c
> > b/src/backend/replication/logical/proto.c
> > index dcf7c08..471461c 100644
> > --- a/src/backend/replication/logical/proto.c
> > +++ b/src/backend/replication/logical/proto.c
> > @@ -145,7 +145,8 @@ logicalrep_write_insert(StringInfo out, Relation
> > rel, HeapTuple newtuple)
> >
> >         Assert(rel->rd_rel->relreplident == REPLICA_IDENTITY_DEFAULT ||
> >                    rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL ||
> > -                  rel->rd_rel->relreplident == REPLICA_IDENTITY_INDEX);
> > +                  rel->rd_rel->relreplident == REPLICA_IDENTITY_INDEX ||
> > +                  rel->rd_rel->relreplident ==
> REPLICA_IDENTITY_NOTHING);
> >
> >         /* use Oid as relation identifier */
> >         pq_sendint32(out, RelationGetRelid(rel));
>
> There's not much point in having this assert, right? Given that it
> covers all choices? Seems better to just drop

it.


Yeah right!
-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com