aio: worker: Free SMGR objects when idle
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t253831psql -h localhost -U postgresBuilt from patchset v1 (message #1), September 20, 2026 at 07:46 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t253831_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t253831_1 && git checkout t253831_1Patchset v1 (message #1) is on t253831_1
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