]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Do not emit WAL for unlogged BRIN indexes
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 18 Dec 2025 13:08:48 +0000 (15:08 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 18 Dec 2025 13:09:26 +0000 (15:09 +0200)
commitd77a5f98176ffaf3a537f4683ec87044c21bb98c
treeb28d3509e7b0ac42616769aa003bfae29603814e
parentc3df85756ceb0246958ef2b72c04aba51e52de13
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 <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/CALdSSPhpZXVFnWjwEBNcySx_vXtXHwB2g99gE6rK0uRJm-3GgQ@mail.gmail.com
Backpatch-through: 14
src/backend/access/brin/brin_pageops.c