Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57b100f

Browse files
committed
Fix some more bugs in GIN's WAL replay logic.
In commit4016bde I fixed a bunch ofginxlog.c bugs having to do with not handling XLogReadBuffer failurescorrectly. However, in ginRedoUpdateMetapage and ginRedoDeleteListPages,I unaccountably thought that failure to read the metapage would beimpossible and just put in an elog(PANIC) call. This is of course wrong:failure is exactly what will happen if the index got dropped (or rebuilt)between creation of the WAL record and the crash we're trying to recoverfrom. I believe this explains Nicholas Wilson's recent report of theseerrors getting reached.Also, fix memory leak in forgetIncompleteSplit. This wasn't of muchconcern when the code was written, but in a long-running standby serverpage split records could be expected to accumulate indefinitely.Back-patch to 8.4 --- before that, GIN didn't have a metapage.
1 parent64c47e4 commit57b100f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/access/gin/ginxlog.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ forgetIncompleteSplit(RelFileNode node, BlockNumber leftBlkno, BlockNumber updat
5959
{
6060
ginIncompleteSplit*split= (ginIncompleteSplit*)lfirst(l);
6161

62-
if (RelFileNodeEquals(node,split->node)&&leftBlkno==split->leftBlkno&&updateBlkno==split->rightBlkno)
62+
if (RelFileNodeEquals(node,split->node)&&
63+
leftBlkno==split->leftBlkno&&
64+
updateBlkno==split->rightBlkno)
6365
{
6466
incomplete_splits=list_delete_ptr(incomplete_splits,split);
67+
pfree(split);
6568
break;
6669
}
6770
}
@@ -487,7 +490,7 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
487490

488491
metabuffer=XLogReadBuffer(data->node,GIN_METAPAGE_BLKNO, false);
489492
if (!BufferIsValid(metabuffer))
490-
elog(PANIC,"GIN metapage disappeared");
493+
return;/* assume index was deleted, nothing to do */
491494
metapage=BufferGetPage(metabuffer);
492495

493496
if (!XLByteLE(lsn,PageGetLSN(metapage)))
@@ -632,7 +635,7 @@ ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
632635

633636
metabuffer=XLogReadBuffer(data->node,GIN_METAPAGE_BLKNO, false);
634637
if (!BufferIsValid(metabuffer))
635-
elog(PANIC,"GIN metapage disappeared");
638+
return;/* assume index was deleted, nothing to do */
636639
metapage=BufferGetPage(metabuffer);
637640

638641
if (!XLByteLE(lsn,PageGetLSN(metapage)))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp