Hi,
IO worker processes call smgropen with smgr_aio_reopen() -> smgropen()
path. smgropen() has a comment mentioning:
/*
* If this function is called
* outside of a transaction, the object remains valid until smgrdestroy() or
* smgrdestroyall() is called.
/*
Since, IO workers call this function outside of a transaction,
smgrdestroy() needs to be called. Attached patch calls smgrdestroy()
when the IO worker is idle. There is a chance that IO workers won't be
idle forever, so we might want to trigger this after #n number of IOs
too but I didn't implement like that for the sake of simplicity.
--
Regards,
Nazir Bilal Yavuz
Microsoft