Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(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-11 23:17:30
Message-ID: CAA5RZ0s4p=D0D8vZ-5gmMfhr_q7GN6V2pgBhCewokO5hncQ=HA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > I went back-forth on if it makes sense to provide the name as an
> > extra argument and decided it provides more flexibility. For example
> > I can use the same init callback and arguments for different segments.
>
> 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.

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2025-12-11 23:32:24 Re: Proposal to allow setting cursor options on Portals
Previous Message Jacob Champion 2025-12-11 23:12:52 Re: DOCS - Clarify the publication 'publish_via_partition_root' default value.