On Tue, Mar 18, 2025 at 10:05:07AM +0900, Sungwoo Chang wrote: > +/* > + * Attempt to destroy a named DSM segment > + * > + * This routine attempts to destroy the DSM segment. We unpin the dsm_segment > + * and delete the entry from dsm_registry_table. This may not destroy the > + * dsm_segment instantly, but it would die out once all the other processes > + * attached to this dsm_segment either exit or manually detach from the > + * dsm_segment. > + * > + * Because we deleted the key from dsm_registry_table, calling > + * GetNamedDSMSegment with the same key would result into creating a new > + * dsm_segment instead of retrieving the old unpinned dsm_segment. > + */
One of the reasons I avoided adding detach/destroy functionality originally is because this seems difficult to do correctly. How would an extension ensure that it doesn't end up with one set of backends attached to a new segment and another attached to an old one that is pending deletion? -- nathan