pgsql: Add pairingheap_initialize() for shared memory usage

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add pairingheap_initialize() for shared memory usage
Date: 2025-11-05 09:44:46
Message-ID: E1vGa4M-0058Gx-2U@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add pairingheap_initialize() for shared memory usage

The existing pairingheap_allocate() uses palloc(), which allocates
from process-local memory. For shared memory use cases, the pairingheap
structure must be allocated via ShmemAlloc() or embedded in a shared
memory struct. Add pairingheap_initialize() to initialize an already-
allocated pairingheap structure in-place, enabling shared memory usage.

Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q(at)mail(dot)gmail(dot)com
Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
Author: Kartyshov Ivan <i(dot)kartyshov(at)postgrespro(dot)ru>
Author: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Reviewed-by: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Reviewed-by: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Reviewed-by: Euler Taveira <euler(at)eulerto(dot)com>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Reviewed-by: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8af3ae0d4b36f4cbd6c72b12357ba928d02b3ebd

Modified Files
--------------
src/backend/lib/pairingheap.c | 18 ++++++++++++++++--
src/include/lib/pairingheap.h | 3 +++
2 files changed, 19 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2025-11-05 15:38:52 pgsql: doc: Add section for temporal tables
Previous Message Richard Guo 2025-11-05 09:16:25 pgsql: Fix assertion failure in generate_orderedappend_paths()