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

Commit1b63075

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 parentb5c077c commit1b63075

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
@@ -58,9 +58,12 @@ forgetIncompleteSplit(RelFileNode node, BlockNumber leftBlkno, BlockNumber updat
5858
{
5959
ginIncompleteSplit*split= (ginIncompleteSplit*)lfirst(l);
6060

61-
if (RelFileNodeEquals(node,split->node)&&leftBlkno==split->leftBlkno&&updateBlkno==split->rightBlkno)
61+
if (RelFileNodeEquals(node,split->node)&&
62+
leftBlkno==split->leftBlkno&&
63+
updateBlkno==split->rightBlkno)
6264
{
6365
incomplete_splits=list_delete_ptr(incomplete_splits,split);
66+
pfree(split);
6467
break;
6568
}
6669
}
@@ -486,7 +489,7 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
486489

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

492495
if (!XLByteLE(lsn,PageGetLSN(metapage)))
@@ -631,7 +634,7 @@ ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
631634

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp