pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use correct LSN for error reporting in pg_walinspect
Date: Thu, 18 Aug 2022 21:23:43 +0000
Message-ID: <E1oOmzO-000AXx-La@gemulon.postgresql.org> (raw)

Use correct LSN for error reporting in pg_walinspect

Usage of ReadNextXLogRecord()'s first_record parameter for error
reporting isn't always correct. For instance, in GetWALRecordsInfo()
and GetWalStats(), we're reading multiple records, and first_record
is always passed as the LSN of the first record which is then used
for error reporting for later WAL record read failures. This isn't
correct.

The correct parameter to use for error reports in case of WAL
reading failures is xlogreader->EndRecPtr. This change fixes it.

While on it, removed an unnecessary Assert in pg_walinspect code.

Reported-by: Robert Haas
Author: Bharath Rupireddy
Reviewed-by: Robert Haas
Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZAOGzPUifrcZRjFZ2vbtcw3mp-mN6UgEoEcQg6bY3OVg%40mail.g...
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d9fbb8862959912c5266364059c0abeda0c93bbf

Modified Files
--------------
contrib/pg_walinspect/pg_walinspect.c | 53 +++++++++++++++--------------------
1 file changed, 23 insertions(+), 30 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1oOmzO-000AXx-La@gemulon.postgresql.org>
Permalink:  ../E1oOmzO-000AXx-La@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oOmzO-000AXx-La@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: jdavis@postgresql.org
  Subject: Re: pgsql: Use correct LSN for error reporting in pg_walinspect
  In-Reply-To: <E1oOmzO-000AXx-La@gemulon.postgresql.org>
  References: <E1oOmzO-000AXx-La@gemulon.postgresql.org>

* 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