postgres.git / summary / log / commit / refs
commit 597d5c1fef84855254bdc93ebfa612beff889006
Author: Masahiko Sawada <msawada@postgresql.org>
Date: Wed Nov 18 18:57:48 2026 +0000
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 <baji.pgdev@gmail.com>
Reviewed-by: Zhijie Hou <houzhijie22@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CA+fm-RMyb6EoMuk+a4_hZou9cdTHfB6mj1UV-7yb_YuTWLug1g@mail.gmail.com
Backpatch-through: 15
src/backend/utils/mmgr/dsa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/utils/mmgr/dsa.c b/src/backend/utils/mmgr/dsa.c
index a1ca2c8b46c..e74b4e66481 100644
--- a/src/backend/utils/mmgr/dsa.c
+++ b/src/backend/utils/mmgr/dsa.c
@@ -2172,7 +2172,7 @@ make_new_segment(dsa_area *area, size_t requested_pages)
}
/* Create the segment. */
- segment = dsm_create(total_size, 0);
+ segment = dsm_create(total_size, DSM_CREATE_NULL_IF_MAXSEGMENTS);
if (segment == NULL)
return NULL;
dsm_pin_segment(segment);
[parent: 1e88ed142938]