[patch] Cache invalidation for I/O Workers

Started by Alexandre Felipe2 days ago4 messageshackers
Beta feature

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.

appliessuccessCI history

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:t253843
psql -h localhost -U postgres

Built from patchset v3 (message #3), September 20, 2026 at 05:31 PM.

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 t253843_3 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t253843_3 && git checkout t253843_3

Patchset v3 (message #3) is on t253843_3

Jump to latest
#1Alexandre Felipe
o.alexandre.felipe@gmail.com

This solves BUG #19622, from pgsql-bugs [1]

With io_method=worker I/O worker processes retain open file descriptors on
relation files that have been dropped.

When dropping a relation, an invalidation message is posted, backends handle it
this patch implements the same pattern in I/O worker, and prevents holding
invalid relations.

That said,

This issue doesn't have observable consequences to the user, and is
currently bound
by `max_files_per_process` (default 1000), after which it forces
closing the least
recently used files, if that parameter does its job, we wouldn't have a crash.

In the theoretical scenario of a relation number being reused it could
attempt to read
from a stale file.

/messages/by-id/19622-639a4ba94c5a53d7@postgresql.org

#2shihao zhong
zhong950419@gmail.com
In reply to: Alexandre Felipe (#1)
Re: [patch] Cache invalidation for I/O Workers

Hi Alexandre,

Thanks for looking into this issue. It seems the patch is missing from the
attachment.

Also, would you mind creating a new entry in commifeast?

Thanks,
Shihao

#3Alexandre Felipe
o.alexandre.felipe@gmail.com
In reply to: shihao zhong (#2)
Re: [patch] Cache invalidation for I/O Workers

The forgotten patch

Show quoted text

On Fri, Sep 18, 2026 at 5:59 PM shihao zhong <zhong950419@gmail.com> wrote:

Hi Alexandre,

Thanks for looking into this issue. It seems the patch is missing from the attachment.

Also, would you mind creating a new entry in commifeast?

Thanks,
Shihao

Attachments:

t253843_3
v1-0001-pgaio-file-descriptor-cache-invalidation.patchapplication/x-patch; name=v1-0001-pgaio-file-descriptor-cache-invalidation.patchDownload+31-1
#4Alexandre Felipe
o.alexandre.felipe@gmail.com
In reply to: Alexandre Felipe (#3)
Re: [patch] Cache invalidation for I/O Workers

On Fri, Sep 18, 2026 at 5:59 PM shihao zhong <zhong950419@gmail.com> wrote:

Hi Alexandre,

Thanks for looking into this issue. It seems the patch is missing from the attachment.

Also, would you mind creating a new entry in commifeast?

https://commitfest.postgresql.org/patch/7322/