pg_buffercache_interrupt_check.patch
application/octet-stream
Filename: pg_buffercache_interrupt_check.patch
Type: application/octet-stream
Part: 0
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index ae0291e6e96..5afe4c3765e 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -193,6 +193,8 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
{
BufferDesc *bufHdr;
uint32 buf_state;
+
+ CHECK_FOR_INTERRUPTS();
bufHdr = GetBufferDescriptor(i);
/* Lock each buffer header before inspecting. */
@@ -560,6 +562,8 @@ pg_buffercache_summary(PG_FUNCTION_ARGS)
BufferDesc *bufHdr;
uint32 buf_state;
+ CHECK_FOR_INTERRUPTS();
+
/*
* This function summarizes the state of all headers. Locking the
* buffer headers wouldn't provide an improved result as the state of
@@ -620,6 +624,8 @@ pg_buffercache_usage_counts(PG_FUNCTION_ARGS)
uint32 buf_state = pg_atomic_read_u32(&bufHdr->state);
int usage_count;
+ CHECK_FOR_INTERRUPTS();
+
usage_count = BUF_STATE_GET_USAGECOUNT(buf_state);
usage_counts[usage_count]++;