Re: GiST index build missing smgrimmedsync()?
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Melanie Plageman <melanieplageman@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2022-02-24T14:32:53Z
Lists: pgsql-hackers
On 23/02/2022 23:30, Melanie Plageman wrote: > I brought this up in [1] but wanted to start a dedicated thread. > > Since 16fa9b2b30a357 GiST indexes are not built in shared buffers. > However, smgrimmedsync() is not done anywhere and skipFsync=true is > always passed to smgrwrite() and smgrextend(). So, if a checkpoint > starts and finishes after WAL-logging some of the index build pages and > there is a crash sometime before the dirty pages make it to permanent > storage, won't that data be lost? Yes, good catch! > Seems like the following would address this: Committed essentially that, except that I put the smgrimmedsync in a separate if-block, and copied the comment from the similar piece of code from nbtsort.c to explain the issue. Thanks! - Heikki
Commits
-
Fix data loss on crash after sorted GiST index build.
- 6c46e8a5dfc9 15.0 landed
- 7d80e93fb1f1 14.3 landed