pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY @ 2023-03-22 17:03 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 2+ messages in thread From: Andres Freund @ 2023-03-22 17:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG RelationCopyStorageUsingBuffer() did not free the strategies used to access the source / target relation. They memory was released at the end of the transaction, but when using a template database with a lot of relations, the temporary leak can become big prohibitively big. RelationCopyStorageUsingBuffer() acquired the buffer for the target relation with RBM_NORMAL, therefore requiring a read of a block guaranteed to be zero. Use RBM_ZERO_AND_LOCK instead. Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/20230321070113.o2vqqxogjykwgfrr@awork3.anarazel.de Backpatch: 15-, where STRATEGY WAL_LOG was introduced Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/5df319f3d55d09fadb4f7e4b58c5b476a3aeceb4 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY @ 2023-03-22 17:03 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 2+ messages in thread From: Andres Freund @ 2023-03-22 17:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG RelationCopyStorageUsingBuffer() did not free the strategies used to access the source / target relation. They memory was released at the end of the transaction, but when using a template database with a lot of relations, the temporary leak can become big prohibitively big. RelationCopyStorageUsingBuffer() acquired the buffer for the target relation with RBM_NORMAL, therefore requiring a read of a block guaranteed to be zero. Use RBM_ZERO_AND_LOCK instead. Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/20230321070113.o2vqqxogjykwgfrr@awork3.anarazel.de Backpatch: 15-, where STRATEGY WAL_LOG was introduced Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/560bb56c6eba5da7917e67783d46f0d5ca30e89a Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-03-22 17:03 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-03-22 17:03 pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY Andres Freund <andres@anarazel.de> 2023-03-22 17:03 pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox