From: Jeremy Schneider <schnjere@amazon.com>
To: Andres Freund <andres@anarazel.de>
To: Drouvot, Bertrand <bdrouvot@amazon.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: logical decoding bug: segfault in ReorderBufferToastReplace()
Date: Fri, 4 Jun 2021 16:07:02 -0700
Message-ID: <c41e5883-aedf-7944-010e-0b48b6c677ba@amazon.com> (raw)
In-Reply-To: <81182626-e836-061f-8f19-204edac18922@amazon.com>
References: <E1i74JE-00024V-9J@gemulon.postgresql.org>
<b1da9abc-bad7-efd6-2f1c-503d508c3877@amazon.com>
<20191205133836.lulisfo2fphdrjp3@development>
<EEB686D3-F8A7-4371-9A96-5DF3B72A7734@amazon.com>
<20191211163522.t2ljtydarlmusoix@alap3.anarazel.de>
<81182626-e836-061f-8f19-204edac18922@amazon.com>
On 12/13/19 16:13, Jeremy Schneider wrote:
> On 12/11/19 08:35, Andres Freund wrote:
>> Seems like we clearly should add an elog(ERROR) here, so we error out,
>> rather than crash.
> done - in the commit that I replied to when I started this thread :)
>
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=69f883fef14a3fc5849126799278abcc4...
Another PostgreSQL user ran into this issue. This time on version 12.5 -
so instead of a crash they got the error message from the commit.
ERROR: XX000: could not open relation with OID 0
LOCATION: ReorderBufferToastReplace, reorderbuffer.c:305
Upon seeing this error message, I realized that the base relation OID
would be very useful when the toast relation OID is "0".
Would this patch work to show that?
diff --git a/src/backend/replication/logical/reorderbuffer.c
b/src/backend/replication/logical/reorderbuffer.c
index 2d9e1279bb..b90603b051 100644inline patch 1: src/backend/replication/logical/reorderbuffer.c (+0/-0 lines) download inline-1.patch--- a/src/backend/replication/logical/reorderbuffer.c+++ b/src/backend/replication/logical/reorderbuffer.c@@ -4598,8 +4598,8 @@ ReorderBufferToastReplace(ReorderBuffer *rb,ReorderBufferTXN *txn,
toast_rel = RelationIdGetRelation(relation->rd_rel->reltoastrelid);
if (!RelationIsValid(toast_rel))
- elog(ERROR, "could not open relation with OID %u",
- relation->rd_rel->reltoastrelid);
+ elog(ERROR, "could not open toast relation with OID %u
(base relation with OID %u)",
+ relation->rd_rel->reltoastrelid,
relation->rd_rel->oid);
toast_desc = RelationGetDescr(toast_rel);
Thoughts?
-Jeremy
--
Jeremy Schneider
Database Engineer
Amazon Web Services
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: schnjere@amazon.com, andres@anarazel.de, bdrouvot@amazon.com, tomas.vondra@2ndquadrant.com, pgsql-hackers@postgresql.org
Subject: Re: logical decoding bug: segfault in ReorderBufferToastReplace()
In-Reply-To: <c41e5883-aedf-7944-010e-0b48b6c677ba@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