Re: BUG #15114: logical decoding Segmentation fault

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Петър Славов <pet(dot)slavov(at)gmail(dot)com>, michael(at)paquier(dot)xyz
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: Re: BUG #15114: logical decoding Segmentation fault
Date: 2018-10-28 22:59:49
Message-ID: 11af0d1b-e48f-fba3-5b1e-49886f648f52@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

This thread was brought to my attention during pgconf.eu (as I sadly
missed it).

On 04/10/2018 10:03, Петър Славов wrote:
> Hi,
> What happen here - I cannot see fix for this bug.
> I also cannot see the workaround parch in the code.
> Do I have to do something to mo e this fix forward?
>
> I think we agreed that this bug braked logical decoding or I am wrong ?
>

Yes it's definitely a bug.

Also please note that we bottom-post in PostgreSQL mailing lists.

>
> На пт, 27.04.2018 г. в 3:22 ч. Michael Paquier <michael(at)paquier(dot)xyz
> <mailto:michael(at)paquier(dot)xyz>> написа:
>
> On Fri, Apr 27, 2018 at 12:26:52AM +0200, Петър Славов wrote:
> > I tried to compile this and i had this error:
> >
> > proto.c: In function ‘logicalrep_write_attrs’:
> > proto.c:565:17: error: ‘FormData_pg_index {aka struct
> FormData_pg_index}’
> > has no member named ‘indnkeyatts’
> >     natts = index->indnkeyatts;
>
> The patch Alvaro has sent is made for the master branch, and you are
> visibly using a build of REL_10_STABLE.  Ths conflict you are seeing
> comes from 8224de4 which introduced Covering indexes, and renamed
> indnatts to indnkeyatts in Form_pg_index.
> --
> Michael
>

I wrote my own patch to solve this which is quite similar to Alvaro's
except that it does not do the manual work to build indexes list as we
already have RelationGetReplicaIndex which does all the necessary work
and also uses the same rd_idattr for cache that
RelationGetIndexAttrBitmap does, it's better for performance and looks
safe to me.

I attached both patch for PG11+ (ie master) and the backport patch for
PG10, they only differ in the line identified above as problematic.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
pg10-0001-Fix-REPLICA-IDENTITY-handling-in-logical-replication.patch text/x-patch 3.5 KB
pg11-0001-Fix-REPLICA-IDENTITY-handling-in-logical-replication.patch text/x-patch 3.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-10-29 01:54:38 Re: BUG #15114: logical decoding Segmentation fault
Previous Message Dmitry Molotkov 2018-10-27 15:39:33 Re: BUG #15446: Crash on ALTER TABLE