Re: Add pg_stat_autovacuum_priority
| От | Sami Imseih |
|---|---|
| Тема | Re: Add pg_stat_autovacuum_priority |
| Дата | |
| Msg-id | CAA5RZ0tUq7SEHvAPkYpCw7Y4XOoWLPpsfxO2ZQ5AzQRcQMMAgg@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Add pg_stat_autovacuum_priority (Nathan Bossart <nathandbossart@gmail.com>) |
| Ответы |
Re: Add pg_stat_autovacuum_priority
|
| Список | pgsql-hackers |
> diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c > index bd626a16363..6d4a34257fb 100644 > --- a/src/backend/postmaster/autovacuum.c > +++ b/src/backend/postmaster/autovacuum.c > @@ -3327,7 +3327,15 @@ relation_needs_vacanalyze(Oid relid, > anltuples, anlthresh, scores->anl, > scores->xid, scores->mxid); > > - pfree(tabentry); > + /* > + * Avoid leaking pgstat entries until the end of autovacuum. Elsewhere, > + * we let the commit/abort machinery take care of freeing it. While > + * autovacuum workers set stats_fetch_consistency to "none", it might be > + * set to a different value in other processes, so we can't safely free it > + * here for them. > + */ > + if (AmAutoVacuumWorkerProcess()) > + pfree(tabentry); > } This works too, but v1-0001 is more generalized and we don't have to care about who the caller is when deciding to free or not. -- Sami
В списке pgsql-hackers по дате отправления: