Commit c922353b authored by Robert Haas's avatar Robert Haas

Check for interrupts during tuple-insertion loops.

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).
parent 631e7f6b
...@@ -2355,6 +2355,8 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, ...@@ -2355,6 +2355,8 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
bool all_visible_cleared = false; bool all_visible_cleared = false;
int nthispage; int nthispage;
CHECK_FOR_INTERRUPTS();
/* /*
* Find buffer where at least the next tuple will fit. If the page is * 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. * all-visible, this will also pin the requisite visibility map page.
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "access/tuptoaster.h" #include "access/tuptoaster.h"
#include "access/xact.h" #include "access/xact.h"
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "miscadmin.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
#include "utils/pg_lzcompress.h" #include "utils/pg_lzcompress.h"
#include "utils/rel.h" #include "utils/rel.h"
...@@ -1495,6 +1496,8 @@ toast_save_datum(Relation rel, Datum value, ...@@ -1495,6 +1496,8 @@ toast_save_datum(Relation rel, Datum value,
{ {
int i; int i;
CHECK_FOR_INTERRUPTS();
/* /*
* Calculate the size of this chunk * Calculate the size of this chunk
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment