Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Add a callback data parameter to GetNamedDSMSegment
Date: 2025-12-04 17:40:21
Message-ID: CAN4CZFP5P3AL9M=Q_nhBycKTy2wG23PLxTzmso5QwR3On2bnFQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> "caller after returning from GetNamedDSHash" <- do you mean
> GetNamedDSMSegment ?

Yes, that was a typo.

> wouldn't the above be sufficient to create a DSM segment containing
> a flexible array?

Yes, it creates it, but can I initialize it properly in
foo_init_state? How can I set the size member to the proper array
size, and how can I zero-initialize the array with the correct length
in it? What I can do currently is:

1. create the lwlock and set size to 0 in foo_init_state
2. take the lwlock after GetNamedDSMSegment returns
3. if size is 0 set it properly and zero-initialize the array

That's why I said that there is a workaround, but it would be nicer if
I could do it properly in the init callback, by passing the array size
as a parameter to it.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2025-12-04 17:43:27 Re: Adding REPACK [concurrently]
Previous Message Andres Freund 2025-12-04 17:30:28 Re: pgsql: Add pg_atomic_unlocked_write_u64