Re: GiST index build missing smgrimmedsync()? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: GiST index build missing smgrimmedsync()?
Date
Msg-id fe061c6b-af54-5ca6-6c05-6ec0521ba607@iki.fi
Whole thread Raw
In response to GiST index build missing smgrimmedsync()?  (Melanie Plageman <melanieplageman@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Dagfinn Ilmari Mannsåker
Date:
Subject: Re: Add id's to various elements in protocol.sgml
Next
From: Andres Freund
Date:
Subject: Re: convert libpq uri-regress tests to tap test