Hello people,

                  We are trying to build an in-memory index in postgres using 
dsa. 



Here is how we implemented dsa part.

We have PROC_DSA_AREA global variable(Process specific DSA Pointer)

We have a piece of traditional postgres shared memory to store dsa_handle

Each process that needs to use DSA, should create/attach DSA (based on 
dsa_handle stored in shmem)

Once created/attached, set the process dsa pointer to PROC_DSA_AREA variable

Subsequent DSA access in that process will use PROC_DSA_AREA variable with out 
looking to create/attach



Problem here is, on DSA Detach, i would like to reset PROC_DSA_AREA variable to 
NULL. Otherwise subsequent DSA calls tries to use the same pointer and may end 
up into Segmentation Faults. How could i do that? 





Found that there is a callback for dsa detach but that function requires 
segment pointer as an argument, Should be as below:




on_dsm_detach(PROC_DSA_AREA->segment_maps[0].segment, detach_func);



** detach_func will set PROC_DSA_AREA variable to NULL.







But i couldn't access that segment, as DSA_AREA struct is defined in dsa.c, so 
I am unable to include.



Any other ways to get dsa detach event, or to access DSA Segment pointer?



Got stuck here.. kindly help me to proceed further.






 


Thank you,
G. Sai Ram






Reply via email to