Re: crash recovery vs partially written WAL

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: crash recovery vs partially written WAL
Date: 2020-12-31 23:11:13
Message-ID: 20201231231113.GA30966@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 31, 2020 at 02:27:44PM -0500, Stephen Frost wrote:
> Greetings,
>
> * Bruce Momjian (bruce(at)momjian(dot)us) wrote:
> > On Wed, Dec 30, 2020 at 12:52:46PM -0800, Andres Freund wrote:
> > > A question from a colleague made me wonder if there are scenarios where
> > > two subsequent crashes could lead to wrong WAL to be applied.
> > >
> > > Imagine the following scenario
> > > [ xlog page 1 ][ xlog page 2 ][ xlog page 3 ][ xlog page 4 ]
> > > ^flush ^write ^insert
> > >
> > > if the machine crashes in this moment, we could end up with a situation
> > > where page 1, 3, 4 made it out out to disk, but page 2 wasn't.
> >
> > I don't see any flaw in your logic. Seems we have to zero out all
> > future WAL files, not just to the end of the current one, or at least
> > clear xlp_pageaddr on each future page.
>
> I've wondered before if we should be doing a timeline switch at the end
> of crash recovery...

For a while we had trouble tracking timeline switches, but I think we
might be fine on that now.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2021-01-01 00:23:38 Re: Deleting older versions in unique indexes to avoid page splits
Previous Message Soumyadeep Chakraborty 2020-12-31 21:02:24 Re: Table AM modifications to accept column projection lists