8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.6 2005/06/30 17:52:14 teodor Exp $
11
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.7 2005/07/01 13:18:17 teodor Exp $
12
12
*-------------------------------------------------------------------------
13
13
*/
14
14
#include "postgres.h"
@@ -162,7 +162,7 @@ gistRedoEntryUpdateRecord(XLogRecPtr lsn, XLogRecord *record, bool isnewroot) {
162
162
return ;
163
163
buffer = XLogReadBuffer (false, reln , xlrec .data -> blkno );
164
164
if (!BufferIsValid (buffer ))
165
- elog (PANIC , "gistRedoEntryUpdateRecord: block unfound" );
165
+ elog (PANIC , "gistRedoEntryUpdateRecord: block %u unfound" , xlrec . data -> blkno );
166
166
page = (Page ) BufferGetPage (buffer );
167
167
168
168
if ( isnewroot ) {
@@ -173,7 +173,7 @@ gistRedoEntryUpdateRecord(XLogRecPtr lsn, XLogRecord *record, bool isnewroot) {
173
173
}
174
174
} else {
175
175
if ( PageIsNew ((PageHeader ) page ) )
176
- elog (PANIC , "gistRedoEntryUpdateRecord: uninitialized page" );
176
+ elog (PANIC , "gistRedoEntryUpdateRecord: uninitialized page blkno %u" , xlrec . data -> blkno );
177
177
if (XLByteLE (lsn , PageGetLSN (page ))) {
178
178
LockBuffer (buffer , BUFFER_LOCK_UNLOCK );
179
179
ReleaseBuffer (buffer );
@@ -476,7 +476,7 @@ gistXLogReadAndLockBuffer( Relation r, BlockNumber blkno ) {
476
476
if (!BufferIsValid (buffer ))
477
477
elog (PANIC , "gistXLogReadAndLockBuffer: block %u unfound" , blkno );
478
478
if ( PageIsNew ( (PageHeader )(BufferGetPage (buffer )) ) )
479
- elog (PANIC , "gistXLogReadAndLockBuffer: uninitialized page %u" , blkno );
479
+ elog (PANIC , "gistXLogReadAndLockBuffer: uninitialized page blkno %u" , blkno );
480
480
481
481
return buffer ;
482
482
}
@@ -510,6 +510,15 @@ gixtxlogFindPath( Relation index, gistIncompleteInsert *insert ) {
510
510
elog (LOG , "gixtxlogFindPath: lost parent for block %u" , insert -> origblkno );
511
511
}
512
512
513
+ /*
514
+ * Continue insert after crash. In normal situation, there isn't any incomplete
515
+ * inserts, but if it might be after crash, WAL may has not a record of completetion.
516
+ *
517
+ * Although stored LSN in gistIncompleteInsert is a LSN of child page,
518
+ * we can compare it with LSN of parent, because parent is always locked
519
+ * while we change child page (look at gistmakedeal). So if parent's LSN is
520
+ * lesser than stored lsn then changes in parent doesn't do yet.
521
+ */
513
522
static void
514
523
gistContinueInsert (gistIncompleteInsert * insert ) {
515
524
IndexTuple * itup ;
@@ -574,7 +583,7 @@ gistContinueInsert(gistIncompleteInsert *insert) {
574
583
elog (PANIC , "gistContinueInsert: block %u unfound" , insert -> path [i ]);
575
584
pages [numbuffer - 1 ] = BufferGetPage ( buffers [numbuffer - 1 ] );
576
585
if ( PageIsNew ((PageHeader )(pages [numbuffer - 1 ])) )
577
- elog (PANIC , "gistContinueInsert: uninitialized page" );
586
+ elog (PANIC , "gistContinueInsert: uninitialized page blkno %u" , insert -> path [ i ] );
578
587
579
588
if (XLByteLE (insert -> lsn , PageGetLSN (pages [numbuffer - 1 ]))) {
580
589
LockBuffer (buffers [numbuffer - 1 ], BUFFER_LOCK_UNLOCK );
0 commit comments