Fix DSA allocation to honor DSA_ALLOC_NO_OOM when out of DSM segments.

Callers allocating DSA memory with DSA_ALLOC_NO_OOM expect to get
InvalidDsaPointer on allocation failure so that they can clean up and
handle the failure themselves. However, since commit 13df76a537c, a
new DSM segment for a DSA area has been created without
DSM_CREATE_NULL_IF_MAXSEGMENTS, so running out of DSM segments raised
an ERROR instead of returning InvalidDsaPointer.

Fix by passing DSM_CREATE_NULL_IF_MAXSEGMENTS.

Backpatch to all supported versions.

Author: Baji Shaik <[email protected]>
Reviewed-by: Zhijie Hou <[email protected]>
Reviewed-by: Bharath Rupireddy <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Discussion: 
https://postgr.es/m/ca+fm-rmyb6eomuk+a4_hzou9cdthfb6mj1uv-7yb_yutwlu...@mail.gmail.com
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/19ab0bae3aa3c006503da10e6e250d6e5529394c

Modified Files
--------------
src/backend/utils/mmgr/dsa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Reply via email to