Re: BUG #15114: logical decoding Segmentation fault

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, michael(at)paquier(dot)xyz
Cc: andres(at)anarazel(dot)de, petr(dot)jelinek(at)2ndquadrant(dot)com, pet(dot)slavov(at)gmail(dot)com, alvherre(at)alvh(dot)no-ip(dot)org, petr(at)2ndquadrant(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15114: logical decoding Segmentation fault
Date: 2019-01-28 21:32:16
Message-ID: 56d0ccb4-e9c9-1225-256d-c287adf5494e@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I have another approach for this.

Recall that the issue is ultimately that RelationGetIndexAttrBitmap()
might need a snapshot under certain circumstances, and it will crash if
there isn't one. There are actually two separate bugs, in the publisher
and in the subscriber. Some patches have been proposed in this thread
that either bypass RelationGetIndexAttrBitmap() or obtain a snapshot at
different times in the publisher or subscriber code.

My approach is to make RelationGetIndexAttrBitmap() not need a snapshot.
The whole code was overly complicated anyway, calling BuildIndexInfo()
and then throwing the result away. We can do it directly more
efficiently and avoid all the business about eval_const_expressions().
Moreover, this fixes the problem in a central place and does not require
bespoke separate fixes in the publisher and subscriber code. External
logical decoding or logical replication implementations could also be
affected and would benefit from this fix.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Fix-a-crash-in-logical-replication.patch text/plain 8.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2019-01-29 01:53:50 Re: BUG #15114: logical decoding Segmentation fault
Previous Message Bruce Momjian 2019-01-28 20:32:10 Re: Suggestion: include interruption method for \watch option (page 1922, PostgreSQL 11.1 Documentation)