Re: Why are wait events not reported even though it reads/writes atimeline history file? - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Why are wait events not reported even though it reads/writes atimeline history file?
Date
Msg-id 20200502022407.GC409463@paquier.xyz
Whole thread Raw
In response to Re: Why are wait events not reported even though it reads/writes atimeline history file?  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Responses Re: Why are wait events not reported even though it reads/writes atimeline history file?
List pgsql-hackers
On Fri, May 01, 2020 at 12:04:56PM +0900, Fujii Masao wrote:
> I applied cosmetic changes to the patch (attached). Barring any objection,
> I will push this patch (also back-patch to v10 where wait-event for timeline
> file was added).

Sorry for arriving late to the party.  I have one tiny comment.

> +        pgstat_report_wait_start(WAIT_EVENT_TIMELINE_HISTORY_READ);
> +        res = fgets(fline, sizeof(fline), fd);
> +        pgstat_report_wait_end();
> +        if (ferror(fd))
> +            ereport(ERROR,
> +                    (errcode_for_file_access(),
> +                     errmsg("could not read file \"%s\": %m", path)));
> +        if (res == NULL)
> +            break;

It seems to me that there is no point to check ferror() if fgets()
does not return NULL, no?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: SLRU statistics
Next
From: Michael Paquier
Date:
Subject: Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators