Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(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-12 16:05:23
Message-ID: aTw9Q-p8zzog1PgO@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 11, 2025 at 05:17:30PM -0600, Sami Imseih wrote:
>> If the initialization callback function needed the name, it could be
>> provided via the "void *" callback argument, right? I'm not following why
>> we need to provide it separately.
>
> While it's true it can be passed as extra data, it is less error-prone
> as we guarantee the real name of the segment is made available to
> the callback. Also a caller to GetNamedDSMSegment does not need to
> pass the name twice, as the name and as extra data. The most common
> case I would think is using the segment name as the tranche name when
> initializing a lwlock.

But... they can just pass that in the "void *" argument. I'm pretty firmly
-1 for adding more than the one callback argument here.

--
nathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-12-12 16:07:14 Re: Proposal: Add a callback data parameter to GetNamedDSMSegment
Previous Message Sujan 2025-12-12 16:03:23 [PATCH] Expose global backup status and last backup start LSN