Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Tom Lane
Alexander Korotkov writes: > Sorry for publishing a patch, which doesn't even compile. > The attached version should be good. OK, better. So to clarify: we are going to back-patch as far as v13, and then in the minor releases we are going to tell people they need to REINDEX all gist indexes on l

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Alexander Korotkov
On Thu, Mar 10, 2022 at 6:39 PM Tom Lane wrote: > Alexander Korotkov writes: > > Good. The revised patch is attached. Instead of adding argument to > > LTREE_GET_ASIGLEN(), it introduces separate LTREE_GET_SIGLEN() and > > LTREE_GET_ASIGLEN() macros. > > Um ... what I see after applying the pat

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Andres Freund
On 2022-03-10 10:43:06 -0500, Andrew Dunstan wrote: > On 3/6/22 17:33, Andres Freund wrote: > > One thing that's likely worth doing as part of the cross version upgrade > > test, > > even if it wouldn't even help in this case, is to run amcheck post > > upgrade. Just dumping data isn't going to to

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Andrew Dunstan
On 3/10/22 10:53, Tom Lane wrote: > Andrew Dunstan writes: >> On 3/6/22 17:33, Andres Freund wrote: >>> A sequence of >>> pg_upgrade; amcheck; upgrade all extensions; amcheck; >>> would make sense. >> See >>

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Tom Lane
Andrew Dunstan writes: > On 3/6/22 17:33, Andres Freund wrote: >> A sequence of >> pg_upgrade; amcheck; upgrade all extensions; amcheck; >> would make sense. > See > Does this detect the problem at hand?

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Andrew Dunstan
On 3/6/22 17:33, Andres Freund wrote: > Hi, > > On 2022-03-06 07:46:04 -0500, Andrew Dunstan wrote: >> This is an area not currently touched by the buildfarm's cross version >> upgrade testing, which basically compares a pre-upgrade and post-upgrade >> dump of the databases. The upgraded cluster

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Tom Lane
Alexander Korotkov writes: > Good. The revised patch is attached. Instead of adding argument to > LTREE_GET_ASIGLEN(), it introduces separate LTREE_GET_SIGLEN() and > LTREE_GET_ASIGLEN() macros. Um ... what I see after applying the patch is two redundant definitions of LTREE_GET_ASIGLEN, and no

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-10 Thread Tomas Vondra
On 3/10/22 08:09, Alexander Korotkov wrote: > On Tue, Mar 8, 2022 at 2:05 AM Alexander Korotkov > wrote: >> ... >> >> Good. The revised patch is attached. Instead of adding argument to >> LTREE_GET_ASIGLEN(), it introduces separate LTREE_GET_SIGLEN() and >> LTREE_GET_ASIGLEN() macros. > > No f

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-09 Thread Alexander Korotkov
On Tue, Mar 8, 2022 at 2:05 AM Alexander Korotkov wrote: > On Sun, Mar 6, 2022 at 8:28 PM Tomas Vondra > wrote: > > On 3/6/22 08:09, Alexander Korotkov wrote: > > > Sorry for this terrible oversight by me. > > > > > > On Sat, Mar 5, 2022 at 10:13 AM Tomas Vondra > > > wrote: > > >> On 3/4/22 23:

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-07 Thread Alexander Korotkov
On Sun, Mar 6, 2022 at 8:28 PM Tomas Vondra wrote: > On 3/6/22 08:09, Alexander Korotkov wrote: > > Sorry for this terrible oversight by me. > > > > On Sat, Mar 5, 2022 at 10:13 AM Tomas Vondra > > wrote: > >> On 3/4/22 23:09, Nikita Glukhov wrote: > >>> On 04.03.2022 23:28, Tom Lane wrote: > >>>

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-06 Thread Andres Freund
Hi, On 2022-03-07 01:12:07 +0200, Victor Yegorov wrote: > пн, 7 мар. 2022 г. в 00:34, Andres Freund : > > > One thing that's likely worth doing as part of the cross version upgrade > > test, > > even if it wouldn't even help in this case, is to run amcheck post > > upgrade. Just dumping data isn'

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-06 Thread Victor Yegorov
пн, 7 мар. 2022 г. в 00:34, Andres Freund : > One thing that's likely worth doing as part of the cross version upgrade > test, > even if it wouldn't even help in this case, is to run amcheck post > upgrade. Just dumping data isn't going to touch indices at all. > > A sequence of > pg_upgrade; am

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-06 Thread Andres Freund
Hi, On 2022-03-06 07:46:04 -0500, Andrew Dunstan wrote: > This is an area not currently touched by the buildfarm's cross version > upgrade testing, which basically compares a pre-upgrade and post-upgrade > dump of the databases. The upgraded cluster does contain > contrib_regression_ltree. > > I'

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-06 Thread Tomas Vondra
On 3/6/22 08:09, Alexander Korotkov wrote: > Hi! > > Sorry for this terrible oversight by me. > > On Sat, Mar 5, 2022 at 10:13 AM Tomas Vondra > wrote: >> On 3/4/22 23:09, Nikita Glukhov wrote: >>> On 04.03.2022 23:28, Tom Lane wrote: >>> Tomas Vondra writes: > On 3/4/22 20:29, Nikita

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-06 Thread Andrew Dunstan
On 3/4/22 15:28, Tom Lane wrote: > Tomas Vondra writes: >> On 3/4/22 20:29, Nikita Glukhov wrote: >>> So, we probably have corrupted indexes that were updated since such >>> "incomplete" upgrade of ltree. >> IIRC pg_upgrade is not expected to upgrade extensions - it keeps the >> installed versi

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-05 Thread Alexander Korotkov
Hi! Sorry for this terrible oversight by me. On Sat, Mar 5, 2022 at 10:13 AM Tomas Vondra wrote: > On 3/4/22 23:09, Nikita Glukhov wrote: > > On 04.03.2022 23:28, Tom Lane wrote: > > > >> Tomas Vondra writes: > >>> On 3/4/22 20:29, Nikita Glukhov wrote: > So, we probably have corrupted ind

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Tomas Vondra
On 3/4/22 23:09, Nikita Glukhov wrote: > On 04.03.2022 23:28, Tom Lane wrote: > >> Tomas Vondra writes: >>> On 3/4/22 20:29, Nikita Glukhov wrote: So, we probably have corrupted indexes that were updated since such "incomplete" upgrade of ltree. >>> IIRC pg_upgrade is not expected to u

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Nikita Glukhov
On 04.03.2022 23:28, Tom Lane wrote: Tomas Vondra writes: On 3/4/22 20:29, Nikita Glukhov wrote: So, we probably have corrupted indexes that were updated since such "incomplete" upgrade of ltree. IIRC pg_upgrade is not expected to upgrade extensions - it keeps the installed version of the ex

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Tom Lane
Tomas Vondra writes: > On 3/4/22 20:29, Nikita Glukhov wrote: >> So, we probably have corrupted indexes that were updated since such >> "incomplete" upgrade of ltree. > IIRC pg_upgrade is not expected to upgrade extensions - it keeps the > installed version of the extension, and that's intention

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Tomas Vondra
On 3/4/22 20:29, Nikita Glukhov wrote: > On 25.02.2022 00:15, Tomas Vondra wrote: > >> Hi, >> >> Victor Yegorov reported a crash related to a GiST index on ltree [1], >> following a pg_upgrade from 12.x to 14.x, with a data set reproducing >> this. I spent some time investigating this, and it se

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Nikita Glukhov
On 25.02.2022 00:15, Tomas Vondra wrote: Hi, Victor Yegorov reported a crash related to a GiST index on ltree [1], following a pg_upgrade from 12.x to 14.x, with a data set reproducing this. I spent some time investigating this, and it seems this is a silly bug in commit commit 911e70207703

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Andres Freund
Hi, On February 24, 2022 5:44:57 PM PST, Tom Lane wrote: >Tomas Vondra writes: >> I wonder if we could check the index tuple length, and adjust the siglen >> based on that, somehow ... > >In an already-corrupted index, there won't be a unique answer. If we're breaking every ltree gist index, c

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Tom Lane
Tomas Vondra writes: > I wonder if we could check the index tuple length, and adjust the siglen > based on that, somehow ... In an already-corrupted index, there won't be a unique answer. regards, tom lane

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Tomas Vondra
On 2/24/22 23:13, Tomas Vondra wrote: > > > On 2/24/22 23:06, Andres Freund wrote: >> Hi, >> >> On 2022-02-24 22:15:20 +0100, Tomas Vondra wrote: >>> After thinking about this I only see two options: >>> >>> 1) Don't apply the patch and tell everyone using ltree_gist they need to >>> rebuild t

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Tomas Vondra
On 2/24/22 23:06, Andres Freund wrote: > Hi, > > On 2022-02-24 22:15:20 +0100, Tomas Vondra wrote: >> After thinking about this I only see two options: >> >> 1) Don't apply the patch and tell everyone using ltree_gist they need to >> rebuild the index after pg_upgrade from 12 to 13+. The downsi

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Andres Freund
Hi, On 2022-02-24 22:15:20 +0100, Tomas Vondra wrote: > After thinking about this I only see two options: > > 1) Don't apply the patch and tell everyone using ltree_gist they need to > rebuild the index after pg_upgrade from 12 to 13+. The downside of this > is larger indexes (because some tuples

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Tom Lane
Tomas Vondra writes: > After thinking about this I only see two options: > 1) Don't apply the patch and tell everyone using ltree_gist they need to > rebuild the index after pg_upgrade from 12 to 13+. The downside of this > is larger indexes (because some tuples are 20B larger). > 2) Apply the p

ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-02-24 Thread Tomas Vondra
Hi, Victor Yegorov reported a crash related to a GiST index on ltree [1], following a pg_upgrade from 12.x to 14.x, with a data set reproducing this. I spent some time investigating this, and it seems this is a silly bug in commit commit 911e70207703799605f5a0e8aad9f06cff067c63 (HEAD) Author: