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 1lObC4-0002am-S3 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Mar 2021 07:11:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lObC3-0003qR-FQ for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Mar 2021 07:11:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lObC3-0003qK-8h for pgsql-hackers@lists.postgresql.org; Tue, 23 Mar 2021 07:11:11 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lObBw-0001im-4N for pgsql-hackers@postgresql.org; Tue, 23 Mar 2021 07:11:10 +0000 Received: from hnk.local (p2350207-ipbf2126funabasi.chiba.ocn.ne.jp [114.167.184.207]) by oss.nttdata.com (Postfix) with ESMTPSA id 7CE176022B; Tue, 23 Mar 2021 16:10:58 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: About to add WAL write/fsync statistics to pg_stat_wal view To: ikedamsh Cc: "David G. Johnston" , PostgreSQL-development , Masahiko Sawada , Li Japin , kuroda.hayato@fujitsu.com References: <0509ad67b585a5b86a83d445dfa75392@oss.nttdata.com> <9a70efda-6f47-8b1c-0513-419e1185000a@oss.nttdata.com> <6c8932c2b0756971e4b28f06af07be9a@oss.nttdata.com> <4a81fc95615db54b75f59759752b2cef@oss.nttdata.com> <49d412cc-2e39-a487-1861-a8560ebb88cb@oss.nttdata.com> <99fbf195e4b02a629cbf8190a0b9d47a@oss.nttdata.com> <7c08820c-06d6-0968-100a-5df71d67768b@oss.nttdata.com> <550de3c1-3408-de76-6fc1-a46eedc217a3@oss.nttdata.com> <90d8baf25655a08299185cb1a616bda1@oss.nttdata.com> <82ccde1a-ead9-598c-f472-004a01ff23e9@oss.nttdata.com> <940c12fd-96dc-67d2-afe9-dbb679eda010@oss.nttdata.com> From: Fujii Masao Message-ID: <7ec4c9af-6f1a-8be8-bce1-c111e04eee8d@oss.nttdata.com> Date: Tue, 23 Mar 2021 16:10:58 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021/03/22 20:25, ikedamsh wrote: > Agreed. Users can know whether the stats is for walreceiver or not. The > pg_stat_wal view in standby server shows for the walreceiver, and in primary > server it shows for the others. So, I updated the document. > (v20-0003-Makes-the-wal-receiver-report-WAL-statistics.patch) Thanks for updating the docs! There was the discussion about when the stats collector is invoked, at [1]. Currently during archive recovery or standby, the stats collector is invoked when the startup process reaches the consistent state, sends PMSIGNAL_BEGIN_HOT_STANDBY, and then the system is starting accepting read-only connections. But walreceiver can be invoked at earlier stage. This can cause walreceiver to generate and send the statistics about WAL writing even though the stats collector has not been running yet. This might be problematic? If so, maybe we need to ensure that the stats collector is invoked before walreceiver? During recovery, the stats collector is not invoked if hot standby mode is disabled. But walreceiver can be running in this case. So probably we should change walreceiver so that it's invoked even when hot standby is disabled? Otherwise we cannnot collect the statistics about WAL writing by walreceiver in that case. [1] https://postgr.es/m/e5a982a5-8bb4-5a10-cf9a-40dd1921bdb5@oss.nttdata.com Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION