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

From Masahiro Ikeda
Subject Re: Why are wait events not reported even though it reads/writes atimeline history file?
Date
Msg-id 3480dda4f5a043d8819de9e8653dc331@oss.nttdata.com
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?  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
On 2020-04-27 12:25, Fujii Masao wrote:
> On 2020/04/24 11:29, Masahiro Ikeda wrote:
>> Hi,
>> 
>> There are two unexpected codes for me about wait events for timeline 
>> history file.
>> Please let me know your thoughts whether if we need to change.
>> 
>> 
>> 1. readTimeLineHistory() function in timeline.c
>> 
>> The readTimeLineHistory() reads a timeline history file,
>> but it doesn't report “WAIT_EVENT_TIMELINE_HISTORY_READ".
> 
> Yeah, this sounds strange.
> 
>> In my understanding, sscanf() is blocking read.
>> So, it's important to report a wait event.
> 
> Shouldn't the wait event be reported during fgets() rather than 
> sscanf()?
> 
>> 2. writeTimeLineHistory() function in timeline.c
>> 
>> The writeTimeLineHistory() function may write a timeline history file 
>> twice,
>> but it reports “WAIT_EVENT_TIMELINE_HISTORY_WRITE" only once.
>> 
>> It makes sense to report a wait event twice, because both of them use 
>> write().
> 
> Yes.
> 
>> I attached a patch to mention the code line number.
>> 
>> 
>> I checked the commit log which "WAIT_EVENT_TIMELINE_HISTORY_READ" and
>> "WAIT_EVENT_TIMELINE_HISTORY_WRITE" are committed and the discussion 
>> about it.
>> But I can't find the reason.
>> 
>> Please give me your comments.
>> If we need to change, I can make a patch to fix them.
> 
> Thanks! I agree to fix those issues.

Thanks for the comments. I attach a patch to fix those issues.
Please review it.

>> By the way, which is correct "timeline's history file" or "timeline 
>> history file"?
>> The timeline.c has both. In my understanding, the latter is correct. 
>> If so, I will modify together.
> 
> Maybe both are correct?? I have no strong opinion about this.

OK, I didn't fix it at this time.

Regards,
-- 
Masahiro Ikeda
Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: WAL usage calculation patch
Next
From: David Fetter
Date:
Subject: Re: Proposing WITH ITERATIVE