Re: [HACKERS] FATAL 1:btree: items are out of order - Mailing list pgsql-hackers

From Vadim B. Mikheev
Subject Re: [HACKERS] FATAL 1:btree: items are out of order
Date
Msg-id 4ac159fe6e5b26da856e0f6ddede7e2e
Whole thread Raw
List pgsql-hackers
I found from where problem comes. It concerns duplicates,
not variable-length attribute (var(XXX) is fixed-length attr, Marc).

Reproduction under 6.1-current:

drop table bug_duplicate;
create table bug_duplicate (x int);
create index bug_duplicate_i on bug_duplicate (x);
copy bug_duplicate from '/home/postgres/My/Btree/BUG/I2';
- --                                                   ^^
- --         408 (!) records with x = 2
vacuum bug_duplicate;

select count(*) from bug_duplicate where x = 2;
count
- -----
  408
(1 row)

insert into bug_duplicate values (1);
INSERT 1867199
select count(*) from bug_duplicate where x = 2;
count
- -----
  203
(1 row)

=============

Under 6.0:

drop table bug_duplicate;
create table bug_duplicate (x int);
create index bug_duplicate_i on bug_duplicate (x);
copy bug_duplicate from '/tmp/I2';
- --                            ^^
- --         292 (!) records with x = 2
vacuum bug_duplicate;
select count(*) from bug_duplicate where x = 2;
count
- -----

292
(1
row)

insert into bug_duplicate values (1);
select count(*) from bug_duplicate where x = 2;
count
- -----

146
(1
row)

===============

This examples are not the same as

drop table bug_duplicate;
create table bug_duplicate (x int);
create index bug_duplicate_i on bug_duplicate (x);
copy bug_duplicate from '/home/postgres/My/Btree/BUG/I2';
- --                                                   ^^
- --         = 450 records with x = 2
vacuum bug_duplicate;

And now:
vac=> select count(*) from bug_duplicate where x = 2;
count
- -----
  450
(1 row)

vac=> insert into bug_duplicate values (1);
INSERT 1695826
vac=> select count(*) from bug_duplicate where x = 2;
count
- -----
  204
(1 row)

: it's fixed currently - having 450 items with 2 splitting occures
before we inserts item with 1, - but in the new example
splitting occures when we insert item with 1.

=============

Ok. Found but unfixed, yet. I suggest to postpone release for
2-3 day and got to sleep.

Vadim

------------------------------

pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: [HACKERS] ToDo list
Next
From: bibach@execpc.com
Date:
Subject: [HACKERS] Another try at the press release