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

Commita6370fd

Browse files
committed
Ensure that XLOG_HEAP2_VISIBLE always targets an initialized page.
Andres Freund
1 parente2c84bc commita6370fd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,24 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
663663
/* empty pages are always all-visible */
664664
if (!PageIsAllVisible(page))
665665
{
666+
/*
667+
* It's possible that another backend has extended the heap,
668+
* initialized the page, and then failed to WAL-log the page
669+
* due to an ERROR. Since heap extension is not WAL-logged,
670+
* recovery might try to replay our record setting the
671+
* page all-visible and find that the page isn't initialized,
672+
* which will cause a PANIC. To prevent that, check whether
673+
* the page has been previously WAL-logged, and if not, do that
674+
* now.
675+
*
676+
* XXX: It would be nice to use a logging method supporting
677+
* standard buffers here since log_newpage_buffer() will write
678+
* the full block instead of omitting the hole.
679+
*/
680+
if (RelationNeedsWAL(onerel)&&
681+
PageGetLSN(page)==InvalidXLogRecPtr)
682+
log_newpage_buffer(buf);
683+
666684
PageSetAllVisible(page);
667685
MarkBufferDirty(buf);
668686
visibilitymap_set(onerel,blkno,buf,InvalidXLogRecPtr,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp