Re: Fwd: dsm_registry: Add detach and destroy features

Поиск
Список
Период
Сортировка
От Sungwoo Chang
Тема Re: Fwd: dsm_registry: Add detach and destroy features
Дата
Msg-id CAAdDe3OMVtGeRszYCTb_Qcrm8bbPX0DO66L-iGTQU4Wy3fPqJw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fwd: dsm_registry: Add detach and destroy features  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
2025년 6월 14일 (토) 오전 6:50, Nathan Bossart <nathandbossart@gmail.com>님이 작성:
> I suspect detaching/destroying segments would be applicable elsewhere, I'm
> just not sure about providing something with the aforementioned behavior.
>
> Could your use-case be handled with a DSA?  On the other thread [0], we're
> talking about adding a GetNamedDSA() function, which returns a DSA that you
> can use to allocate and free shared memory as needed.  In theory you could
> even detach the DSA if you no longer needed it in a backend, although
> that's probably unnecessary.
>
> [0] https://postgr.es/m/aEyX-9k5vlK2lxjz%40nathan
>
> --
> nathan

My use-case requires access to the shared memory object through a named key.
Even if we migrate the code to NamedDSA, within the DSA we will need some sort
of a map between the named key and the object to access. So, I think NamedDSA
won't be the solution.

How about when we call destroy, we check if there are other processes
attached to it
and if so, we throw an exception? I checked C++ boost interprocess
library [0], and it
looks like that's the way boost does. This way, we can avoid the aforementioned
"partitioned" scenario.

[0]
https://www.boost.org/doc/libs/1_55_0/doc/html/interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.sharedmemory.removing



В списке pgsql-hackers по дате отправления: