Add pg_buffercache_evict() function for testing.
authorThomas Munro <tmunro@postgresql.org>
Sat, 6 Apr 2024 21:13:17 +0000 (09:13 +1200)
committerThomas Munro <tmunro@postgresql.org>
Mon, 8 Apr 2024 04:23:40 +0000 (16:23 +1200)
commit13453eedd3f692f8dcf8e334396eee84f00fdde2
tree728c8d99691e600f04d334e9f56556cd99f003e0
parent0ea51bac3802dca9dcf5cbaaf7a19a1c1ae4781a
Add pg_buffercache_evict() function for testing.

When testing buffer pool logic, it is useful to be able to evict
arbitrary blocks.  This function can be used in SQL queries over the
pg_buffercache view to set up a wide range of buffer pool states.  Of
course, buffer mappings might change concurrently so you might evict a
block other than the one you had in mind, and another session might
bring it back in at any time.  That's OK for the intended purpose of
setting up developer testing scenarios, and more complicated interlocking
schemes to give stronger guararantees about that would likely be less
flexible for actual testing work anyway.  Superuser-only.

Author: Palak Chaturvedi <chaturvedipalak1911@gmail.com>
Author: Thomas Munro <thomas.munro@gmail.com> (docs, small tweaks)
Reviewed-by: Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Cary Huang <cary.huang@highgo.ca>
Reviewed-by: Cédric Villemain <cedric.villemain+pgsql@abcsql.com>
Reviewed-by: Jim Nasby <jim.nasby@gmail.com>
Reviewed-by: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/CALfch19pW48ZwWzUoRSpsaV9hqt0UPyaBPC4bOZ4W+c7FF566A@mail.gmail.com
contrib/pg_buffercache/Makefile
contrib/pg_buffercache/meson.build
contrib/pg_buffercache/pg_buffercache--1.4--1.5.sql [new file with mode: 0644]
contrib/pg_buffercache/pg_buffercache.control
contrib/pg_buffercache/pg_buffercache_pages.c
doc/src/sgml/pgbuffercache.sgml
src/backend/storage/buffer/bufmgr.c
src/include/storage/bufmgr.h