Re: PATCH: track last known XLOG segment in control file

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: track last known XLOG segment in control file
Date: 2015-12-12 22:28:33
Message-ID: 566C9F91.60809@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/12/2015 11:20 PM, Andres Freund wrote:
> Hi,
>
> On 2015-12-12 22:14:13 +0100, Tomas Vondra wrote:
>> this is the second improvement proposed in the thread [1] about ext4 data
>> loss issue. It adds another field to control file, tracking the last known
>> WAL segment. This does not eliminate the data loss, just the silent part of
>> it when the last segment gets lost (due to forgetting the rename, deleting
>> it by mistake or whatever). The patch makes sure the cluster refuses to
>> start if that happens.
>
> Uh, that's fairly expensive. In many cases it'll significantly
> increase the number of fsyncs.

It should do exactly 1 additional fsync per WAL segment. Or do you think
otherwise?

> I've a bit of a hard time believing this'll be worthwhile.

The trouble is protections like this only seem worthwhile after the
fact, when something happens. I think it's reasonable protection against
issues similar to the one I reported ~2 weeks ago. YMMV.

> Additionally this doesn't seem to take WAL replay into account?

I think the comparison in StartupXLOG needs to be less strict, to allow
cases when we actually replay more WAL segments. Is that what you mean?

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-12-12 22:28:50 Re: Using quicksort for every external sort run
Previous Message Andres Freund 2015-12-12 22:20:23 Re: PATCH: track last known XLOG segment in control file