Re: Fix some error handling for read() and errno

Поиск
Список
Период
Сортировка
От Robbie Harwood
Тема Re: Fix some error handling for read() and errno
Дата
Msg-id jlg1sddhuev.fsf@redhat.com
обсуждение исходный текст
Ответ на Re: Fix some error handling for read() and errno  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Fix some error handling for read() and errno  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:

> diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c
> index 87942b4cca..d487347cc6 100644
> --- a/src/backend/access/transam/slru.c
> +++ b/src/backend/access/transam/slru.c
> @@ -683,6 +683,11 @@ SlruPhysicalReadPage(SlruCtl ctl, int pageno, int slotno)
>      pgstat_report_wait_start(WAIT_EVENT_SLRU_READ);
>      if (read(fd, shared->page_buffer[slotno], BLCKSZ) != BLCKSZ)
>      {
> +        /*
> +         * XXX: Note that this may actually report sucess if the number
> +         * of bytes read is positive, but lacking data so that errno is
> +         * not set.
> +         */
>          pgstat_report_wait_end();
>          slru_errcause = SLRU_READ_FAILED;
>          slru_errno = errno;

It might be less confusing to just set errno if it's not set already
(e.g., to EIO, or something).  Up to you though - this is a bit of a
niche case.

The rest of the patch looks good to me.

Thanks,
--Robbie


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Needless additional partition check in INSERT?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Fix and document lock handling for in-memory replicationslot da