Re: Inconsistency in reporting checkpointer stats

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Nitin Jadhav <nitinjadhavpostgres@gmail.com>, Michael Paquier <michael@paquier.xyz>
Cc: vignesh C <vignesh21@gmail.com>, Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2024-09-18T13:27:29Z
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




Commits

  1. Fix inconsistent reporting of checkpointer stats.

  2. Defer flushing of SLRU files.