From: Drouvot, Bertrand <bdrouvot@amazon.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Subject: Add information to rm_redo_error_callback()
Date: Tue, 4 Aug 2020 17:37:05 +0200
Message-ID: <c31e2cba-efda-762c-f4ad-5c25e5dac3d0@amazon.com> (raw)
Hi hackers,
I've attached a small patch to add information to rm_redo_error_callback().
The changes attached in this patch came while working on the "Add
information during standby recovery conflicts" patch (See [1]).
The goal is to add more information during the callback (if doable), so
that something like:
2020-08-04 14:42:57.545 UTC [15459] CONTEXT: WAL redo at 0/4A3B0DE0 for
Heap2/CLEAN: remxid 1168
would get extra information that way:
2020-08-04 14:42:57.545 UTC [15459] CONTEXT: WAL redo at 0/4A3B0DE0 for
Heap2/CLEAN: remxid 1168, blkref #0: rel 1663/13586/16850 fork main blk 0
As this could be useful outside of [1], a dedicated "sub" patch has been
created (thanks Sawada for the suggestion).
I will add this patch to the next commitfest. I look forward to your
feedback about the idea and/or implementation.
Regards,
Bertrand
[1]: https://commitfest.postgresql.org/29/2604Attachments:v1-0001-improve-rm_redo_error_callback.patch (text/plain, 1022B) download
src/backend/access/transam/xlog.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.cindex 55cac186dc..cf3267a347 100644--- a/src/backend/access/transam/xlog.c+++ b/src/backend/access/transam/xlog.c@@ -11745,10 +11745,22 @@ rm_redo_error_callback(void *arg)
{
XLogReaderState *record = (XLogReaderState *) arg;
StringInfoData buf;
+ int block_id;+ RelFileNode rnode;+ ForkNumber forknum;+ BlockNumber blknum;
initStringInfo(&buf);
xlog_outdesc(&buf, record);
+ for (block_id = 0; block_id <= record->max_block_id; block_id++)+ {+ if (XLogRecGetBlockTag(record, block_id, &rnode, &forknum, &blknum))+ appendStringInfo(&buf,", blkref #%d: rel %u/%u/%u fork %s blk %u",+ block_id, rnode.spcNode, rnode.dbNode,+ rnode.relNode, forkNames[forknum],+ blknum);+ }
/* translator: %s is a WAL record description */
errcontext("WAL redo at %X/%X for %s",
(uint32) (record->ReadRecPtr >> 32),
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: bdrouvot@amazon.com, masahiko.sawada@2ndquadrant.com
Subject: Re: Add information to rm_redo_error_callback()
In-Reply-To: <c31e2cba-efda-762c-f4ad-5c25e5dac3d0@amazon.com>
References: <c31e2cba-efda-762c-f4ad-5c25e5dac3d0@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