From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)bowt(dot)ie>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pg_walinspect memory leaks |
Date: | 2023-02-17 07:56:32 |
Message-ID: | Y+8zMF4CWOXZWW9L@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2023-02-17 08:00:24 | Re: [PoC] Improve dead tuple storage for lazy vacuum |
Previous Message | Julien Rouhaud | 2023-02-17 07:54:33 | pg_upgrade and logical replication |