pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Do not emit WAL for unlogged BRIN indexes
Date: Thu, 18 Dec 2025 13:13:28 +0000
Message-ID: <E1vWDot-001QIK-1u@gemulon.postgresql.org> (raw)

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...
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(-)



view thread (6+ messages)

Message-ID: <E1vWDot-001QIK-1u@gemulon.postgresql.org>
Permalink:  ../E1vWDot-001QIK-1u@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vWDot-001QIK-1u@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Do not emit WAL for unlogged BRIN indexes
  In-Reply-To: <E1vWDot-001QIK-1u@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox