From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: reporting TID/table with corruption error
Date: Thu, 19 Aug 2021 12:37:58 -0400
Message-ID: <202108191637.oqyzrdtnheir@alvherre.pgsql> (raw)
A customer recently hit this error message:
ERROR: t_xmin is uncommitted in tuple to be updated
This was not very informative, so without any clues, we had to let it
go. But it did occur to me that we can improve this message so that we
know details such as the TID and the relation that caused the issue, so
that if it ever occurs again we can at least look at the WAL stream for
anything affecting the tuple, maybe it'd help to understand the problem.
So I propose the following patch.
--
Álvaro Herrera
Attachments:report-tuple.patch (text/x-diff, 836B) downloaddiff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.cindex beb8f20708..9befe012a9 100644--- a/src/backend/access/heap/heapam_handler.c+++ b/src/backend/access/heap/heapam_handler.c@@ -424,7 +424,11 @@ tuple_lock_retry:
if (TransactionIdIsValid(SnapshotDirty.xmin))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("t_xmin is uncommitted in tuple to be updated")));+ errmsg_internal("t_xmin %u is uncommitted in tuple (%u,%u) to be updated in table \"%s\"",+ SnapshotDirty.xmin,+ ItemPointerGetBlockNumber(&tuple->t_self),+ ItemPointerGetOffsetNumber(&tuple->t_self),+ RelationGetRelationName(relation))));
/*
* If tuple is being updated by other transaction then we
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-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
Subject: Re: reporting TID/table with corruption error
In-Reply-To: <202108191637.oqyzrdtnheir@alvherre.pgsql>
* 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