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 1jRo6C-0000Js-5J for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Apr 2020 02:29:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRo6A-0007dx-Vx for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Apr 2020 02:29:50 +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 1jRo6A-0007Zy-Ol for pgsql-hackers@lists.postgresql.org; Fri, 24 Apr 2020 02:29:50 +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 1jRo67-0001C0-Nu for pgsql-hackers@postgresql.org; Fri, 24 Apr 2020 02:29:49 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTP id 7028560172 for ; Fri, 24 Apr 2020 11:29:43 +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="=_d76c83b8ed3890b2d1924b0d8d3d4645" Date: Fri, 24 Apr 2020 11:29:43 +0900 From: Masahiro Ikeda To: pgsql-hackers@postgresql.org Subject: Why are wait events not reported even though it reads/writes a timeline history file? Message-ID: 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 --=_d76c83b8ed3890b2d1924b0d8d3d4645 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed 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". In my understanding, sscanf() is blocking read.  So, it's important to report a wait event. 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(). 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. 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. Regards, -- Masahiro Ikeda NTT DATA CORPORATION --=_d76c83b8ed3890b2d1924b0d8d3d4645 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-some-wait-events-for-timeline-history-file-are-not-r.patch Content-Disposition: attachment; filename=0001-some-wait-events-for-timeline-history-file-are-not-r.patch; size=1200 RnJvbSAyZTZmMzQyMDI0YTA3NTkwMzkxMGI5NGIzNzI5MmVmZDNhYTFmM2E4IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXNhaGlybyBJa2VkYSA8aWtlZGFtc2hAb3NzLm50dGRhdGEu Y29tPgpEYXRlOiBUaHUsIDIzIEFwciAyMDIwIDE2OjI0OjA3ICswOTAwClN1YmplY3Q6IFtQQVRD SF0gc29tZSB3YWl0IGV2ZW50cyBmb3IgdGltZWxpbmUgaGlzdG9yeSBmaWxlIGFyZSBub3QgcmVw b3J0ZWQuCgotLS0KIHNyYy9iYWNrZW5kL2FjY2Vzcy90cmFuc2FtL3RpbWVsaW5lLmMgfCA0ICsr KysKIDEgZmlsZSBjaGFuZ2VkLCA0IGluc2VydGlvbnMoKykKCmRpZmYgLS1naX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