summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2014-11-12 17:52:49 +0000
committerAndres Freund2014-11-12 17:52:49 +0000
commitbd4ae0f396b36955c92f26c0058e7dc0452db817 (patch)
tree5ad37a0497d23572dc23e4b5a6afb9aa3ae1480b
parent28245b8424e29808f4f714482077a762cab0c5c5 (diff)
Add interrupt checks to contrib/pg_prewarm.
Currently the extension's pg_prewarm() function didn't check interrupts once it started "warming" data. Since individual calls can take a long while it's important for them to be interruptible. Backpatch to 9.4 where pg_prewarm was introduced.
-rw-r--r--contrib/pg_prewarm/pg_prewarm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/pg_prewarm/pg_prewarm.c b/contrib/pg_prewarm/pg_prewarm.c
index df20e888ef..32c724e5ce 100644
--- a/contrib/pg_prewarm/pg_prewarm.c
+++ b/contrib/pg_prewarm/pg_prewarm.c
@@ -159,6 +159,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
*/
for (block = first_block; block <= last_block; ++block)
{
+ CHECK_FOR_INTERRUPTS();
PrefetchBuffer(rel, forkNumber, block);
++blocks_done;
}
@@ -177,6 +178,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
*/
for (block = first_block; block <= last_block; ++block)
{
+ CHECK_FOR_INTERRUPTS();
smgrread(rel->rd_smgr, forkNumber, block, blockbuffer);
++blocks_done;
}
@@ -190,6 +192,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
{
Buffer buf;
+ CHECK_FOR_INTERRUPTS();
buf = ReadBufferExtended(rel, forkNumber, block, RBM_NORMAL, NULL);
ReleaseBuffer(buf);
++blocks_done;