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"

From: Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Neha Sharma <neha(dot)sharma(at)enterprisedb(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: 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"
Date: 2020-01-09 10:28:39
Message-ID: CA+FpmFcJ+mFSsDXAm-AxcLALSmRTKmPAS7Ywm4hUjd8ym8yfgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 9 Jan 2020 at 08:48, Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> On Thu, Jan 9, 2020 at 12:50 PM Neha Sharma
> <neha(dot)sharma(at)enterprisedb(dot)com> wrote:
> >
> > Hi Michael,
> > Thanks for looking into the issue. Sorry by mistake I had mentioned the incorrect DML query,please use the query as mentioned below.
> >
> > On Thu, Jan 9, 2020 at 11:38 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >>
> >> On Tue, Jan 07, 2020 at 05:38:49PM +0530, Neha Sharma wrote:
> >> > I am getting a server crash on publication server on HEAD for the below
> >> > test case.
> >> >
> >> > Test case:
> >> > Publication server:
> >> > create table test(a int);
> >> > create publication test_pub for all tables;
> >> > alter table test replica identity NOTHING ;
> >> >
> >> > Subscription server:
> >> > create table test(a int);
> >> > create subscription test_sub CONNECTION 'host=172.16.208.32 port=5432
> >> > dbname=postgres user=centos' PUBLICATION test_pub WITH ( slot_name =
> >> > test_slot_sub);
> >> >
> >> > Publication server:
> >> > insert into test values(generate_series(1,5),'aa');
> >
> > insert into test values(generate_series(1,5));
> >>
> >>
> >> This would not work as your relation has only one column. There are
> >> some TAP tests for logical replication (none actually stressing
> >> NOTHING as replica identity), which do not fail, and I cannot
> >> reproduce the failure myself.
>
> 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?
>
True that.
> 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));
>
+1

--
Regards,
Rafia Sabih

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2020-01-09 10:30:14 Re: Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings
Previous Message Amit Langote 2020-01-09 10:26:58 Re: adding partitioned tables to publications