Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTFhJ-0000gd-Q7 for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Apr 2020 02:10:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTFhI-0002L2-Nt for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Apr 2020 02:10:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTFhI-0002Kv-Ge for pgsql-hackers@lists.postgresql.org; Tue, 28 Apr 2020 02:10:08 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTFhE-0002WK-Eb for pgsql-hackers@postgresql.org; Tue, 28 Apr 2020 02:10:07 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTP id 6B3436069F; Tue, 28 Apr 2020 11:10:00 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at oss.nttdata.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_995f43f451ddecfba914e5610344bda7" Date: Tue, 28 Apr 2020 11:10:00 +0900 From: Masahiro Ikeda To: Fujii Masao Cc: pgsql-hackers@postgresql.org Subject: Re: Why are wait events not reported even though it reads/writes a timeline history file? In-Reply-To: References: Message-ID: <3480dda4f5a043d8819de9e8653dc331@oss.nttdata.com> X-Sender: ikedamsh@oss.nttdata.com User-Agent: Roundcube Webmail/1.1.9 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_995f43f451ddecfba914e5610344bda7 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed 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 --=_995f43f451ddecfba914e5610344bda7 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-Fix-to-report-wait-events-about-timeline-history-fil.patch Content-Disposition: attachment; filename=0001-Fix-to-report-wait-events-about-timeline-history-fil.patch; size=1681 RnJvbSA5ZTUxNjU2NzM3MTRiOTI5YTc2YmYzOTc5MmYwNGVhNWUzNDhmMGEzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXNhaGlybyBJa2VkYSA8aWtlZGFtc2hAbnR0ZGF0Y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