Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Maxim Orlov <orlovmg@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, Palak Chaturvedi <chaturvedipalak1911@gmail.com>, Jim Nasby <jim.nasby@gmail.com>, pgsql-hackers@postgresql.org, Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Date: 2024-04-06T23:07:58Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add pg_buffercache_evict() function for testing.

Attachments

On second thoughts, I think the original "invalidate" terminology was
fine, no need to invent a new term.

I thought of a better name for the bufmgr.c function though:
InvalidateUnpinnedBuffer().  That name seemed better to me after I
festooned it with warnings about why exactly it's inherently racy and
only for testing use.

I suppose someone could propose an additional function
pg_buffercache_invalidate(db, tbspc, rel, fork, blocknum) that would
be slightly better in the sense that it couldn't accidentally evict
some innocent block that happened to replace the real target just
before it runs, but I don't think it matters much for this purpose and
it would still be racy on return (vacuum decides to load your block
back in) so I don't think it's worth bothering with.

So this is the version I plan to commit.