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: Fix data loss on crash after sorted GiST index build.
Date: Thu, 24 Feb 2022 14:32:53 +0000
Message-ID: <E1nNFAq-000Aa1-Lq@gemulon.postgresql.org> (raw)

Fix data loss on crash after sorted GiST index build.

If a checkpoint happens during the index build, and the system crashes
after the checkpoint and the index build have finished, the data written
to the index before the checkpoint started could be lost. The checkpoint
won't have fsync'd it, and it won't be replayed at crash recovery either.
Fix by calling smgrimmedsync() after the index build, just like in B-tree
index build.

Backpatch to v14 where the sorted GiST index build was introduced.

Reported-by: Melanie Plageman
Discussion: https://www.postgresql.org/message-id/CAAKRu_ZJJynimxKj5xYBSziL62-iEtPE+fx-B=JzR=jUtP92mw@mail.gmail...

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7d80e93fb1f1059ba3691b2584bb16992d7d734e

Modified Files
--------------
src/backend/access/gist/gistbuild.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)



view thread (2+ messages)  latest in thread

Message-ID: <E1nNFAq-000Aa1-Lq@gemulon.postgresql.org>
Permalink:  ../E1nNFAq-000Aa1-Lq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nNFAq-000Aa1-Lq@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Fix data loss on crash after sorted GiST index build.
  In-Reply-To: <E1nNFAq-000Aa1-Lq@gemulon.postgresql.org>
  References: <E1nNFAq-000Aa1-Lq@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