Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Jacob Speidel <jacob(at)extrahop(dot)com>, Will Mortensen <will(at)extrahop(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
Date: 2023-09-01 01:08:57
Message-ID: ZPE5qXLuMs+/vx9H@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Aug 14, 2023 at 09:11:50AM +0900, Michael Paquier wrote:
> FWIW, I am still confused about what the long-term plan should be for
> the startup process for these database-level stats, and how
> significant it would be to get access to them (mostly for pg_stat_io,
> right? Still what does it mean for the startup process?). I
> understand that we should not undo what e3cb1a58 has tried to improve
> post-feature freeze, still the POC patch of this thread does not touch
> standby.c. So would it be better to just undo e3cb1a58? Or rework
> the stat structures and track pgStatBlockWriteTime for each database,
> studying cheaper methods to achieve that? If we do so, what's there
> to gain in terms of user experience?

After studying more this one, improving the set of static
PgStat_Counters for the startup process so as these can be tracked for
each database is what would make the most sense in the long term. The
extra overhead when dealing with a lot of databases is something that
we'd need measurements for, but not touching that now won't make
things worse than they are currently. So I've let that aside,
focusing on the core issue.

> At the end, after looking again at the patch and the thread, I'm OK
> with pgstat_update_dbstats() doing nothing if we don't have
> MyDatabaseId, because there is nothing to do in this case based on the
> current structure of the database-level stats, but the expectations
> surrounding pgstat_update_dbstats() need some clarifications. Take it
> as a "I'm OK with the logic of the patch, but it can be improved" ;)

I have spent quite a few eye hours on the patch, and I would like to
apply the attached down to v15 at the beginning of next week, likely
Monday, to take care of the autovacuum scheduler issue.

If there are any comments or opinions, please feel free.
--
Michael

Attachment Content-Type Size
v2-0001-Fix-autovacuum-scheduler-with-dropped-databases.patch text/x-diff 6.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Nathan Bossart 2023-09-01 02:56:13 Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
Previous Message Andrew Dunstan 2023-08-31 19:59:23 Re: BUG #18078: createdb not working