Re: Incorrect argument passed to buffer_readv_encode_error()

From: Steven Niu <niushiji(at)gmail(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>
Subject: Re: Incorrect argument passed to buffer_readv_encode_error()
Date: 2026-10-14 07:38:09
Message-ID: EAYPR19MB4817115DCA5F885E180D2F25A1A79D2@EAYPR19MB481711.namprd19.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Agree with this change:

buffer_readv_encode_error(&result_one, is_temp,
*zeroed_buffer,
*ignored_checksum,
- *buffer_invalid,
+ *buffer_invalid ? 1 : 0,
*zeroed_buffer ? 1 : 0,
*failed_checksum ? 1 : 0,
buf_off, buf_off, buf_off);

The function prototype of buffer_readv_encode_error() is,

static inline void
buffer_readv_encode_error(PgAioResult *result,
bool is_temp,
bool zeroed_any,
bool ignored_any,
uint8 error_count,
uint8 zeroed_count,
uint8 checkfail_count,
uint8 first_error_off,
uint8 first_zeroed_off,
uint8 first_ignored_off)

Apparently the error_count argument should behave same as zeroed_count and checkfail_count.

Regards,
Steven
________________________________________
From: Antonin Houska <ah(at)cybertec(dot)at>
Sent: Wednesday, October 14, 2026 14:31
To: pgsql-hackers(at)postgresql(dot)org <pgsql-hackers(at)postgresql(dot)org>
Cc: andres(at)anarazel(dot)de <andres(at)anarazel(dot)de>
Subject: Incorrect argument passed to buffer_readv_encode_error()

Although there's no compiler warning, and probably no correctness issue, I
think the intended coding was as I propose in the diff attached.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Valeriy Degtyarev 2026-10-14 07:42:28 Re: Skip prefetch for block references that follow a FPW or WILL_INIT of the same block
Previous Message Tender Wang 2026-10-14 07:34:52 Re: Assert failure in standard_join_search()