Re: wal stats questions

torikoshia <torikoshia@oss.nttdata.com>

From: torikoshia <torikoshia@oss.nttdata.com>
To: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>, pgsql-hackers@postgresql.org, andres@anarazel.de, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: 2021-04-21T06:08:48Z
Lists: pgsql-hackers
On 2021-04-16 10:27, Masahiro Ikeda wrote:
> On 2021/04/13 9:33, Fujii Masao wrote:
>> 
>> 
>> On 2021/03/30 20:37, Masahiro Ikeda wrote:
>>> OK, I added the condition to the fast-return check. I noticed that I
>>> misunderstood that the purpose is to avoid expanding a clock check 
>>> using WAL
>>> stats counters. But, the purpose is to make the conditions stricter, 
>>> right?
>> 
>> Yes. Currently if the following condition is false even when the WAL 
>> counters
>> are updated, nothing is sent to the stats collector. But with your 
>> patch,
>> in this case the WAL stats are sent.
>> 
>>     if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0) &&
>>         pgStatXactCommit == 0 && pgStatXactRollback == 0 &&
>>         !have_function_stats && !disconnect)
>> 
>> Thanks for the patch! It now fails to be applied to the master 
>> cleanly.
>> So could you rebase the patch?
> 
> Thanks for your comments!
> I rebased it.

Thanks for working on this!

I have some minor comments on 
performance-improvements-of-reporting-wal-stats-without-introducing-a-new-variable.patch.


177 @@ -3094,20 +3066,33 @@ pgstat_report_wal(void)
178   * Return true if the message is sent, and false otherwise.

Since you changed the return value to void, it seems the description is
not necessary anymore.

208 +        * generate wal records. 'wal_writes' and 'wal_sync' are 
zero means the

It may be better to change 'wal_writes' to 'wal_write' since single
quotation seems to mean variable name.

234 +        * set the counters related to generated WAL data if the 
counters are


set -> Set?


Regards,



Commits

  1. Fix issues in pg_stat_wal.

  2. Change data type of counters in BufferUsage and WalUsage from long to int64.