Re: OOM in spgist insert
Pavel Borisov <pashkin.elfe@gmail.com>
From: Pavel Borisov <pashkin.elfe@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-05-12T08:51:04Z
Lists: pgsql-hackers
Attachments
- v2-0001-Check-inserted-SpGist-tuple-fit-the-index-page-in.patch (application/octet-stream) patch v2-0001
ср, 12 мая 2021 г. в 12:39, Pavel Borisov <pashkin.elfe@gmail.com>: > ср, 12 мая 2021 г. в 12:36, Dilip Kumar <dilipbalaut@gmail.com>: > >> On Wed, 12 May 2021 at 1:43 PM, Pavel Borisov <pashkin.elfe@gmail.com> >> wrote: >> >>> ср, 12 мая 2021 г. в 11:09, Dilip Kumar <dilipbalaut@gmail.com>: >>> >>>> While testing something on spgist I found that at certain point while >>>> inserting in spgist it is going for doPickSplit, but even after split >>>> is is not able to find a place to insert a tuple and it keeping going >>>> in that loop infinitely it seems and finally error out with OOM >>>> because in this loop we are continuously allocating memory for the >>>> tuple in temp context but since we are never coming out of the loop it >>>> is erroring out with OOM. >>>> >>>> My first idea is that this is the case when index tuple doesn't fit >>> into one index page. As INCLUDED columns are added as is the tuple can not >>> be made shorter by prefix-stripping. Seems we should check every index >>> tuple length to fit the page before its insertion. >>> >> >> Thanks for looking into this. >> >> Will see the code little bit later. >>> >> >> Ok >> > PFA v1 patch. Does this help? > I've made a mistake in attributes count in v1. PFA v2 -- Best regards, Pavel Borisov Postgres Professional: http://postgrespro.com <http://www.postgrespro.com>
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