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: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Neha Sharma <neha(dot)sharma(at)enterprisedb(dot)com>
Cc: 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 07:47:59
Message-ID: CAFiTN-vUS_mYnwZ+gFRd9T-b9cTQhLoqjxQ7uKwR_tjpPEja8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

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));

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2020-01-09 08:11:33 pgsql: Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings
Previous Message Fabien COELHO 2020-01-09 07:27:28 Re: Patch to document base64 encoding