mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
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
This commit is contained in:
parent
4e7d10c7cd
commit
288551fc60
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user