From: Jeremy Schneider <schnjere@amazon.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: relation OID in ReorderBufferToastReplace error message
Date: Thu, 1 Jul 2021 18:25:58 -0700
Message-ID: <808ed65b-994c-915a-361c-577f088b837f@amazon.com> (raw)
I've recently been working with a PostgreSQL database where we saw
ReorderBufferToastReplace() fail due to a reltoastrelid value of 0. In
the original thread, Amit pointed out a connection to the speculative
insert decoding memory leak bug. Bertrand built a test case confirming
that a speculative abort record followed by an insert on another table
would in fact produce the error message from ReorderBufferToastReplace()
that we had seen, and accordingly we're pretty sure that was the root
cause in this particular database.
https://www.postgresql.org/message-id/5f9a118e-86c5-d4f1-b584-199a33757cd4%40amazon.com
Nonetheless, in the process of troubleshooting it occurred to me that
this error message would be more useful in general if it included the
base relation OID in the error message. Amit suggested a separate thread
- so here we are. :)
https://www.postgresql.org/message-id/CAA4eK1%2BdeBBnMVPxfLuv1Aa7tuh-7e3FvnSvWTaCy4-_HPcBLg%40mail.g...
Anyone have thoughts? Would I need a commitfest entry to propose a
two-line tweak like this?
-Jeremy
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);
--
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: schnjere@amazon.com
Subject: Re: relation OID in ReorderBufferToastReplace error message
In-Reply-To: <808ed65b-994c-915a-361c-577f088b837f@amazon.com>
References: <808ed65b-994c-915a-361c-577f088b837f@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