Check for interrupts during tuple-insertion loops.
authorRobert Haas <rhaas@postgresql.org>
Tue, 24 Jun 2014 01:45:21 +0000 (21:45 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 24 Jun 2014 01:45:21 +0000 (21:45 -0400)
Normally, this won't matter too much; but if I/O is really slow, for
example because the system is overloaded, we might write many pages
before checking for interrupts.  A single toast insertion might
write up to 1GB of data, and a multi-insert could write hundreds
of tuples (and their corresponding TOAST data).

src/backend/access/heap/heapam.c
src/backend/access/heap/tuptoaster.c

index b77c32c6ab6733c2e7fc2232ab5ac7d157af709c..f8bed1969268a079ab6f6891eaf9e28078d35c0e 100644 (file)
@@ -2355,6 +2355,8 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
        bool        all_visible_cleared = false;
        int         nthispage;
 
+       CHECK_FOR_INTERRUPTS();
+
        /*
         * Find buffer where at least the next tuple will fit.  If the page is
         * all-visible, this will also pin the requisite visibility map page.
index 4adfe8217bdf726af9eb8a2c89a552992fdb25bb..ce44bbd303d147026464ad1d2f3c4458428768c4 100644 (file)
@@ -35,6 +35,7 @@
 #include "access/tuptoaster.h"
 #include "access/xact.h"
 #include "catalog/catalog.h"
+#include "miscadmin.h"
 #include "utils/fmgroids.h"
 #include "utils/pg_lzcompress.h"
 #include "utils/rel.h"
@@ -1495,6 +1496,8 @@ toast_save_datum(Relation rel, Datum value,
    {
        int         i;
 
+       CHECK_FOR_INTERRUPTS();
+
        /*
         * Calculate the size of this chunk
         */