Skip to content
Snippets Groups Projects
Commit 288551fc authored by Tom Lane's avatar Tom Lane
Browse files

Repair longstanding error in btree xlog replay: XLogReadBuffer should be

passed extend = true whenever we are reading a page we intend to reinitialize
completely, even if we think the page "should exist".  This is because it
might indeed not exist, if the relation got truncated sometime after the
current xlog record was made and before the crash we're trying to recover
from.  These two thinkos appear to explain both of the old bug reports
discussed here:
http://archives.postgresql.org/pgsql-hackers/2005-05/msg01369.php
parent 4e7d10c7
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.27 2006/03/24 04:32:12 tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.28 2006/03/28 21:17:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -243,7 +243,7 @@ btree_xlog_split(bool onleft, bool isroot,
rightsib = (onleft) ? xlrec->otherblk : targetblk;
/* Left (original) sibling */
buffer = XLogReadBuffer(false, reln, leftsib);
buffer = XLogReadBuffer(true, reln, leftsib);
if (!BufferIsValid(buffer))
elog(PANIC, "btree_split_redo: lost left sibling");
......@@ -504,7 +504,7 @@ btree_xlog_delete_page(bool ismeta,
}
/* Rewrite target page as empty deleted page */
buffer = XLogReadBuffer(false, reln, target);
buffer = XLogReadBuffer(true, reln, target);
if (!BufferIsValid(buffer))
elog(PANIC, "btree_delete_page_redo: lost target page");
page = (Page) BufferGetPage(buffer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment