Skip to content

Commit c922353

Browse files
committed
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).
1 parent 631e7f6 commit c922353

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,6 +2355,8 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
23552355
bool all_visible_cleared = false;
23562356
int nthispage;
23572357

2358+
CHECK_FOR_INTERRUPTS();
2359+
23582360
/*
23592361
* Find buffer where at least the next tuple will fit. If the page is
23602362
* all-visible, this will also pin the requisite visibility map page.

src/backend/access/heap/tuptoaster.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "access/tuptoaster.h"
3636
#include "access/xact.h"
3737
#include "catalog/catalog.h"
38+
#include "miscadmin.h"
3839
#include "utils/fmgroids.h"
3940
#include "utils/pg_lzcompress.h"
4041
#include "utils/rel.h"
@@ -1495,6 +1496,8 @@ toast_save_datum(Relation rel, Datum value,
14951496
{
14961497
int i;
14971498

1499+
CHECK_FOR_INTERRUPTS();
1500+
14981501
/*
14991502
* Calculate the size of this chunk
15001503
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy