postgresql/src/backend/storage
Andres Freund 560bb56c6e 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
2023-03-22 09:26:23 -07:00
..
buffer Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG 2023-03-22 09:26:23 -07:00
file Fix pg_truncate() on Windows. 2023-01-06 16:49:58 +13:00
freespace Prefetch data referenced by the WAL, take II. 2022-04-07 19:42:14 +12:00
ipc Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids 2023-03-07 21:36:48 -08:00
large_object Update copyright for 2022 2022-01-07 19:04:57 -05:00
lmgr Fix race in SERIALIZABLE READ ONLY. 2023-03-09 16:56:51 +13:00
page Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
smgr Apply a better fix to mdunlinkfork(). 2022-11-09 14:15:38 -05:00
sync Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
Makefile Refactor the fsync queue for wider use. 2019-04-04 23:38:38 +13:00