mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Add new buffers_backend_fsync field to pg_stat_bgwriter.
This new field counts the number of times that a backend which writes a buffer out to the OS must also fsync() it. This happens when the bgwriter fsync request queue is full, and is generally detrimental to performance, so it's good to know when it's happening. Along the way, log a new message at level DEBUG1 whenever we fail to hand off an fsync, so that the problem can also be seen in examination of log files (if the logging level is cranked up high enough). Greg Smith, with minor tweaks by me.
This commit is contained in:
@ -78,6 +78,7 @@ extern Datum pg_stat_get_bgwriter_buf_written_checkpoints(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_bgwriter_buf_written_clean(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_bgwriter_maxwritten_clean(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_buf_written_backend(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_buf_fsync_backend(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_buf_alloc(PG_FUNCTION_ARGS);
|
||||
|
||||
extern Datum pg_stat_get_xact_numscans(PG_FUNCTION_ARGS);
|
||||
@ -1164,6 +1165,12 @@ pg_stat_get_buf_written_backend(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_INT64(pgstat_fetch_global()->buf_written_backend);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_buf_fsync_backend(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_INT64(pgstat_fetch_global()->buf_fsync_backend);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_buf_alloc(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
Reference in New Issue
Block a user