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>
Cc: Michael Paquier <michael@paquier.xyz>, vignesh C <vignesh21@gmail.com>,
Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2024-10-01T15:58:08Z
Lists: pgsql-hackers
Attachments
- v7-0001-Fix-inconsistent-reporting-of-checkpointer-stats.patch (text/plain) patch v7-0001
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
Commits
-
Fix inconsistent reporting of checkpointer stats.
- 17cc5f666f6a 18.0 landed
-
Defer flushing of SLRU files.
- dee663f78439 14.0 cited