pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY
Дата
Msg-id E1pf1sO-004rGU-Nb@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(-)


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: Teach verify_heapam() to validate update chains within a page.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Add "-c name=value" switch to initdb.