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

From: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: 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-04-28 08:42:32
Message-ID: 24cc681e7048f984e490f5d01f7ead19@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-04-28 15:09, Michael Paquier wrote:
> 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.
> --

Thanks for your comments.

I fixed it to report the wait event during fgets() only.
Please review the v2 patch I attached.

Regard,
--
Masahiro Ikeda

Attachment Content-Type Size
v2-0001-Fix-to-report-wait-events-about-timeline-history-.patch text/x-diff 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Benjamin Schaller 2020-04-28 08:43:27 Raw device on PostgreSQL
Previous Message Kyotaro Horiguchi 2020-04-28 08:18:15 Re: [HACKERS] Restricting maximum keep segments by repslots