Re: Inconsistency in reporting checkpointer stats

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: 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-09-18 13:27:29
Message-ID: 2ce3814b-572f-4b19-a585-080cb668bd4a@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024/07/18 16:08, Nitin Jadhav wrote:
> I apologize for not being active on this thread. However, I have now
> returned to the thread and confirmed that the inconsistency is still
> present in the latest code. I believe it’s crucial to address this
> issue, and I am currently submitting the v5 version of the patch. The
> v4 version had addressed the feedback from Bharath, Kyotaro, Andres,
> and Robert. The current version has been rebased to incorporate
> Vignesh’s suggestions. In response to Michael’s comments, I’ve moved
> the new ‘slru_written’ column from the ‘pg_stat_bgwriter’ view to the
> ‘pg_stat_checkpointer’ in the attached patch.
>
> To summarize our discussions, we’ve reached a consensus to correct the
> mismatch between the information on buffers written as displayed in
> the ‘pg_stat_checkpointer’ view and the checkpointer log message.
> We’ve also agreed to separate the SLRU buffers data from the buffers
> written and present the SLRU buffers data in a distinct field.
>
> I have created the new commitfest entry here
> https://commitfest.postgresql.org/49/5130/.
> Kindly share if any comments.

Thanks for updating the patch!

In pgstat_checkpointer.c, it looks like you missed adding
CHECKPOINTER_COMP(slru_written) in pgstat_checkpointer_snapshot_cb().

+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>slru_written</structfield> <type>bigint</type>
+ </para>
+ <para>
+ Number of SLRU buffers written during checkpoints and restartpoints
+ </para></entry>
+ </row>

This entry should be moved to the pg_stat_checkpointer documentation.

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

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 Robert Haas 2024-09-18 13:50:39 Re: access numeric data in module
Previous Message jian he 2024-09-18 13:06:00 attndims, typndims still not enforced, but make the value within a sane threshold