Re: shared-memory based stats collector - v67

From: Andres Freund <andres(at)anarazel(dot)de>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: melanieplageman(at)gmail(dot)com, ibrar(dot)ahmad(at)gmail(dot)com, masao(dot)fujii(at)oss(dot)nttdata(dot)com, gkokolatos(at)protonmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: shared-memory based stats collector - v67
Date: 2022-04-04 23:31:18
Message-ID: 20220404233118.ja42kd7aiemvhtr2@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-03-23 10:42:03 -0700, Andres Freund wrote:
> On 2022-03-23 17:27:50 +0900, Kyotaro Horiguchi wrote:
> > + /*
> > + * 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.
>
> Hm. I though it worked at some point. I guess there's a reason this commit is
> a separate commit marked WIP ;)

FWIW, it had gotten broken by

commit be1c00ab13a7c2c9299d60cb5a9d285c40e2506c
Author: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Date: 2022-02-16 09:22:44 +0200

Move code around in StartupXLOG().

because that moved the spot where
ControlFile->state = DB_IN_CRASH_RECOVERY
is set to an earlier location.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2022-04-04 23:38:05 Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors
Previous Message David Rowley 2022-04-04 23:09:21 Re: pushdown of joinquals beyond group by/distinct on