Add CHECK_FOR_INTERRUPTS in Evict{Rel,All}UnpinnedBuffers

邱宇航 <iamqyh@gmail.com>

From: 邱宇航 <iamqyh@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-11-03T02:15:09Z
Lists: pgsql-hackers

Attachments

The pg_buffercache_evict_{relation,all} operations can become extremely
slow when dealing with large buffer pools containing many dirty buffers.
This commit adds CHECK_FOR_INTERRUPTS calls within the underlying
Evict{Rel,All}UnpinnedBuffers functions to ensure these operations
cancellable.

And this should be backpatched through v18 where
pg_buffercache_evict_{relation,all} operations are introduced.


Commits

  1. Add CHECK_FOR_INTERRUPTS in Evict{Rel,All}UnpinnedBuffers.

  2. Add CHECK_FOR_INTERRUPTS in contrib/pg_buffercache functions.