Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 288551f

Browse files
committed
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
1 parent 4e7d10c commit 288551f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/access/nbtree/nbtxlog.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.27 2006/03/24 04:32:12 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.28 2006/03/28 21:17:23 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -243,7 +243,7 @@ btree_xlog_split(bool onleft, bool isroot,
243243
rightsib = (onleft) ? xlrec->otherblk : targetblk;
244244

245245
/* Left (original) sibling */
246-
buffer = XLogReadBuffer(false, reln, leftsib);
246+
buffer = XLogReadBuffer(true, reln, leftsib);
247247
if (!BufferIsValid(buffer))
248248
elog(PANIC, "btree_split_redo: lost left sibling");
249249

@@ -504,7 +504,7 @@ btree_xlog_delete_page(bool ismeta,
504504
}
505505

506506
/* Rewrite target page as empty deleted page */
507-
buffer = XLogReadBuffer(false, reln, target);
507+
buffer = XLogReadBuffer(true, reln, target);
508508
if (!BufferIsValid(buffer))
509509
elog(PANIC, "btree_delete_page_redo: lost target page");
510510
page = (Page) BufferGetPage(buffer);

0 commit comments

Comments
 (0)