| 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-12 20:56:39 |
| Message-ID: | CAA5RZ0uJiK8N+Oi0ci__QSHF_tV2sjzqPh5m=P91PqviOhT-Uw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Fri, Dec 12, 2025 at 12:48:52PM -0600, Sami Imseih wrote:
> > As far as testing, I did not think it's worth it since in the cases out
> > there now a NULL void * will result in an error when calling
> > LWLockNewTrancheId.
>
> I think we should pass NULL to all the existing in-tree calls to
> GetNamedDSMSegment(), except for perhaps a new test in test_dsm_registry
> that verifies the pointer value in the initialization function. In all the
> other cases, there's no issue with hard-coding the tranche names, so we can
> keep those simple.
fair point. In that case why don't we just keep:
```
static void
-init_tdr_dsm(void *ptr)
+init_tdr_dsm(void *ptr, void *arg)
{
TestDSMRegistryStruct *dsm = (TestDSMRegistryStruct *) ptr;
- LWLockInitialize(&dsm->lck, LWLockNewTrancheId("test_dsm_registry"));
+ LWLockInitialize(&dsm->lck, LWLockNewTrancheId((char *) arg));
dsm->val = 0;
}
@@ -60,6 +60,7 @@ tdr_attach_shmem(void)
tdr_dsm = GetNamedDSMSegment("test_dsm_registry_dsm",
sizeof(TestDSMRegistryStruct),
init_tdr_dsm,
+
"test_dsm_registry",
&found);
if (tdr_dsa == NULL)
```
instead of creating a new test? For the other GetNamedDSMSegment
calls, I'll pass
NULL to the void * and hard code the tranche name in the init callback.
--
Sami Imseih
Amazon Web Services (AWS)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2025-12-12 21:07:04 | Re: Proposal: Add a callback data parameter to GetNamedDSMSegment |
| Previous Message | Bryan Green | 2025-12-12 20:56:18 | Re: [PATCH] Fix severe performance regression with gettext 0.20+ on Windows |