aio: worker: Free SMGR objects when idle

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: aio: worker: Free SMGR objects when idle
Date: 2026-09-18 07:28:29
Message-ID: CAN55FZ2BesKUnajdgpw1fPSe3S6_CHOugryaUEtD7vdP=dRKEQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-aio-worker-Free-SMGR-objects-when-idle.patch text/x-patch 2.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2026-09-18 07:32:06 Re: table-write trigger can bypass ATPrepChangePersistence
Previous Message Christoph Berg 2026-09-18 07:20:07 Re: meson vs. llvm bitcode files