BUG #4567: Clustering on GIST INDEX clobbers records in table intermittently

Lists: pgsql-bugs
From: "Regina Obe" <robe(dot)dnd(at)cityofboston(dot)gov>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4567: Clustering on GIST INDEX clobbers records in table intermittently
Date: 2008-12-07 20:34:43
Message-ID: 200812072034.mB7KYhxR014227@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4567
Logged by: Regina Obe
Email address: robe(dot)dnd(at)cityofboston(dot)gov
PostgreSQL version: 8.3.5
Operating system: Numerous
Description: Clustering on GIST INDEX clobbers records in table
intermittently
Details:

This doesn't always happen to me but does intermittently, and for others it
happens all the time. Several of us have tried to recreate the issue. For
me it happens once in a while on EL 4, 8.3.5 install. We have confirmed it
happens on all GIST type indexes.

We have not noticed this problem prior to 8.3.5 -- checkout this thread for
details.
http://postgis.refractions.net/pipermail/postgis-devel/2008-December/004284.
html

http://postgis.refractions.net/pipermail/postgis-devel/2008-December/004275.
html

http://postgis.refractions.net/pipermail/postgis-devel/2008-December/004283.
html

To recreate:
1) restart your postgresql service
2) run below

test=# create temp table tmp as select st_makepoint(random(), random()) as
the_geom from generate_series(1, 10000);
SELECT
test=# create index tmp_geom_idx on tmp using gist (the_geom);
CREATE INDEX
test=# analyze tmp;
ANALYZE
test=# select count(*) from tmp;
count
-------
10000
(1 row)

test=# cluster tmp using tmp_geom_idx;
CLUSTER
test=# analyze tmp;
ANALYZE
test=# select count(*) from tmp;
count
-------
0
(1 row)

Running the same exercise for me on 8.3.1 always seems to work correctly as
far as I can tell.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Regina Obe" <robe(dot)dnd(at)cityofboston(dot)gov>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4567: Clustering on GIST INDEX clobbers records in table intermittently
Date: 2008-12-08 01:16:17
Message-ID: 4543.1228698977@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Regina Obe" <robe(dot)dnd(at)cityofboston(dot)gov> writes:
> Description: Clustering on GIST INDEX clobbers records in table
> intermittently

> This doesn't always happen to me but does intermittently, and for others it
> happens all the time.

I wonder whether this is fixed by this recent patch:
http://archives.postgresql.org/pgsql-committers/2008-12/msg00053.php

The pre-patch behavior would've depended on the value of a
never-initialized struct field, so the erratic behavior is explained
by varying contents of memory. I'm unable to make it happen in an
assert-enabled build, but that's probably because the initial contents
of a palloc'd chunk are never zeroes in such a build.

regards, tom lane


From: "Obe, Regina" <robe(dot)dnd(at)cityofboston(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>, <postgis-devel(at)postgis(dot)refractions(dot)net>
Subject: Re: BUG #4567: Clustering on GIST INDEX clobbers records in table intermittently
Date: 2008-12-08 07:51:09
Message-ID: 53F9CF533E1AA14EA1F8C5C08ABC08D204D7F07A@ZDND.DND.boston.cob
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Regina Obe" <robe(dot)dnd(at)cityofboston(dot)gov> writes:
> Description: Clustering on GIST INDEX clobbers records in table
> intermittently

> This doesn't always happen to me but does intermittently, and for others it
> happens all the time.

> I wonder whether this is fixed by this recent patch:
> http://archives.postgresql.org/pgsql-committers/2008-12/msg00053.php

> The pre-patch behavior would've depended on the value of a
> never-initialized struct field, so the erratic behavior is explained
> by varying contents of memory. I'm unable to make it happen in an
> assert-enabled build, but that's probably because the initial contents
> of a palloc'd chunk are never zeroes in such a build.

> regards, tom lane

Tom,

Thanks for the quick response on this.

Paul,
You think by chance you can test out the patch since you can make this bug happen consistently on your build.

Thanks,
Regina

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.


From: "Paul Ramsey" <pramsey(at)cleverelephant(dot)ca>
To: "PostGIS Development Discussion" <postgis-devel(at)postgis(dot)refractions(dot)net>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [postgis-devel] RE: BUG #4567: Clustering on GIST INDEX clobbers records in table intermittently
Date: 2008-12-08 19:02:08
Message-ID: 30fe546d0812081102q53f5ff58of75d74b8ea5c13c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Yes, that patch removes the bug.

P.

On Sun, Dec 7, 2008 at 11:51 PM, Obe, Regina <robe(dot)dnd(at)cityofboston(dot)gov> wrote:
> "Regina Obe" <robe(dot)dnd(at)cityofboston(dot)gov> writes:
>> Description: Clustering on GIST INDEX clobbers records in table
>> intermittently
>
>> This doesn't always happen to me but does intermittently, and for others
>> it
>> happens all the time.
>
>> I wonder whether this is fixed by this recent patch:
>> http://archives.postgresql.org/pgsql-committers/2008-12/msg00053.php
>
>> The pre-patch behavior would've depended on the value of a
>> never-initialized struct field, so the erratic behavior is explained
>> by varying contents of memory. I'm unable to make it happen in an
>> assert-enabled build, but that's probably because the initial contents
>> of a palloc'd chunk are never zeroes in such a build.
>
>> regards, tom lane
>
> Tom,
>
> Thanks for the quick response on this.
>
> Paul,
> You think by chance you can test out the patch since you can make this bug
> happen consistently on your build.
>
> Thanks,
> Regina
>
>
>
> ________________________________
>
> The substance of this message, including any attachments, may be
> confidential, legally privileged and/or exempt from disclosure pursuant to
> Massachusetts law. It is intended solely for the addressee. If you received
> this in error, please contact the sender and delete the material from any
> computer.
>
> ________________________________
>
> Help make the earth a greener place. If at all possible resist printing this
> email and join us in saving paper.
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel(at)postgis(dot)refractions(dot)net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
>