Re: wal stats questions

From: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>
To: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, pgsql-hackers(at)postgresql(dot)org, andres(at)anarazel(dot)de, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Subject: Re: wal stats questions
Date: 2021-04-21 09:31:24
Message-ID: 41c0d67b-d190-dcc2-f4a0-4678600787cf@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/04/21 15:08, torikoshia wrote:
> 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!

Hi, thanks for your comments!

> 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.

Right, I fixed it.

> 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.

Agreed.

> 234 + * set the counters related to generated WAL data if the
> counters are
>
>
> set -> Set?

Yes, I fixed.

> BTW, is it better to change PgStat_Counter from int64 to uint64 because> there aren't any counters with negative number?

Although this is not related to torikoshi-san's comment, the above my
understanding is not right. Some counters like delta_live_tuples,
delta_dead_tuples and changed_tuples can be negative.

Regards,
--
Masahiro Ikeda
NTT DATA CORPORATION

Attachment Content-Type Size
v5-0001-performance-improvements-of-reporting-wal-stats-without-introducing-a-new-variable.patch text/x-patch 12.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-04-21 09:36:03 Re: Replication slot stats misgivings
Previous Message Amit Kapila 2021-04-21 09:19:58 Re: Replication slot stats misgivings