pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Drouvot, Bertrand <bdrouvot@amazon.com>
To: Amit Kapila <amit.kapila16@gmail.com>
To: Jeremy Schneider <schnjere@amazon.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: logical decoding bug: segfault in ReorderBufferToastReplace()
Date: Wed, 9 Jun 2021 08:07:24 +0200
Message-ID: <8d45ed72-1706-8b21-75a6-a3420bd15b04@amazon.com> (raw)
In-Reply-To: <CAA4eK1+deBBnMVPxfLuv1Aa7tuh-7e3FvnSvWTaCy4-_HPcBLg@mail.gmail.com>
References: <c41e5883-aedf-7944-010e-0b48b6c677ba@amazon.com>
	<202106042335.o64q6dui5hu2@alvherre.pgsql>
	<CAA4eK1+LG8rpwTt0F8M+JPEWMET0mP31YiGaMuEC_VCm1=8RrQ@mail.gmail.com>
	<444215b4-8fb5-6a82-a534-645abafbffb4@amazon.com>
	<CAA4eK1+deBBnMVPxfLuv1Aa7tuh-7e3FvnSvWTaCy4-_HPcBLg@mail.gmail.com>

Hi Amit,

On 6/9/21 5:33 AM, Amit Kapila wrote:
> On Wed, Jun 9, 2021 at 12:06 AM Jeremy Schneider <schnjere@amazon.com> wrote:
>> On 6/4/21 23:42, Amit Kapila wrote:
>>
>> On 2021-Jun-04, Jeremy Schneider wrote:
>>
>> ERROR: XX000: could not open relation with OID 0
>> LOCATION: ReorderBufferToastReplace, reorderbuffer.c:305
>>
>> Even, if this fixes the issue, I guess it is better to find why this
>> happens? I think the reason why the code is giving an error is that
>> after toast insertions we always expect the insert on the main table
>> of toast table, but if there happens to be a case where after toast
>> insertion, instead of getting the insertion on the main table we get
>> an insert in some other table then you will see this error. I think
>> this can happen for speculative insertions where insertions lead to a
>> toast table insert, then we get a speculative abort record, and then
>> insertion on some other table. The main thing is currently decoding
>> code ignores speculative aborts due to which such a problem can occur.
>> Now, there could be other cases where such a problem can happen but if
>> my theory is correct then the patch we are discussing in the thread
>> [1] should solve this problem.
>>
>> Jeremy, is this problem reproducible? Can we get a testcase or
>> pg_waldump output of previous WAL records?
>>
>> [1] - https://www.postgresql.org/message-id/CAExHW5sPKF-Oovx_qZe4p5oM6Dvof7_P%2BXgsNAViug15Fm99jA%40mail.g...
>>
>>
>> It's unclear to me whether or not we'll be able to catch the repro on the actual production system. It seems that we are hitting this somewhat consistently, but at irregular and infrequent intervals. If we are able to catch it and walk the WAL records then I'll post back here.
>>
> Okay, one thing you can check is if there is a usage of Insert .. On
> Conflict .. statement in the actual production system?

Yes that's the case, so that a speculative abort record followed by an 
insert on some other table looks a perfect valid scenario regarding this 
current issue.

Bertrand





view thread (21+ messages)  latest in thread

Message-ID: <8d45ed72-1706-8b21-75a6-a3420bd15b04@amazon.com>
Permalink:  ../8d45ed72-1706-8b21-75a6-a3420bd15b04@amazon.com/
Also on:    postgresql.org/message-id/8d45ed72-1706-8b21-75a6-a3420bd15b04@amazon.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: bdrouvot@amazon.com, amit.kapila16@gmail.com, schnjere@amazon.com, alvherre@alvh.no-ip.org, andres@anarazel.de, tomas.vondra@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: logical decoding bug: segfault in ReorderBufferToastReplace()
  In-Reply-To: <8d45ed72-1706-8b21-75a6-a3420bd15b04@amazon.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox