mirror of
https://github.com/postgres/postgres.git
synced 2026-01-29 12:02:15 +03:00
Allow table AM to store complex data structures in rd_amcache
The new table AM method free_rd_amcache is responsible for freeing all the memory related to rd_amcache and setting free_rd_amcache to NULL. If the new method is not specified, we still assume rd_amcache to be a single chunk of memory, which could be just pfree'd. Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com Reviewed-by: Matthias van de Meent, Mark Dilger, Pavel Borisov Reviewed-by: Nikita Malakhov, Japin Li
This commit is contained in:
@@ -221,10 +221,12 @@ typedef struct RelationData
|
||||
* rd_amcache is available for index and table AMs to cache private data
|
||||
* about the relation. This must be just a cache since it may get reset
|
||||
* at any time (in particular, it will get reset by a relcache inval
|
||||
* message for the relation). If used, it must point to a single memory
|
||||
* chunk palloc'd in CacheMemoryContext, or in rd_indexcxt for an index
|
||||
* relation. A relcache reset will include freeing that chunk and setting
|
||||
* rd_amcache = NULL.
|
||||
* message for the relation). If used for table AM it must point to a
|
||||
* single memory chunk palloc'd in CacheMemoryContext, or more complex
|
||||
* data structure in that memory context to be freed by free_rd_amcache
|
||||
* method. If used for index AM it must point to a single memory chunk
|
||||
* palloc'd in rd_indexcxt memory context. A relcache reset will include
|
||||
* freeing that chunk and setting rd_amcache = NULL.
|
||||
*/
|
||||
void *rd_amcache; /* available for use by index/table AM */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user