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 1l4IH6-0001nJ-OS for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2021 06:56:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4IH5-0002pP-MT for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Jan 2021 06:56:27 +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 1l4IH5-0002pF-Fk for pgsql-hackers@lists.postgresql.org; Tue, 26 Jan 2021 06:56:27 +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 1l4IH3-0002eY-1S for pgsql-hackers@postgresql.org; Tue, 26 Jan 2021 06:56:26 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTP id 13E576028D; Tue, 26 Jan 2021 15:56:22 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 26 Jan 2021 15:56:22 +0900 From: Masahiro Ikeda To: "David G. Johnston" Cc: Masahiko Sawada , PostgreSQL-development , Li Japin , kuroda.hayato@fujitsu.com Subject: Re: About to add WAL write/fsync statistics to pg_stat_wal view In-Reply-To: References: <0509ad67b585a5b86a83d445dfa75392@oss.nttdata.com> <65e99b78066ab1e3dc82a4e6f5e6f3cd@oss.nttdata.com> <7aef8ee6eea05a38ca91580caa5b2f07@oss.nttdata.com> <8555ab589d74ec2df61237209f4f21f2@oss.nttdata.com> <95c26651303d0e5227cb763061cf15dc@oss.nttdata.com> Message-ID: <395f109540835fabe76dbd9d45733a14@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 Hi, David. Thanks for your comments. On 2021-01-26 08:48, David G. Johnston wrote: > On Mon, Jan 25, 2021 at 8:03 AM Masahiko Sawada > wrote: > >> On Mon, Jan 25, 2021 at 4:51 PM Masahiro Ikeda >> wrote: >>> >>> Hi, thanks for the reviews. >>> >>> I updated the attached patch. >> >> Thank you for updating the patch! > > Your original email with "total number of times" is more correct, > removing the "of times" and just writing "total number of WAL" is not > good wording. > > Specifically, this change is strictly worse than the original. > > - Number of times WAL data was written to disk because WAL > buffers became full > + Total number of WAL data written to disk because WAL buffers > became full > > Both have the flaw that they leave implied exactly what it means to > "write WAL to disk". It is also unclear whether a counter, bytes, or > both, would be more useful here. I've incorporated this into my > documentation suggestions below: > (wal_buffers_full) > > -- Revert - the original was better, though maybe add more detail > similar to the below. I didn't research exactly how this works. OK, I understood. I reverted since this is a counter statistics. > (wal_write) > The number of times WAL buffers were written out to disk via XLogWrite > Thanks. I thought it's better to omit "The" and "XLogWrite" because other views' description omits "The" and there is no description of "XlogWrite" in the documents. What do you think? > -- Seems like this should have a bytes version too Do you mean that we need to separate statistics for wal write? > (wal_write_time) > The amount of time spent writing WAL buffers to disk, excluding sync > time unless the wal_sync_method is either open_datasync or open_sync. > Units are in milliseconds with microsecond resolution. This is zero > when track_wal_io_timing is disabled. Thanks, I'll fix it. > (wal_sync) > The number of times WAL files were synced to disk while > wal_sync_method was set to one of the "sync at commit" options (i.e., > fdatasync, fsync, or fsync_writethrough). Thanks, I'll fix it. > -- it is not going to be zero just because those settings are > presently disabled as they could have been enabled at some point since > the last time these statistics were reset. Right, your description is correct. The "track_wal_io_timing" has the same limitation, doesn't it? > (wal_sync_time) > The amount of time spent syncing WAL files to disk, in milliseconds > with microsecond resolution. This requires setting wal_sync_method to > one of the "sync at commit" options (i.e., fdatasync, fsync, or > fsync_writethrough). Thanks, I'll fix it. I will add the comments related to "track_wal_io_timing". > Also, > > I would suggest extracting the changes to postmaster/pgstat.c and > replication/walreceiver.c to a separate patch as you've fundamentally > changed how it behaves with regards to that function and how it > interacts with the WAL receiver. That seems an entirely separate > topic warranting its own patch and discussion. OK, I will separate two patches. On 2021-01-26 08:52, David G. Johnston wrote: > On Mon, Jan 25, 2021 at 4:37 PM Masahiro Ikeda > wrote: > >> I agree with your comments. I think it should report when >> reaching the end of WAL too. I add the code to report the stats >> when finishing the current WAL segment file when timeout in the >> main loop and when reaching the end of WAL. > > The following is not an improvement: > > - /* Send WAL statistics to the stats collector. */+ /* Send WAL > statistics to stats collector */ > > The word "the" there makes it proper English. Your copy-pasting > should have kept the existing good wording in the other locations > rather than replace the existing location with the newly added > incorrect wording. Thanks, I'll fix it. > This doesn't make sense: > > * current WAL segment file to avoid loading stats collector. > > Maybe "overloading" or "overwhelming"? > > I see you removed the pgstat_send_wal(force) change. The rest of my > comments on the v6 patch still stand I believe. Yes, "overloading" is right. Thanks. Regards, -- Masahiro Ikeda NTT DATA CORPORATION