Re: Why are wait events not reported even though it reads/writes a timeline history file?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why are wait events not reported even though it reads/writes a timeline history file?
Date: 2020-05-02 02:24:07
Message-ID: 20200502022407.GC409463@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-05-02 02:29:00 Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
Previous Message Tomas Vondra 2020-05-02 00:08:18 Re: SLRU statistics