'Invalid lp' during heap_xlog_delete

Поиск
Список
Период
Сортировка
От Daniel Wood
Тема 'Invalid lp' during heap_xlog_delete
Дата
Msg-id 822113470.250068.1573246011818@connect.xfinity.com
обсуждение исходный текст
Ответы Re: 'Invalid lp' during heap_xlog_delete  (Michael Paquier <michael@paquier.xyz>)
Re: 'Invalid lp' during heap_xlog_delete  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Page on disk has empty lp 1
* Insert into page lp 1

checkpoint START.    Redo eventually starts here.
** Delete all rows on page.
autovac truncate
    DropRelFileNodeBuffers - dirty page NOT written. lp 1 on disk still empty
checkpoint completes
crash
    smgrtruncate - Not reached

heap_xlog_delete reads page with empty lp 1 and the delete fails.

The checkpoint can not have yet written * or ** before DropRelFileNodeBuffers invalidates either of those dirty page versions for this to repro.

Even if we reach the truncate we don't fsync it till the next checkpoint.  So on filesystems which delay metadata updates a crash can lose the truncate.

Once we do the fsync(), for the truncate, the REDO read will return BLK_NOTFOUND and the DELETE REDO attempt will be skipped.
WIthout the fsync() or crashing before the truncate, the delete redo depends on the most recent version of the page having been written by the checkpoint.

Found during stress test and verified with pg_usleep's to test hypothesis.

Is DropRelFileNodeBuffers purely for performance or would there be any correctness problems if not done.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: heapam_index_build_range_scan's anyvisible
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Monitoring disk space from within the server