From: | Robbie Harwood <rharwood(at)redhat(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | pgsql-hackers(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, magnus(at)hagander(dot)net, hlinnaka(at)iki(dot)fi |
Subject: | Re: Fix some error handling for read() and errno |
Date: | 2018-06-11 21:42:32 |
Message-ID: | jlg1sddhuev.fsf@redhat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Michael Paquier <michael(at)paquier(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-06-11 21:47:27 | Re: pgsql: Fix and document lock handling for in-memory replication slot da |
Previous Message | Alvaro Herrera | 2018-06-11 21:13:19 | Re: Needless additional partition check in INSERT? |