Re: OOM in spgist insert
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Borisov <pashkin.elfe@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-05-13T15:53:51Z
Lists: pgsql-hackers
Attachments
- 0001-Split-CHECK_FOR_INTERRUPTS.patch (text/x-diff)
On 2021-May-13, Tom Lane wrote:
> BTW, another nasty thing I discovered while testing this is that
> the CHECK_FOR_INTERRUPTS() at line 2146 is useless, because
> we're holding a buffer lock there so InterruptHoldoffCount > 0.
> So once you get into this loop you can't even cancel the query.
> Seems like that needs a fix, too.
This comment made me remember a patch I've had for a while, which splits
the CHECK_FOR_INTERRUPTS() definition in two -- one of them is
INTERRUPTS_PENDING_CONDITION() which let us test the condition
separately; that allows the lock we hold to be released prior to
actually processing the interrupts.
The btree code modified was found to be an actual problem in production
when a btree is corrupted in such a way that vacuum would get an
infinite loop. I don't remember the exact details but I think we saw
vacuum running for a couple of weeks, and had to restart the server in
order to terminate it (since it wouldn't respond to signals).
--
Álvaro Herrera Valdivia, Chile
"I am amazed at [the pgsql-sql] mailing list for the wonderful support, and
lack of hesitasion in answering a lost soul's question, I just wished the rest
of the mailing list could be like this." (Fotis)
(http://archives.postgresql.org/pgsql-sql/2006-06/msg00265.php)
Commits
-
Prevent infinite insertion loops in spgdoinsert().
- e87a0d2e0aa5 10.18 landed
- dc714c120eab 13.4 landed
- d776045eb12a 11.13 landed
- c3c35a733c77 14.0 landed
- 5015d3c35c6b 9.6.23 landed
- 4e046281fb58 12.8 landed
-
Fix query-cancel handling in spgdoinsert().
- eb7a6b922943 14.0 landed
- fe64adc93177 10.18 landed
- f4ee4082f50b 11.13 landed
- c1b72bf04515 13.4 landed
- 4c6cfcc377aa 9.6.23 landed
- 004288d3c0ac 12.8 landed
-
Refactor CHECK_FOR_INTERRUPTS() to add flexibility.
- e47f93f981cc 14.0 landed
- 8274f4517602 11.13 landed
- 63831c16275e 13.4 landed
- 567328989c19 9.6.23 landed
- 4c646b17985c 12.8 landed
- 39b8ccb08619 10.18 landed