aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-06-23 21:45:21 -0400
committerRobert Haas <rhaas@postgresql.org>2014-06-23 21:45:21 -0400
commitc922353b1c7e7fe5fa506664ccf0c87a0abfdda2 (patch)
treec9ee8f64beddbf27dcb7a2e56c7ac5356a991bc1
parent631e7f6b4e0629077408d3f8caf282627765f3f0 (diff)
downloadpostgresql-c922353b1c7e7fe5fa506664ccf0c87a0abfdda2.tar.gz
postgresql-c922353b1c7e7fe5fa506664ccf0c87a0abfdda2.zip
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).
-rw-r--r--src/backend/access/heap/heapam.c2
-rw-r--r--src/backend/access/heap/tuptoaster.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b77c32c6ab6..f8bed196926 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -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.
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index 4adfe8217bd..ce44bbd303d 100644
--- a/src/backend/access/heap/tuptoaster.c
+++ b/src/backend/access/heap/tuptoaster.c
@@ -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
*/