From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Keith Fiske <keith@omniti.com>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: levertond@googlemail.com
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #10533: 9.4 beta1 assertion failure in autovacuum process
Date: Sat, 7 Jun 2014 01:11:49 +0200
Message-ID: <20140606231149.GA24880@awork2.anarazel.de> (raw)
In-Reply-To: <14003.1402093305@sss.pgh.pa.us>
References: <20140605180121.3061.28250@wrigleys.postgresql.org>
<5390BA0F.2030103@vmware.com>
<20140605213436.GA17217@awork2.anarazel.de>
<CAG1_KcB-L6AMka5NZ+JU8=0o7T9i-dqW0d90rgCnmoaSswBtaA@mail.gmail.com>
<20140606205557.GX5146@eldon.alvh.no-ip.org>
<20140606205801.GB23201@awork2.anarazel.de>
<13635.1402092233@sss.pgh.pa.us>
<20140606220537.GC23201@awork2.anarazel.de>
<14003.1402093305@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 2014-06-06 18:21:45 -0400, Tom Lane wrote:
> Also, there are a bunch of fsync_fname() calls inside critical sections in
> replication/slot.c. Seems at best pretty damn risky; what's more, the
> critical sections cover only the fsyncs and not anything else, which is
> flat out broken. If it was okay to fail just before calling the fsync,
> why is it critical to not fail inside it? Somebody was not thinking
> clearly there.
No, it actually makes sense. If:
* the open, write or fsync to the temp file fails: no permanent state
has changed. We can gracefully error out.
* rename(tmpfile, realname) fails: we know (by posix) that the file
hasn't been renamed. The old state is still valid.
* if the fsync() to the new file fails (damn unlikely) we don't know
which state is valid. So if we'd crash in that moment we might loose
our reservation on resources (e.g. catalog xmin). And might start to
decode with the wrong catalog state. Bad. On startup we'll try to
fsync the slot files again, so we won't startup until that's clear.
Why is it that risky? We fdatasync() files while inside a critical
section all the time. And we've done the space allocation (the fsync on
the old filename) and the rename() outside the critical section.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: andres@2ndquadrant.com, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, keith@omniti.com, hlinnakangas@vmware.com, levertond@googlemail.com
Subject: Re: BUG #10533: 9.4 beta1 assertion failure in autovacuum process
In-Reply-To: <20140606231149.GA24880@awork2.anarazel.de>
References: <20140605180121.3061.28250@wrigleys.postgresql.org> <5390BA0F.2030103@vmware.com> <20140605213436.GA17217@awork2.anarazel.de> <CAG1_KcB-L6AMka5NZ+JU8=0o7T9i-dqW0d90rgCnmoaSswBtaA@mail.gmail.com> <20140606205557.GX5146@eldon.alvh.no-ip.org> <20140606205801.GB23201@awork2.anarazel.de> <13635.1402092233@sss.pgh.pa.us> <20140606220537.GC23201@awork2.anarazel.de> <14003.1402093305@sss.pgh.pa.us> <20140606231149.GA24880@awork2.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox