mirror of
https://github.com/postgres/postgres.git
synced 2026-04-25 08:08:08 -04:00
Fix wrong WAL info value generated when gistContinueInsert() performs an
index page split. This would result in index corruption, or even more likely an error during WAL replay, if we were unlucky enough to crash during end-of-recovery cleanup after having completed an incomplete GIST insertion. Yoichi Hirai
This commit is contained in:
parent
6780cd23fb
commit
6b922abf60
1 changed files with 5 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
|||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.24 2006/10/04 00:29:48 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.24.2.1 2009/12/24 17:52:25 tgl Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
|
@ -649,6 +649,7 @@ gistContinueInsert(gistIncompleteInsert *insert)
|
|||
int j,
|
||||
k,
|
||||
pituplen = 0;
|
||||
uint8 xlinfo;
|
||||
XLogRecData *rdata;
|
||||
XLogRecPtr recptr;
|
||||
Buffer tempbuffer = InvalidBuffer;
|
||||
|
|
@ -737,6 +738,7 @@ gistContinueInsert(gistIncompleteInsert *insert)
|
|||
for (j = 0; j < ntodelete; j++)
|
||||
PageIndexTupleDelete(pages[0], todelete[j]);
|
||||
|
||||
xlinfo = XLOG_GIST_PAGE_SPLIT;
|
||||
rdata = formSplitRdata(index->rd_node, insert->path[i],
|
||||
false, &(insert->key),
|
||||
gistMakePageLayout(buffers, numbuffer));
|
||||
|
|
@ -750,6 +752,7 @@ gistContinueInsert(gistIncompleteInsert *insert)
|
|||
PageIndexTupleDelete(pages[0], todelete[j]);
|
||||
gistfillbuffer(index, pages[0], itup, lenitup, InvalidOffsetNumber);
|
||||
|
||||
xlinfo = XLOG_GIST_PAGE_UPDATE;
|
||||
rdata = formUpdateRdata(index->rd_node, buffers[0],
|
||||
todelete, ntodelete,
|
||||
itup, lenitup, &(insert->key));
|
||||
|
|
@ -766,7 +769,7 @@ gistContinueInsert(gistIncompleteInsert *insert)
|
|||
GistPageGetOpaque(pages[j])->rightlink = InvalidBlockNumber;
|
||||
MarkBufferDirty(buffers[j]);
|
||||
}
|
||||
recptr = XLogInsert(RM_GIST_ID, XLOG_GIST_PAGE_UPDATE, rdata);
|
||||
recptr = XLogInsert(RM_GIST_ID, xlinfo, rdata);
|
||||
for (j = 0; j < numbuffer; j++)
|
||||
{
|
||||
PageSetLSN(pages[j], recptr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue