relation OID in ReorderBufferToastReplace error message
Jeremy Schneider <schnjere@amazon.com>
From: Jeremy Schneider <schnjere@amazon.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-07-02T01:25:58Z
Lists: pgsql-hackers
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.gmail.com 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 100644 --- 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
Commits
-
Back-patch "Add parent table name in an error in reorderbuffer.c."
- 4d3147070545 9.6.24 landed
- 13e52d7c5533 10.19 landed
- d61cdad0b524 11.14 landed
- 4048fc458175 12.9 landed
- 23469b867ac0 13.5 landed
- 9e84f6a72133 14.1 landed
-
Add parent table name in an error in reorderbuffer.c.
- 5e77625b260a 15.0 landed
-
Fix reorder buffer memory accounting for toast changes.
- df3640e5293d 15.0 cited
-
Add logical change details to logical replication worker errcontext.
- abc0910e2e0a 15.0 cited
-
Fix toast rewrites in logical decoding.
- 29b590547028 15.0 cited
-
Add error codes to some corruption log messages
- fd6ec93bf890 13.0 cited