pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Li Japin <japinli@hotmail.com>
Cc: kuroda.hayato@fujitsu.com, "David G. Johnston" <david.g.johnston@gmail.com>
Subject: Re: About to add WAL write/fsync statistics to pg_stat_wal view
Date: Mon, 15 Feb 2021 11:42:25 +0900
Message-ID: <4d9a50bcb65e132c11f4a5c44870765b@oss.nttdata.com> (raw)
In-Reply-To: <6d375c1c-57a5-bd0e-f85b-0747b81ffd5d@oss.nttdata.com>
References: <0509ad67b585a5b86a83d445dfa75392@oss.nttdata.com>
	<65e99b78066ab1e3dc82a4e6f5e6f3cd@oss.nttdata.com>
	<7aef8ee6eea05a38ca91580caa5b2f07@oss.nttdata.com>
	<CAD21AoB=RCYME3+iroY+8TrC9tsHTPo7kRKCpU7C_kZ8kgGW2A@mail.gmail.com>
	<8555ab589d74ec2df61237209f4f21f2@oss.nttdata.com>
	<CAD21AoC+Z7-OAwr0RES+WgAvMmi3Uv-bh6u4W1cfS_=Z0hddqg@mail.gmail.com>
	<95c26651303d0e5227cb763061cf15dc@oss.nttdata.com>
	<d18188f83ab56a32b48e29baf920d245@oss.nttdata.com>
	<CAD21AoAMxDwey2v5tVF-3Xhu2VNUXA-9CUuZ1ZmKS3__nceJTw@mail.gmail.com>
	<afeef2fecff653f2e29d1dc5056c08a3@oss.nttdata.com>
	<CAD21AoC0B_miiA5rkk-yAac8_q6C4aVmNWFOHhE6vwNncma0Ng@mail.gmail.com>
	<CAKFQuwa7xDBXwk2nr2=+_f+=2YcwUaXC2eU7eCpokipCEBJe7A@mail.gmail.com>
	<395f109540835fabe76dbd9d45733a14@oss.nttdata.com>
	<CAKFQuwbpRk644CXZ5M_T3j3a-wb5MN-FGn5FkRQ0PvKnAmD9jg@mail.gmail.com>
	<925e940a832e96ca5d7276a4cc3dec83@oss.nttdata.com>
	<3df6e23e3e1e9cd95b08c943ef320046@oss.nttdata.com>
	<f081d50f-f20d-8706-aba3-f59cddf7a949@oss.nttdata.com>
	<6d375c1c-57a5-bd0e-f85b-0747b81ffd5d@oss.nttdata.com>

