postgresql/src/backend/storage
Andres Freund 5df319f3d5 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:20:34 -07:00
..
buffer Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG 2023-03-22 09:20:34 -07:00
file Don't leak descriptors into subprograms. 2023-03-03 10:43:33 +13:00
freespace Update copyright for 2023 2023-01-02 15:00:37 -05:00
ipc Improve several permission-related error messages. 2023-03-17 10:33:09 +01:00
large_object Update copyright for 2023 2023-01-02 15:00:37 -05:00
lmgr Fix race in SERIALIZABLE READ ONLY. 2023-03-09 16:33:24 +13:00
page Update copyright for 2023 2023-01-02 15:00:37 -05:00
smgr Update types in smgr API 2023-02-27 07:47:46 +01:00
sync Remove useless casts to (void *) in hash_search() calls 2023-02-06 09:41:01 +01:00
Makefile Refactor the fsync queue for wider use. 2019-04-04 23:38:38 +13:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00