Re: Simplify xlogreader.c with XLogRec* macros

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: 邱宇航 <iamqyh(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, tmunro(at)postgresql(dot)org
Subject: Re: Simplify xlogreader.c with XLogRec* macros
Date: 2023-10-31 10:24:51
Message-ID: CAEG8a3+S56ZyCjiAzWZnJytKA_m7M+SctFD32cigpEH_ifxxBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 31, 2023 at 5:23 PM 邱宇航 <iamqyh(at)gmail(dot)com> wrote:
>
> Hello hackers,
>
> Commit 3f1ce97 refactored XLog record access macros, but missed in a few places. I fixed this, and patch is attached.
>
> --
> Yuhang Qiu
>
>
>

@@ -2036,8 +2035,8 @@ RestoreBlockImage(XLogReaderState *record, uint8
block_id, char *page)
char *ptr;
PGAlignedBlock tmp;

- if (block_id > record->record->max_block_id ||
- !record->record->blocks[block_id].in_use)
+ if (block_id > XLogRecMaxBlockId(record) ||
+ !XLogRecGetBlock(record, block_id)->in_use)

I thought these can also be rewrite to:

if (!XLogRecHasBlockRef(record, block_id))

--
Regards
Junwang Zhao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-10-31 10:30:00 Re: A recent message added to pg_upgade
Previous Message shveta malik 2023-10-31 09:37:41 Re: Synchronizing slots from primary to standby