summaryrefslogtreecommitdiff
path: root/src/.gitignore
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-12-30 18:26:23 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2025-12-30 18:26:23 -0500
commitbc6374cd76abb2e6a48c4b57c0b5a7baa5babd67 (patch)
treed90c3ca10ec7cbc70d538e64a7d5205532e2ed03 /src/.gitignore
parent736f754eed01ca81198b6cd7421321088cbe5ded (diff)
Change IndexAmRoutines to be statically-allocated structs.HEADorigin/masterorigin/HEADmaster
Up to now, index amhandlers were expected to produce a new, palloc'd struct on each call. That requires palloc/pfree overhead, and creates a risk of memory leaks if the caller fails to pfree, and the time taken to fill such a large structure isn't nil. Moreover, we were storing these things in the relcache, eating several hundred bytes for each cached index. There is not anything in these structs that needs to vary at runtime, so let's change the definition so that an amhandler can return a pointer to a "static const" struct of which there's only one copy per index AM. Mark all the core code's IndexAmRoutine pointers const so that we catch anyplace that might still try to change or pfree one. (This is similar to the way we were already handling TableAmRoutine structs. This commit does fix one comment that was infelicitously copied-and-pasted into tableamapi.c.) This commit needs to be called out in the v19 release notes as an API change for extension index AMs. An un-updated AM will still work (as of now, anyway) but it risks memory leaks and will be slower than necessary. Author: Matthias van de Meent <boekewurm+postgres@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAEoWx2=vApYk2LRu8R0DdahsPNEhWUxGBZ=rbZo1EXE=uA+opQ@mail.gmail.com
Diffstat (limited to 'src/.gitignore')
0 files changed, 0 insertions, 0 deletions