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

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
Дата
Msg-id ZPFa/bED0YZc0oE3@paquier.xyz
обсуждение исходный текст
Ответ на Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-bugs
On Thu, Aug 31, 2023 at 07:56:13PM -0700, Nathan Bossart wrote:
> On Fri, Sep 01, 2023 at 10:08:57AM +0900, Michael Paquier wrote:
>> +    /*
>> +     * Now that we rechecked, we are certain to be connected to a database and
>> +     * thus can set MyDatabaseId.
>> +     */
>> +    MyDatabaseId = dboid;
>
> Perhaps we should expand this comment to make it clear that some code
> depends on this to avoid races with concurrent database drops/renames.

Yeah, this could be a bit more detailed, mentioning the dependency
with the pgstat shutdown callback.  How about appending the following
sentence in a second paragraph, say:
"Setting MyDatabaseId after rechecking the existence of the database
matters for instance with the shutdown callback of the shared
statistics, as pgstat_report_stat() will update database statistics
depending on MyDatabaseId."
--
Michael

Вложения

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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
Следующее
От: Romain MAZIÈRE
Дата:
Сообщение: Error on help in /src/bin/pg_basebackup/pg_basebackup.c