Re: Checkpoint not retrying failed fsync?

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Checkpoint not retrying failed fsync?
Date: 2018-04-05 23:36:39
Message-ID: CAEepm=1QZVZjrEEFfYAMkfhL+1FjiG7-ufQcBfOHSFqP95aOdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 6, 2018 at 11:34 AM, Andrew Gierth
<andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
>>>>>> "Thomas" == Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> writes:
>
> >> As far as I can tell from reading the code, if a checkpoint fails the
> >> checkpointer is supposed to keep all the outstanding fsync requests for
> >> next time. Am I wrong, or is there some failure in the logic to do this?
>
> Thomas> Yikes. I think this is suspicious:
>
> Yes, tracing through a checkpoint shows that this is clearly wrong.
>
> Thomas> Why is it OK to unlink the bitmapset? We still need its
> Thomas> contents, in the case that the fsync fails!
>
> Right.
>
> But I don't think just copying the value is sufficient; if a new bit was
> set while we were processing the old ones, how would we know which to
> clear? We couldn't just clear all the bits afterwards because then we
> might lose a request.

Agreed. The attached draft patch handles that correctly, I think.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
draft.patch application/octet-stream 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-04-05 23:37:42 Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS
Previous Message Andrew Gierth 2018-04-05 23:34:30 Re: Checkpoint not retrying failed fsync?