BUG #1731: Indexes are corrupt following an unclean shutdown
BUG #1731: Indexes are corrupt following an unclean shutdown
От:
"Adam Kruger" <ackruger@hotmail.com>
Дата:
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.
Re: BUG #1731: Indexes are corrupt following an unclean shutdown
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Adam Kruger" writes: > 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. Thanks for the test case. The solution (at least for the near future) seems to be to force a checkpoint during CREATE DATABASE. Until 8.0.4 is out, you can protect yourself against this problem by doing a CHECKPOINT command manually after CREATE DATABASE. I'm not certain that this explains the other reports, although it well may. The second complainant in particular didn't mention anything about the problem being in a recently-created database. regards, tom lane