On 2021-02-08 14:26, Fujii Masao wrote:
> On 2021/02/08 13:01, Fujii Masao wrote:
>> 
>> 
>> On 2021/02/05 8:45, Masahiro Ikeda wrote:
>>> I pgindented the patches.
>> 
>> Thanks for updating the patches!
>> 
>> +       <function>XLogWrite</function>, which nomally called by an
>> +       <function>issue_xlog_fsync</function>, which nomally called by 
>> an
>> 
>> Typo: "nomally" should be "normally"?
>> 
>> +       <function>XLogFlush</function> request(see <xref 
>> linkend="wal-configuration"/>)
>> +       <function>XLogFlush</function> request(see <xref 
>> linkend="wal-configuration"/>),
>> 
>> Isn't it better to add a space character just after "request"?
>> 
>> +                    INSTR_TIME_SET_CURRENT(duration);
>> +                    INSTR_TIME_SUBTRACT(duration, start);
>> +                    WalStats.m_wal_write_time = 
>> INSTR_TIME_GET_MICROSEC(duration);
>> 
>> If several cycles happen in the do-while loop, m_wal_write_time should 
>> be
>> updated with the sum of "duration" in those cycles instead of 
>> "duration"
>> in the last cycle? If yes, "+=" should be used instead of "=" when 
>> updating
>> m_wal_write_time?
>> 
>> +            INSTR_TIME_SET_CURRENT(duration);
>> +            INSTR_TIME_SUBTRACT(duration, start);
>> +            WalStats.m_wal_sync_time = 
>> INSTR_TIME_GET_MICROSEC(duration);
>> 
>> Also "=" should be "+=" in the above?
> 
> +		/* Send WAL statistics */
> +		pgstat_send_wal();
> 
> This may cause overhead in WAL-writing by walwriter because it's called
> every cycles even when walwriter needs to write more WAL next cycle
> (don't need to sleep on WaitLatch)? If this is right, pgstat_send_wal()
> should be called only when WaitLatch() returns with WL_TIMEOUT?

Thanks, I didn't notice that.
I'll fix it.

> -       <function>XLogFlush</function> request(see <xref
> linkend="wal-configuration"/>)
> +       <function>XLogFlush</function> request(see <xref
> linkend="wal-configuration"/>),
> +       or WAL data written out to disk by WAL receiver.
> 
> So regarding walreceiver, only wal_write, wal_write_time, wal_sync, and
> wal_sync_time are updated even while the other values are not. Isn't 
> this
> confusing to users? If so, what about reporting those walreceiver stats 
> in
> pg_stat_wal_receiver?

OK, I'll add new infrastructure code to interect with wal receiver
and stats collector and show the stats in pg_stat_wal_receiver.

>  				if (endofwal)
> +				{
> +					/* Send WAL statistics to the stats collector */
> +					pgstat_send_wal();
>  					break;
> 
> You added pgstat_send_wal() so that it's called in some cases where
> walreceiver exits. But ISTM that there are other walreceiver-exit 
> cases.
> For example, in the case where SIGTERM is received. Instead,
> pgstat_send_wal() should be called in WalRcvDie() for those all cases?

Thanks, I forgot the case.
I'll fix it.

Regards,
-- 
Masahiro Ikeda
NTT DATA CORPORATION





view thread (67+ messages)  latest in thread

Message-ID: <4d9a50bcb65e132c11f4a5c44870765b@oss.nttdata.com>
Permalink:  ../4d9a50bcb65e132c11f4a5c44870765b@oss.nttdata.com/
Also on:    postgresql.org/message-id/4d9a50bcb65e132c11f4a5c44870765b@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: ikedamsh@oss.nttdata.com, masao.fujii@oss.nttdata.com, sawada.mshk@gmail.com, japinli@hotmail.com, david.g.johnston@gmail.com
  Subject: Re: About to add WAL write/fsync statistics to pg_stat_wal view
  In-Reply-To: <4d9a50bcb65e132c11f4a5c44870765b@oss.nttdata.com>
  References: <0509ad67b585a5b86a83d445dfa75392@oss.nttdata.com> <CAD21AoB=RCYME3+iroY+8TrC9tsHTPo7kRKCpU7C_kZ8kgGW2A@mail.gmail.com> <8555ab589d74ec2df61237209f4f21f2@oss.nttdata.com> <CAD21AoC+Z7-OAwr0RES+WgAvMmi3Uv-bh6u4W1cfS_=Z0hddqg@mail.gmail.com> <95c26651303d0e5227cb763061cf15dc@oss.nttdata.com> <d18188f83ab56a32b48e29baf920d245@oss.nttdata.com> <CAD21AoAMxDwey2v5tVF-3Xhu2VNUXA-9CUuZ1ZmKS3__nceJTw@mail.gmail.com> <afeef2fecff653f2e29d1dc5056c08a3@oss.nttdata.com> <CAD21AoC0B_miiA5rkk-yAac8_q6C4aVmNWFOHhE6vwNncma0Ng@mail.gmail.com> <CAKFQuwa7xDBXwk2nr2=+_f+=2YcwUaXC2eU7eCpokipCEBJe7A@mail.gmail.com> <395f109540835fabe76dbd9d45733a14@oss.nttdata.com> <CAKFQuwbpRk644CXZ5M_T3j3a-wb5MN-FGn5FkRQ0PvKnAmD9jg@mail.gmail.com> <925e940a832e96ca5d7276a4cc3dec83@oss.nttdata.com> <3df6e23e3e1e9cd95b08c943ef320046@oss.nttdata.com> <f081d50f-f20d-8706-aba3-f59cddf7a949@oss.nttdata.com> <6d375c1c-57a5-bd0e-f85b-0747b81ffd5d@oss.nttdata.com> <4d9a50bcb65e132c11f4a5c44870765b@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox