Skip to content

Commit 4deadd2

Browse files
arsshertristan957
authored andcommitted
Don't log 'last written LSN ahead of flushed'.
That's a valid case, as edited comment says. neondatabase/neon#1303
1 parent 0887949 commit 4deadd2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contrib/zenith/pagestore_smgr.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,16 @@ zenith_get_request_lsn(bool *latest)
592592

593593
/*
594594
* Is it possible that the last-written LSN is ahead of last flush
595-
* LSN? Probably not, we shouldn't evict a page from the buffer cache
595+
* LSN? Generally not, we shouldn't evict a page from the buffer cache
596596
* before all its modifications have been safely flushed. That's the
597-
* "WAL before data" rule. But better safe than sorry.
597+
* "WAL before data" rule. However, such case does exist at index building,
598+
* _bt_blwritepage logs the full page without flushing WAL before
599+
* smgrextend (files are fsynced before build ends).
598600
*/
599601
flushlsn = GetFlushRecPtr();
600602
if (lsn > flushlsn)
601603
{
602-
elog(LOG, "last-written LSN %X/%X is ahead of last flushed LSN %X/%X",
604+
elog(DEBUG5, "last-written LSN %X/%X is ahead of last flushed LSN %X/%X",
603605
(uint32) (lsn >> 32), (uint32) lsn,
604606
(uint32) (flushlsn >> 32), (uint32) flushlsn);
605607
XLogFlush(lsn);

0 commit comments

Comments
 (0)