]> granicus.if.org Git - postgresql/commitdiff
Add interrupt checks to contrib/pg_prewarm.
authorAndres Freund <andres@anarazel.de>
Wed, 12 Nov 2014 17:52:49 +0000 (18:52 +0100)
committerAndres Freund <andres@anarazel.de>
Wed, 12 Nov 2014 20:06:32 +0000 (21:06 +0100)
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.

contrib/pg_prewarm/pg_prewarm.c

index df20e888eff08d927475d535312a114a6e0ae260..32c724e5ce2fded164be54deefaee289b16c5197 100644 (file)
@@ -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;