Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzUup-0004VK-7p for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Jul 2021 01:57:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lzUul-00063w-G2 for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Jul 2021 01:57:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzUul-00063o-4H for pgsql-hackers@lists.postgresql.org; Sat, 03 Jul 2021 01:57:51 +0000 Received: from smtp-fw-80006.amazon.com ([99.78.197.217]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lzUud-00017H-QF for pgsql-hackers@postgresql.org; Sat, 03 Jul 2021 01:57:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1625277464; x=1656813464; h=to:cc:references:from:message-id:date:mime-version: in-reply-to:subject; bh=OwrfuDi/HuJs3nZ0t9PZrzovEACTSqS+NhTfveHTjyY=; b=on63TwBIVrJD/MWLEj7QdQu3piQOpS4xBAbpCsuco3CcNxgeiGIBFko6 RKdKZGOqK+4ercJP8EL+UNOfgWy1DMCYfLaMXHmhWfzeNoREXlluslm6P jddnuH+CDTY0yBrTgoRXqNyt3nfN0g3+1o3UurKUPvfsicfJ7VKiZ64EZ o=; X-IronPort-AV: E=Sophos;i="5.83,320,1616457600"; d="scan'208,217";a="10032967" Subject: Re: relation OID in ReorderBufferToastReplace error message Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.25.36.214]) by smtp-border-fw-80006.pdx80.corp.amazon.com with ESMTP; 03 Jul 2021 01:57:40 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id 8D7DDA1CEE; Sat, 3 Jul 2021 01:57:38 +0000 (UTC) Received: from EX13D18UWA002.ant.amazon.com (10.43.160.199) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 3 Jul 2021 01:57:38 +0000 Received: from 186590ce269b.ant.amazon.com (10.43.161.172) by EX13D18UWA002.ant.amazon.com (10.43.160.199) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 3 Jul 2021 01:57:37 +0000 To: Tom Lane CC: PostgreSQL-development References: <808ed65b-994c-915a-361c-577f088b837f@amazon.com> <772142.1625191000@sss.pgh.pa.us> <48B6BE63-FE39-45B8-9AD8-819DAAC5877F@amazon.com> <777837.1625197484@sss.pgh.pa.us> From: Jeremy Schneider Message-ID: Date: Fri, 2 Jul 2021 18:57:37 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <777837.1625197484@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------EE162A19F5E3886C003A6D56" Content-Language: en-US X-Originating-IP: [10.43.161.172] X-ClientProxiedBy: EX13D24UWA004.ant.amazon.com (10.43.160.233) To EX13D18UWA002.ant.amazon.com (10.43.160.199) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --------------EE162A19F5E3886C003A6D56 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 7/1/21 20:44, Tom Lane wrote: > So I think the relation name is what to print here. That's generally > what we do, and there's not much argument for this case to be different. Works for me.  Anything in the error message is quickly and easily visible to users, without attaching debuggers or decoding WAL. A lot of PostgreSQL users won't know how to do the advanced troubleshooting, but knowing the table name might give a clue for better identifying SQL that might have been related, and could help produce better bug reports to the mailing lists in the future. Related to that, I do think it could be useful to backpatch this - we know that users are hitting this error on older versions.  Even though it's most likely that the speculative insert decoding memory leak bug will address the problem, this update still seems low-risk and useful to me just in the off-chance that someone hits the error again. > (I'm not unsympathetic to the idea that printing schema names > would be helpful. Just that here is not where to start with > that. Maybe we could consider sucking in the schema name > during relcache entry build, and then print from that copy so we > don't need an additional catalog fetch under error conditions?) Agreed not to tackle that in this thread; I wouldn't want to slow down the simple tweak that could be useful. -Jeremy diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index b8c5e2a44e..6a3a35d05d 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -4625,8 +4625,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 \"%s\")", +                        relation->rd_rel->reltoastrelid, relation->rd_rel->relname);         toast_desc = RelationGetDescr(toast_rel); -- Jeremy Schneider Database Engineer Amazon Web Services --------------EE162A19F5E3886C003A6D56 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit
On 7/1/21 20:44, Tom Lane wrote:
So I think the relation name is what to print here.  That's generally
what we do, and there's not much argument for this case to be different.

Works for me.  Anything in the error message is quickly and easily visible to users, without attaching debuggers or decoding WAL. A lot of PostgreSQL users won't know how to do the advanced troubleshooting, but knowing the table name might give a clue for better identifying SQL that might have been related, and could help produce better bug reports to the mailing lists in the future.

Related to that, I do think it could be useful to backpatch this - we know that users are hitting this error on older versions.  Even though it's most likely that the speculative insert decoding memory leak bug will address the problem, this update still seems low-risk and useful to me just in the off-chance that someone hits the error again.

(I'm not unsympathetic to the idea that printing schema names
would be helpful.  Just that here is not where to start with
that.  Maybe we could consider sucking in the schema name
during relcache entry build, and then print from that copy so we
don't need an additional catalog fetch under error conditions?)

Agreed not to tackle that in this thread; I wouldn't want to slow down the simple tweak that could be useful.

-Jeremy


diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index b8c5e2a44e..6a3a35d05d 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -4625,8 +4625,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 \"%s\")",
+                        relation->rd_rel->reltoastrelid, relation->rd_rel->relname);

        toast_desc = RelationGetDescr(toast_rel);




-- 
Jeremy Schneider
Database Engineer
Amazon Web Services
--------------EE162A19F5E3886C003A6D56--