pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix data loss on crash after sorted GiST index build.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix data loss on crash after sorted GiST index build.
@ 2022-02-24 14:32 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2022-02-24 14:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix data loss on crash after sorted GiST index build.

If a checkpoint happens during sorted GiST index build, and the system
crashes after the checkpoint and after the index build has finished,
the data written to the index before the checkpoint started could be
lost. The checkpoint won't fsync 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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6c46e8a5dfc9f49e673d76fc6ae097b81d7740ef

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix data loss on crash after sorted GiST index build.
@ 2022-02-24 14:32 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2022-02-24 14:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-02-24 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 14:32 pgsql: Fix data loss on crash after sorted GiST index build. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2022-02-24 14:32 pgsql: Fix data loss on crash after sorted GiST index build. Heikki Linnakangas <heikki.linnakangas@iki.fi>

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