The following bug has been logged online:
Bug reference: 1731
Logged by: Adam Kruger
Email address: ackruger@hotmail.com
PostgreSQL version: 8.0.03
Operating system: Linux
Description: Indexes are corrupt following an unclean shutdown
Details:
I have encountered a condition similar to those referenced at:
http://archives.postgresql.org/pgsql-admin/2005-06/msg00051.php
and
http://archives.postgresql.org/pgsql-bugs/2005-06/msg00142.php
I have come up with a simple method for reproducing this error condition.
This method is reproducable on a linux (2.6) system with ext3 file systems
and hard disk write caching disabled.
1. Run the following script:
#########################
#!/bin/sh
/bin/su - postgres -c '/usr/bin/createdb test' && \
echo "create table t1 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t2 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t3 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t4 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t5 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t6 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t7 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t8 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ') && \
echo "create table t9 ( name varchar(20) primary key, address varchar(20)
);" \
| (/bin/su - postgres -c '/usr/bin/psql test ')
#########################
2. When the script completes, press the reset button.
3. When the system comes back up, log on and try the following:
vacuumdb -Upostgres test
An error is returned indicating that an index is not a valid btree.