Re: Inconsistency in reporting checkpointer stats

From: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, vignesh C <vignesh21(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inconsistency in reporting checkpointer stats
Date: 2024-10-01 16:50:06
Message-ID: CAMm1aWaDXYBeD1LtN0cp4durB8UHkNnQFOKCcz0q=YvG4gE9FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Before committing the patch, I revised it with the following changes:
>
> - I added "shared" to the description of pg_stat_checkpointer.buffers_written
> to clarify that it tracks shared buffers.
> - In the checkpoint log message, I replaced "slru" with "SLRU" for consistency,
> as uppercase is typically used for SLRU.
> - I updated the commit message.

Thanks for updating. Looks good to me.

Best Regards,
Nitin Jadhav
Azure Database for PostgreSQL
Microsoft

On Tue, Oct 1, 2024 at 9:28 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>
>
> On 2024/10/01 3:33, Fujii Masao wrote:
> >
> >
> > On 2024/09/22 20:44, Nitin Jadhav wrote:
> >>> + CheckpointStats.ckpt_slru_written,
> >>> + (double) CheckpointStats.ckpt_slru_written * 100 / NBuffers,
> >>>
> >>> I don't think NBuffers represents the maximum number of SLRU buffers.
> >>> We might need to calculate this based on specific GUC settings,
> >>> like transaction_buffers.
> >>
> >> Great observation. Since the SLRU buffers written during a checkpoint
> >> can include transaction_buffers, commit_timestamp_buffers,
> >> subtransaction_buffers, multixact_member_buffers,
> >> multixact_offset_buffers, and serializable_buffers, the total count of
> >> SLRU buffers should be the sum of all these types. We might need to
> >> introduce a global variable, such as total_slru_count, in the
> >> globals.c file to hold this sum. The num_slots variable in the
> >> SlruSharedData structure needs to be accessed from all types of SLRU
> >> and stored in total_slru_count. This can then be used during logging
> >> to calculate the percentage of SLRU buffers written. However, I’m
> >> unsure if this effort is justified. While it makes sense for normal
> >> buffers to display the percentage, the additional code required might
> >> not provide significant value to users. Therefore, I have removed this
> >> in the attached v6 patch.
> >
> > +1
> >
> > Thanks for updating the patch! It looks good to me.
> > Barring any objections, I will commit this patch.
>
> Before committing the patch, I revised it with the following changes:
>
> - I added "shared" to the description of pg_stat_checkpointer.buffers_written
> to clarify that it tracks shared buffers.
> - In the checkpoint log message, I replaced "slru" with "SLRU" for consistency,
> as uppercase is typically used for SLRU.
> - I updated the commit message.
>
> Regards,
>
> --
> Fujii Masao
> Advanced Computing Technology Center
> Research and Development Headquarters
> NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-10-01 17:32:13 Re: pg_verifybackup: TAR format backup verification
Previous Message Tom Lane 2024-10-01 16:29:15 Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value