Re: shared-memory based stats collector - v67

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: shared-memory based stats collector - v67
Дата
Msg-id 20220323.172750.1181725167665558561.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на Re: shared-memory based stats collector - v67  (Andres Freund <andres@anarazel.de>)
Ответы Re: shared-memory based stats collector - v67
Список pgsql-hackers
At Mon, 21 Mar 2022 14:30:17 -0700, Andres Freund <andres@anarazel.de> wrote in 
> > Right now we reset stats for replicas, even if we start from a shutdown
> > checkpoint. That seems pretty unnecessary with this patch:
> > - 0021-pgstat-wip-only-reset-pgstat-data-after-crash-re.patch
> 
> Might raise this in another thread for higher visibility.

+    /*
+     * When starting with crash recovery, reset pgstat data - it might not be
+     * valid. Otherwise restore pgstat data. It's safe to do this here,
+     * because postmaster will not yet have started any other processes
+     *
+     * TODO: With a bit of extra work we could just start with a pgstat file
+     * associated with the checkpoint redo location we're starting from.
+     */
+    if (ControlFile->state == DB_SHUTDOWNED ||
+        ControlFile->state == DB_SHUTDOWNED_IN_RECOVERY)
+        pgstat_restore_stats();
+    else
+        pgstat_discard_stats();
+

Before there, InitWalRecovery changes the state to
DB_IN_ARCHIVE_RECOVERY if it was either DB_SHUTDOWNED or
DB_IN_PRODUCTION. So the stat seems like always discarded on standby.

In the first place, I'm not sure it is valid that a standby from a
cold backup takes over the stats from the primary.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Assert in pageinspect with NULL pages
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints