From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | checking for interrupts during heap insertion |
Date: | 2014-06-23 17:07:22 |
Message-ID: | CA+Tgmoa8mubXrw54T+uELOd=6eMDAXe0DM8m7WdSUyRQCJ6QVA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
While talking to Amit Kapila this morning, he mentioned to me that
there seem to be no CHECK_FOR_INTERRUPTS() calls anywhere in
heap_multi_insert() or the functions it calls. Should there be?
By way of contrast, heapgetpage() has this:
/*
* Be sure to check for interrupts at least once per page. Checks at
* higher code levels won't be able to stop a seqscan that encounters many
* pages' worth of consecutive dead tuples.
*/
CHECK_FOR_INTERRUPTS();
In heap_multi_insert(), we first do heap_prepare_insert() on each
tuple, which may involve dirtying many pages, since it handles TOAST.
Then, we loop over the tuples themselves and dirty a bunch more pages.
All of that will normally happen pretty quickly, but if the I/O
subsystem is very slow for some reason, such as due to heavy system
load, then it might take quite a long time. I'm thinking we might
want a CHECK_FOR_INTERRUPTS() in the following two places:
1. Inside toast_save_datum, at the top of the loop that starts with
"while (data_todo > 0)".
2. Inside heap_multi_insert, at the top of the loop that starts with
"while (ndone < ntuples)".
Thoughts?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-06-23 17:07:36 | Re: Use a signal to trigger a memory context dump? |
Previous Message | Tom Lane | 2014-06-23 16:49:24 | Re: /proc/self/oom_adj is deprecated in newer Linux kernels |