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 1igCeA-0007VZ-AN for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Dec 2019 19:00:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1igCe8-0005iT-Q8 for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Dec 2019 19:00:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1igCe8-0005iL-Fs for pgsql-bugs@lists.postgresql.org; Sat, 14 Dec 2019 19:00:08 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1igCe5-0000jB-99 for pgsql-bugs@lists.postgresql.org; Sat, 14 Dec 2019 19:00:07 +0000 Received: by mail-lf1-x144.google.com with SMTP id n25so1563700lfl.0 for ; Sat, 14 Dec 2019 11:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=UZNL00mje9o3i4Vb7uTONXADKFT+QIpqhNpPbDIrRug=; b=PporgE2ekXc7eeyfzfJoaz31v9pVYwCA1LAyf6V8RMxPL948ZExhkXFDyrOBj96oNi GX23Kux8ejjhJT7/UXU3II4GuChHB1ziOGHH3hLGwr165nSrfNASOYfXSnmMnseuhxx6 R4DN4VR3zbXDj1kdi6mmUHO15kmD31OSE25tYHBKr+4MrhfpLpaHJOJNsDRZysfda4Px QtbU6t6GF3MQ1g9nliNs0dN0aaJlhbmb7KinCXRyNnZhxEHAXnVIGvSt1gljgO4DC1Wh 7WIp/l2leAXy68EjSTDvQ71ZvtqJ0KBw9ZZOVUcKKdmpY6yeGOuL+7FYxvsaWXcMAVU5 50VA== 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-transfer-encoding :content-language; bh=UZNL00mje9o3i4Vb7uTONXADKFT+QIpqhNpPbDIrRug=; b=OXFNBfIkGl5kDLLQgMwS8wB/Ii1vwcnG+lnnlzRFpwr2qr/HIUZDmGKHvR+LvLIsNr rQs0Wu9Gz1uXI3/HQ+JdHpbRPOk21O6rcM26wOLCBJ15mIvdNeEOI2Vr8RzvqUW49cZ/ LVFbrW8p5LfKFPJxfU8lFVP5MI3z0EzRAYe3LB/L34eZ6ACo8ngTqWgywJkf/VCg2JXT NWnSLKQg8S/Kos8Stoi1pu76DC3vu3qdJgiTIFaFw9aw5UKLT/+Vf4klzJ2rV8DGespq TWqD8auW1d7HsHktHRI6Nwt7PMQHDjkdYZ8KmsjjrDRbiZnP+CB3qKFhinL/cg6v+qjy wsbA== X-Gm-Message-State: APjAAAW5tQdhOXmQSSTZHD1KizHGEdUyKYRt7KcKDa80jBxRN9KDCCmg uErdTiWMp4O2azmCl5iCss/6fY5B X-Google-Smtp-Source: APXvYqwZpJpK3oF97CohMlaki/Fy4l7DUvOZ4xterlrv4qybDQRQYTL28JqKsozO6qB2pxetc1LoWg== X-Received: by 2002:ac2:5635:: with SMTP id b21mr12018783lff.127.1576350003236; Sat, 14 Dec 2019 11:00:03 -0800 (PST) Received: from [1.0.0.7] ([178.155.4.219]) by smtp.gmail.com with ESMTPSA id h19sm7161625ljk.44.2019.12.14.11.00.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Dec 2019 11:00:02 -0800 (PST) Subject: Re: BUG #16162: create index using gist_trgm_ops leads to panic To: Heikki Linnakangas , Tomas Vondra , Jeff Janes Cc: Tom Lane , kunert@cms.hu-berlin.de, pgsql-bugs References: <16162-45d21b7b6c1a3105@postgresql.org> <20191212125023.vpk6zbbeldzmyerc@development> <26141.1576158262@sss.pgh.pa.us> <20191213001618.jqeousv77xnlds7x@development> <2ca3ae2a-e770-012b-3da1-169a3818927a@iki.fi> From: Alexander Lakhin Message-ID: Date: Sat, 14 Dec 2019 22:00:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <2ca3ae2a-e770-012b-3da1-169a3818927a@iki.fi> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: ru-RU List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Heikki, 14.12.2019 1:02, Heikki Linnakangas wrote: > 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! The script that I presented in [0] still reproduces assertion failure for me on REL_12_STABLE (fd005e1a): iteration 6 psql:/tmp/test_gist_intarray.sql:2: NOTICE:  extension "intarray" already exists, skipping CREATE EXTENSION DROP TABLE CREATE TABLE COPY 7000 INSERT 0 7000 INSERT 0 14000 INSERT 0 28000 INSERT 0 56000 psql:/tmp/test_gist_intarray.sql:10: server closed the connection unexpectedly         This probably means the server terminated abnormally         before or while processing the request. psql:/tmp/test_gist_intarray.sql:10: fatal: connection to server was lost Core was generated by `postgres: law regression [local] CREATE INDEX                                 '. Program terminated with signal SIGABRT, Aborted. #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1  0x00007f10c0ed4801 in __GI_abort () at abort.c:79 #2  0x000055cfe1d476a6 in ExceptionalCondition (     conditionName=conditionName@entry=0x55cfe1db42a8 "!(((((ItemId) (&((PageHeader) (page))->pd_linp[(todelete) - 1])))->lp_len != 0))", errorType=errorType@entry=0x55cfe1d9e788 "FailedAssertion",     fileName=fileName@entry=0x55cfe1db4250 "gistutil.c", lineNumber=lineNumber@entry=70) at assert.c:54 #3  0x000055cfe18e3dc0 in gistnospace (page=page@entry=0x7f10b8705d00 "", itvec=itvec@entry=0x7ffec1b676e0,     len=len@entry=2, todelete=todelete@entry=5, freespace=freespace@entry=819) at gistutil.c:70 #4  0x000055cfe18e1301 in gistplacetopage (rel=0x7f10c2006500, freespace=819,     giststate=giststate@entry=0x55cfe3934ec0, buffer=920, itup=itup@entry=0x7ffec1b676e0, ntup=ntup@entry=2,     oldoffnum=5, newblkno=0x0, leftchildbuf=897, splitinfo=0x7ffec1b67670, markfollowright=true,     heapRel=0x7f10c20107a0, is_build=true) at gist.c:257 ... [0] https://www.postgresql.org/message-id/16134-0423f729671dec64%40postgresql.org > > [1] https://www.postgresql.org/message-id/9409.1574617130%40sss.pgh.pa.us > > - Heikki Best regards, Alexander