Re: GiST index build missing smgrimmedsync()?

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GiST index build missing smgrimmedsync()?
Date: 2022-02-24 14:32:53
Message-ID: fe061c6b-af54-5ca6-6c05-6ec0521ba607@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-02-24 14:43:11 Re: convert libpq uri-regress tests to tap test
Previous Message Dagfinn Ilmari Mannsåker 2022-02-24 13:59:04 Re: Add id's to various elements in protocol.sgml