Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nNFtW-0007k5-Hc for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Feb 2022 15:19:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nNFtV-0007Ak-Gj for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Feb 2022 15:19:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nNFtU-0007AX-U6 for pgsql-bugs@lists.postgresql.org; Thu, 24 Feb 2022 15:19:01 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nNFtQ-0001ca-RZ for pgsql-bugs@lists.postgresql.org; Thu, 24 Feb 2022 15:19:00 +0000 Received: by mail-ed1-x529.google.com with SMTP id x5so3298696edd.11 for ; Thu, 24 Feb 2022 07:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=CLgxebbPV893S5KPdgRQ9ykngEMdDHTDUE5aP9layqA=; b=KyNkOCnQ8Z/ppZKyZ+H94LJ0BLOm0OOiDG2UaesY+mgbV0ZLFypeJIBtbwskB05MYX jsq/WmEz5mQIHer19BM24BPdP/GDytP4I9QVCWW+favunL2uYiCJXBh1ru86mQ5V0Qqt n0Hj9enaQrx07VuOTcFm2qHVWEpIrCgXqymiR2blAcgTT2GFtwgoQre7fqeVuUj3yzKd jWlFzctyaQc5bJLl2soYsfr6drt8giONpYOH/QgLyWj/rSzVTK40uvp9EKrgrVPR9qAM vgPzh3WFk5UYvkOBnE0fj7QbFe4uFJBAWTpaN0CXsR6+zQKsg+NY3bsqFx+/9XXgHYMY 9Yuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=CLgxebbPV893S5KPdgRQ9ykngEMdDHTDUE5aP9layqA=; b=swZguXalDDmHlR8+OZtRaZvs3qjlWhz/wBayYQP8S4ee4Hk5AWfnVH0Wz5hdek01Yp RsZKlO6MmEL5aVBNgNw5OvY0FoNhoeFfsNhTCnG9Wr45lRvFPEFa0C+npYtfXWmpko9e Tx5n33SO8Q9frRChjaJvPG1JWlKmxD/SX5TW/qwyEtSLmnmzPZf4R7S174kybT1QqsuV A9KWnlaxvt0sm/Jn8J5OJAP9T/S/Q0Cn3LCz/1xOHlQX2cK9Hj5ALPzo4alekTmhosAt fkGSrsJ7S0HSiEHuUKsQh9ZufOg5HCiiNHiEYHQGe1JD/QvIUXUpe0dY+rjaOOuVg0ZJ rEvg== X-Gm-Message-State: AOAM532XGy0JYNccwKxR8ic5QxCZvDXWuxVxKFHPjMp98nUwGlLmgZZe G9hhMTNbcoQZB6mCtY/6YJcHR0pgLzMyj8QqEp4KouRVkTrCsbrUlvRcO4E9h+iNDMPgRarO2NP eBf9T9fEX1/NyCS/QRe33iCL2+h6i/22YY+oo3XLbHbqNd7cxyyfYj/ERFt6wPCBZmtwN7YALqL U+F40BfZGKk7sAdmLxNaYjovFMPXDsWbRnFWCtk8OM0cbp X-Google-Smtp-Source: ABdhPJxWjIkdCg2O4K4iCIV8ywb8bAmIReS6/XlfqQ+RIVZohq2hgAl5bLAuws8GKKBoGYyTi84s8Q== X-Received: by 2002:a05:6402:26cb:b0:3fa:3817:1f78 with SMTP id x11-20020a05640226cb00b003fa38171f78mr2767038edd.219.1645715935513; Thu, 24 Feb 2022 07:18:55 -0800 (PST) Received: from [10.137.0.18] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id y22sm1491060ejm.225.2022.02.24.07.18.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 07:18:54 -0800 (PST) Message-ID: <14ac4567-3285-f549-67df-debaeab7719f@enterprisedb.com> Date: Thu, 24 Feb 2022 16:18:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: BUG #17406: Segmentation fault on GiST index after 14.2 upgrade Content-Language: en-US From: Tomas Vondra To: Victor Yegorov Cc: PostgreSQL mailing lists , Alexander Korotkov References: <17406-71e02820ae79bb40@postgresql.org> <788a0a51-b1e3-3601-5783-3f6488796ec4@enterprisedb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/23/22 16:41, Tomas Vondra wrote: > On 2/23/22 16:36, Tomas Vondra wrote: >>> >>> I got approval to send a table with its data and index in the subject >>> datafile. >>> Taken from the v14 database. >>> >> >> Thanks for the data! I've been able to reproduce the issue (load into >> 12, pg_upgrade to 14 and run the query). After bisecting this for a >> while, this seems like a bug in PG13 commit >> >> commit 911e70207703799605f5a0e8aad9f06cff067c63 (HEAD) >> Author: Alexander Korotkov >> Date: Mon Mar 30 19:17:11 2020 +0300 >> >> Implement operator class parameters >> >> ... >> >> It works fine when upgrading to an earlier build, and crashes since this >> commit. I haven't investigated this further, but I guess there's some >> thinko in gist_ltree_ops, affecting how we interpret existing indexes. >> >> Alexander, any ideas? >> > > Sorry, I accidentally used Alexander's old address, so let me CC him > with the correct/current one. > I tried investigating this a bit further, but my gist-foo is rather limited so I haven't made much progress so far. But as Victor already mentioned, REINDEX fixes this - so I tried comparing the broken index with a new one built on PG13. And the it seems the indexes are mostly the same, with the exception of LSN in the page header. The only page that substantially differs is the first page, which is also storing less data (the broken version): test=# SELECT * FROM page_header(get_raw_page('v3_region_copy_ltree_path_idx', 0)); lsn | checksum | flags | lower | upper | special | pagesize | ... ----------+----------+-------+-------+-------+---------+----------+- ... 0/1CD80C8 | 0 | 0 | 40 | 7856 | 8176 | 8192 | ... (1 row) test=# SELECT * FROM page_header(get_raw_page('v3_region_copy_13_ltree_path_idx', 0)); lsn | checksum | flags | lower | upper | special | pagesize | ... -----------+----------+-------+-------+-------+---------+----------+-... 0/7029760 | 0 | 0 | 40 | 7760 | 8176 | 8192 | ... (1 row) regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company