Skip to content

Commit c9a2b6d

Browse files
committed
Fix thinko in gistRedoPageUpdateRecord: if XLR_BKP_BLOCK_1 is set, we
don't have anything to do to the page, but we still have to adjust the incomplete_inserts list that we're maintaining in memory.
1 parent 8d02b15 commit c9a2b6d

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/backend/access/gist/gistxlog.c

Lines changed: 15 additions & 13 deletions
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/gist/gistxlog.c,v 1.14 2006/03/31 23:32:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.15 2006/04/03 16:45:50 tgl Exp $
1212
*-------------------------------------------------------------------------
1313
*/
1414
#include "postgres.h"
@@ -173,12 +173,25 @@ decodePageUpdateRecord(PageUpdateRecord *decoded, XLogRecord *record)
173173
static void
174174
gistRedoPageUpdateRecord(XLogRecPtr lsn, XLogRecord *record, bool isnewroot)
175175
{
176+
gistxlogPageUpdate *xldata = (gistxlogPageUpdate *) XLogRecGetData(record);
176177
PageUpdateRecord xlrec;
177178
Relation reln;
178179
Buffer buffer;
179180
Page page;
180181

181-
/* nothing to do if whole page was backed up (and no info to do it with) */
182+
/* we must fix incomplete_inserts list even if XLR_BKP_BLOCK_1 is set */
183+
if (ItemPointerIsValid(&(xldata->key)))
184+
{
185+
if (incomplete_inserts != NIL)
186+
forgetIncompleteInsert(xldata->node, xldata->key);
187+
188+
if (!isnewroot && xldata->blkno != GIST_ROOT_BLKNO)
189+
pushIncompleteInsert(xldata->node, lsn, xldata->key,
190+
&(xldata->blkno), 1,
191+
NULL);
192+
}
193+
194+
/* nothing else to do if page was backed up (and no info to do it with) */
182195
if (record->xl_info & XLR_BKP_BLOCK_1)
183196
return;
184197

@@ -237,17 +250,6 @@ gistRedoPageUpdateRecord(XLogRecPtr lsn, XLogRecord *record, bool isnewroot)
237250
PageSetTLI(page, ThisTimeLineID);
238251
MarkBufferDirty(buffer);
239252
UnlockReleaseBuffer(buffer);
240-
241-
if (ItemPointerIsValid(&(xlrec.data->key)))
242-
{
243-
if (incomplete_inserts != NIL)
244-
forgetIncompleteInsert(xlrec.data->node, xlrec.data->key);
245-
246-
if (!isnewroot && xlrec.data->blkno != GIST_ROOT_BLKNO)
247-
pushIncompleteInsert(xlrec.data->node, lsn, xlrec.data->key,
248-
&(xlrec.data->blkno), 1,
249-
NULL);
250-
}
251253
}
252254

253255
static void

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy