Commit 5df319f
committed
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 introduced1 parent bbc1376 commit 5df319f
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3833 | 3833 | | |
3834 | 3834 | | |
3835 | 3835 | | |
3836 | | - | |
3837 | 3836 | | |
3838 | | - | |
| 3837 | + | |
3839 | 3838 | | |
3840 | | - | |
3841 | 3839 | | |
3842 | 3840 | | |
3843 | 3841 | | |
| |||
3855 | 3853 | | |
3856 | 3854 | | |
3857 | 3855 | | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
3858 | 3859 | | |
3859 | 3860 | | |
3860 | 3861 | | |
| |||
0 commit comments