Re: Simplify xlogreader.c with XLogRec* macros

From: 邱宇航 <iamqyh(at)gmail(dot)com>
To: Junwang Zhao <zhjwpku(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:42:21
Message-ID: A363791D-DC5E-40D9-8A70-0B246125255C@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> @@ -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))

Oops, I missed that. New version is attached.

--
Yuhang Qiu

Attachment Content-Type Size
v2-0001-Simplify-xlogreader.c-with-XLogRec-macros.patch application/octet-stream 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-10-31 10:45:13 Re: Synchronizing slots from primary to standby
Previous Message Laurenz Albe 2023-10-31 10:40:38 Re: Trigger violates foreign key constraint