Re: pgstat: stats added in ReadPageInternal() aren't getting reported via pg_stat_wal

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: pgstat: stats added in ReadPageInternal() aren't getting reported via pg_stat_wal
Дата
Msg-id 20220927.105830.2111828220455166451.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на pgstat: stats added in ReadPageInternal() aren't getting reported via pg_stat_wal  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
At Mon, 19 Sep 2022 18:46:17 +0530, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote in 
> walsener.c might work, but that didn't help either. Can anyone please
> let me know why the stats that I added aren't shown via pg_stat_wal
> view despite the walsender doing pgstat_initialize() ->
> pgstat_init_wal()? Am I missing something?
> 
> I'm attaching here with the patch that I was using.

pgstat_report_wal() is supposed to be called on user-facing (or query
executing) backends. The function is called while in idle state on
such backends. Other processes need to call one or more friend
functions as needed. Checkpointer calls pgstat_report_checkpoint/wal()
at the end of an iteration of the main waiting loop. Walwriter does
the same with pgstat_report_wal(). Thus we need to do the same on
startup process somewhere within the redo loop but where that call
doesn't cause contention on shared stats area.

About what the patch does, it increments the xlogreader_cache_hits
counter when the WAL page to read have been already loaded, but it's
not a cache but a buffer. The counter would approximately shows the
number about mean-(raw)-records-per-wal-page *
wal-page-ever-read. (mean-records-per-wal-page = page-size /
mean-record-length).  So I don't think that the value offers something
valuable. I guess that the same value (for the moment) can be
calculated from the result of pg_get_wal_records_info().

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Smith
Дата:
Сообщение: Re: Add common function ReplicationOriginName.
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: Can we avoid chdir'ing in resolve_symlinks() ?