Re: pg_walinspect: ReadNextXLogRecord's first_record argument

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_walinspect: ReadNextXLogRecord's first_record argument
Date: 2022-08-17 16:28:56
Message-ID: CALj2ACWWUYmgvKioBVTFy4tdjrDjDm3qmeGaG1hF0J+MP+atGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 17, 2022 at 8:52 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Wed, Aug 17, 2022 at 12:41 AM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > Agreed.
> >
> > Here's a patch (for V15 as well) fixing this bug, please review.
>
> Couldn't you simplify this further by removing the lsn argument from
> GetWALRecordInfo and using record->ReadRecPtr instead? Then
> InitXLogReaderState's second argument could be XLogRecPtr instead of
> XLogRecPtr *.

Done. XLogFindNextRecord() stores the first valid record in EndRecPtr
and the ReadRecPtr is set to InvalidXLogRecPtr by calling
XLogBeginRead(). And XLogNextRecord() sets ReadRecPtr which we can
use.

PSA v2 patches.

--
Bharath Rupireddy
RDS Open Source Databases: https://aws.amazon.com/rds/postgresql/

Attachment Content-Type Size
v2-master-Use-correct-LSN-for-error-reporting-in-pg_walinsp.patch application/octet-stream 7.4 KB
v2-PG15-Use-correct-LSN-for-error-reporting-in-pg_walinsp.patch application/octet-stream 7.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-08-17 16:53:59 Re: ICU for global collation
Previous Message Robert Haas 2022-08-17 15:22:32 Re: pg_walinspect: ReadNextXLogRecord's first_record argument