Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ift1g-00046h-98 for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Dec 2019 22:03:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ift1d-0000Dn-QX for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Dec 2019 22:03:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ift1d-0000Dg-Eh for pgsql-bugs@lists.postgresql.org; Fri, 13 Dec 2019 22:03:05 +0000 Received: from mail-lj1-f195.google.com ([209.85.208.195]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ift1U-0008Ln-0v for pgsql-bugs@lists.postgresql.org; Fri, 13 Dec 2019 22:03:04 +0000 Received: by mail-lj1-f195.google.com with SMTP id a13so265751ljm.10 for ; Fri, 13 Dec 2019 14:02:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r8LKTgMjfT+zfQgKQKih7HOLggM41D1aTJqyJ5Nk4Xs=; b=ofxXEdOFpSw9VqiE8o344WzsSHKI/CeZpYo5KY2Y0mdcUNCk9Pqn1D776nNrZLyB0F hXMjv5bGtly3pbNI/57cqohWrmpXxOdAdJpZtdtXwsnpsIuU/p0wv2ZsiwPTMwtnanTG Fw7yqJOMAiLy8sr7YjvLqz+a+omkQ/RUnKS1OIqigUpBj6R13JLETur0PmSXKpQSvddi EyGmeCt3eYJKy+GpJ9QsytSOPz+dbjCP0tFWWX6UjAMui2NdlC6gw0hJlUvND3hHeW4e AptFtqb3uMiDO8S/91GEjjyEfrx0kMXKo/lplHcBlgylmbUqWoDftAjJOplyswzN1ULW KYoQ== X-Gm-Message-State: APjAAAV6fR4t1vFXzIfDZiu1BYPXsTsJ3bGNaD5aiUNKjl5AMfIBEkoc fmZsLN/TshsSxaIIynDbnlY= X-Google-Smtp-Source: APXvYqx+O+ZNEtIwyxU7aQH7cee140S2kWAQFpm/xiHYZVukfTStwoEfXnT+zBQGgZfJGixj4fHDrg== X-Received: by 2002:a05:651c:8f:: with SMTP id 15mr10944950ljq.109.1576274574258; Fri, 13 Dec 2019 14:02:54 -0800 (PST) Received: from [192.168.1.10] (dsl-hkibng22-54f980-150.dhcp.inet.fi. [84.249.128.150]) by smtp.gmail.com with ESMTPSA id u25sm5164476lfk.46.2019.12.13.14.02.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Dec 2019 14:02:53 -0800 (PST) Subject: Re: BUG #16162: create index using gist_trgm_ops leads to panic To: Tomas Vondra , Jeff Janes Cc: Tom Lane , kunert@cms.hu-berlin.de, pgsql-bugs , Alexander Lakhin References: <16162-45d21b7b6c1a3105@postgresql.org> <20191212125023.vpk6zbbeldzmyerc@development> <26141.1576158262@sss.pgh.pa.us> <20191213001618.jqeousv77xnlds7x@development> From: Heikki Linnakangas Message-ID: <2ca3ae2a-e770-012b-3da1-169a3818927a@iki.fi> Date: Sat, 14 Dec 2019 00:02:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191213001618.jqeousv77xnlds7x@development> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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 >> 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