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 20200428060958.GG279958@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?  (Masahiro Ikeda <ikedamsh@oss.nttdata.com>)
List pgsql-hackers
On Tue, Apr 28, 2020 at 02:49:00PM +0900, Fujii Masao wrote:
> Isn't it safer to report the wait event during fgets() rather than putting
> those calls around the whole loop, like other code does? For example,
> writeTimeLineHistory() reports the wait event during read() rather than
> whole loop.

Yeah, I/O wait events should be taken only during the duration of the
system calls.  Particularly here, you may finish with an elog() that
causes the wait event to be set longer than it should, leading to a
rather incorrect state if a snapshot of pg_stat_activity is taken.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
Next
From: Richard Guo
Date:
Subject: Pulling up sublink may break join-removal logic