Re: pg_walinspect memory leaks

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pg_walinspect memory leaks
Дата
Msg-id Y+8zMF4CWOXZWW9L@paquier.xyz
обсуждение исходный текст
Ответ на Re: pg_walinspect memory leaks  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
On Thu, Feb 16, 2023 at 06:00:00PM +0530, Bharath Rupireddy wrote:
> The memory usage goes up with many WAL records in GetWALRecordsInfo().
> The affected functions are pg_get_wal_records_info() and
> pg_get_wal_records_info_till_end_of_wal(). I think the best way to fix
> this is to use a temporary memory context (like the jsonfuncs.c),
> reset it after every tuple is put into the tuple store. This fix keeps
> the memory under limits. I'm attaching the patches here.

What you are doing here looks OK, at quick glance.  That's common
across the code, see also dblink or file_fdw.

> For HEAD, I'd
> want to be a bit defensive and use the temporary memory context for
> pg_get_wal_fpi_info() too.

If there is a burst of FPWs across the range you are scanning, the
problem could be equally worse.  Sorry for missing that.
--
Michael

Вложения

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: pg_upgrade and logical replication
Следующее
От: John Naylor
Дата:
Сообщение: Re: [PoC] Improve dead tuple storage for lazy vacuum