Re: BUG #16162: create index using gist_trgm_ops leads to panic

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, kunert(at)cms(dot)hu-berlin(dot)de, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Alexander Lakhin <exclusion(at)gmail(dot)com>
Subject: Re: BUG #16162: create index using gist_trgm_ops leads to panic
Date: 2019-12-13 22:02:52
Message-ID: 2ca3ae2a-e770-012b-3da1-169a3818927a@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 13/12/2019 02:16, Tomas Vondra wrote:
> On Thu, Dec 12, 2019 at 07:05:53PM -0500, Jeff Janes wrote:
>> On Thu, Dec 12, 2019 at 8:44 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I wonder if this could be a recently-introduced bug? I do not
>>> recall seeing complaints like this before v12.
>>
>> Looks like the culprit is:
>>
>> commit 9155580fd5fc2a0cbb23376dfca7cd21f59c2c7b
>> Author: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
>> Date: Wed Apr 3 17:03:15 2019 +0300
>>
>> Generate less WAL during GiST, GIN and SP-GiST index build.
>>
>> The commit before went 150 iterations with no failures, while this one
>> failed on the 15th iteration, then again on 4th.
>
> Thanks for the bisect. I've planned to try reproducing this on 11, but
> this commit only in 12, so Tom is right it's a recent bug.

Like Tom suspected at [1], the bug was that the parent page got split,
and the stacked information wasn't updated. The code called
gistFindCorrectParent(), which should've updated the stack, but that
function checked the LSN of the page and did nothing if it matched. To
trigger the bug, you needed to have an insertion that split a page into
three (or more) pages, and inserting the downlink caused the parent page
to split, too.

Committed a fix. Many thanks for the reproducer scripts, Andreas and
Alexander!

[1] https://www.postgresql.org/message-id/9409.1574617130%40sss.pgh.pa.us

- Heikki

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeremy Schneider 2019-12-14 00:13:35 Re: logical decoding bug: segfault in ReorderBufferToastReplace()
Previous Message Tom Lane 2019-12-13 19:16:41 Re: BUG #16059: Tab-completion of filenames in COPY commands removes required quotes