WAL replay of truncate fails if the table was dropped

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: WAL replay of truncate fails if the table was dropped
Date: 2007-07-20 13:42:03
Message-ID: 46A0BBAB.5080000@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

mdtruncate throws an error if the relation file doesn't exist. However,
that's not an error condition if the relation was dropped later.
Non-existent file should be treated the same as an already truncated
file; we now end up with an unrecoverable database.

This bug seems to be present from 8.0 onwards.

Attached is a test case to reproduce it, along with a patch for CVS
HEAD, and an adapted version of the patch for 8.0-8.2.

Thanks to my colleague Dharmendra Goyal for finding this bug and
constructing an initial test case.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
crash-2.sql text/x-sql 526 bytes
truncate-replay-fix.patch text/x-diff 1.1 KB
truncate-replay-fix-80.patch text/x-diff 1.1 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2007-07-20 15:12:19 Re: WAL replay of truncate fails if the table was dropped
Previous Message Magnus Hagander 2007-07-20 08:07:43 Re: BUG #3475: SQL: 7/2 = 3