Do not emit WAL for unlogged BRIN indexes

Operations on unlogged relations should not be WAL-logged. The
brin_initialize_empty_new_buffer() function didn't get the memo.

The function is only called when a concurrent update to a brin page
uses up space that we're just about to insert to, which makes it
pretty hard to hit. If you do manage to hit it, a full-page WAL record
is erroneously emitted for the unlogged index. If you then crash,
crash recovery will fail on that record with an error like this:

    FATAL:  could not create file "base/5/32819": File exists

Author: Kirill Reshke <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/caldssphpzxvfnwjwebncysx_vxtxhwb2g99ge6rk0urjm-3...@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ab42568695c0ddb9f3d4c2fedcc003a8b8eb15f7

Modified Files
--------------
src/backend/access/brin/brin_pageops.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Reply via email to