On Tue, 1 Sept 2026 at 08:02, Chao Li <[email protected]> wrote: > > Hi Matthias, > > Thanks for the patch, the idea is interesting. I have just gone through the > commits, and got a suspicion. > > Basically, the idea is to share common data via a hash table in each backend > process, thereby saving some memory. However, sharing rd_supportinfo seems > unsafe. In index_getprocinfo(), an entry is initialized lazily by calling > fmgr_info_cxt(procId, locinfo, irel->rd_indexcxt); > > This stores the current index's private context in locinfo->fn_mcxt. Support > functions may then allocate fn_extra in that context. If this index's > relcache entry is destroyed while another index still references the shared > rd_supportinfo, the first index's rd_indexcxt is deleted, leaving the shared > FmgrInfo with a dangling fn_mcxt and possibly a dangling fn_extra. > > Am I missing something that guarantees the original rd_indexcxt remains valid > for as long as the shared rd_supportinfo is referenced?
That's a good point. It looks like I'll have to make sure to make that work, because right now that indeed has context lifetime issues. Thanks for the report, I'll fix it in the next patch version. Kind regards, Matthias van de Meent Databricks (https://www.databricks.com)
