From: Eric Sandeen <sandeen@sandeen.net>
To: Stefan Ring <stefanrin@gmail.com>
Cc: Steve Bergman <sbergman27@gmail.com>,
Ric Wheeler <rwheeler@redhat.com>, Linux fs XFS <xfs@oss.sgi.com>
Subject: Re: Questions about XFS
Date: Tue, 11 Jun 2013 13:03:18 -0500 [thread overview]
Message-ID: <51B76666.1020900@sandeen.net> (raw)
In-Reply-To: <CAAxjCEwvudBHV1LAEKOabTBk7no4uXV8RbfZDbm5E=TjA_Vm5A@mail.gmail.com>
On 6/11/13 12:41 PM, Stefan Ring wrote:
>>> Every database software will do the flushing correctly.
>>
>>
>> Stefan, you are making my point because every database will do the right
>> thing, it won't rely on ext3's magic every 5 second fsync :)
>
> Ok, let us agree on this one then ;)
>
> There is still kind of a dichotomy regarding the entire issue. While
> in many cases, noone will complain about a few seconds of lost data,
> it is an entirely different beast if you lose an entire file that may
> have been added to and maintained over month/years, just because the
> system went down at an unfortunate moment. In my opinion, having a
> consistent, yet possibly somewhat outdated file, is much more
> important than having the most recent view in an inconsistent/broken
> state.
But the application needs to watch out for that too. Appending to, or
overwriting part of a file, should never result in whole-file loss on a crash,
although it may lead to data inconsistency. If you truncate the file and rewrite,
there is more risk.
If you want atomic updates so that you get either-old-or-new-version,
that can be accomplished.
>From the LWN article we keep linking to ;)
Similarly, if you encounter a system failure (such as power loss, ENOSPC or an I/O error) while overwriting a file, it can result in the loss of existing data. To avoid this problem, it is common practice (and advisable) to write the updated data to a temporary file, ensure that it is safe on stable storage, then rename the temporary file to the original file name (thus replacing the contents). This ensures an atomic update of the file, so that other readers get one copy of the data or another. The following steps are required to perform this type of update:
create a new temp file (on the same file system!)
write data to the temp file
fsync() the temp file
rename the temp file to the appropriate name
fsync() the containing directory
-Eric
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-06-11 18:03 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-11 9:56 Questions about XFS Steve Bergman
2013-06-11 13:10 ` Emmanuel Florac
2013-06-11 13:35 ` Stefan Ring
2013-06-11 13:52 ` Ric Wheeler
2013-06-11 13:59 ` Ric Wheeler
2013-06-11 16:12 ` Steve Bergman
2013-06-11 17:19 ` Ric Wheeler
2013-06-11 17:27 ` Stefan Ring
2013-06-11 17:31 ` Ric Wheeler
2013-06-11 17:41 ` Stefan Ring
2013-06-11 18:03 ` Eric Sandeen [this message]
2013-06-11 19:30 ` Steve Bergman
2013-06-11 21:03 ` Dave Chinner
2013-06-11 21:43 ` Steve Bergman
2013-06-11 17:59 ` Ben Myers
2013-06-11 17:28 ` Eric Sandeen
2013-06-11 19:17 ` Steve Bergman
2013-06-11 21:47 ` Dave Chinner
2013-07-22 14:59 ` Steve Bergman
2013-07-22 15:16 ` Steve Bergman
2013-06-12 8:26 ` Roger Oberholtzer
2013-06-12 10:34 ` Ric Wheeler
2013-06-12 13:52 ` Roger Oberholtzer
2013-06-12 12:12 ` Stan Hoeppner
2013-06-12 13:48 ` Roger Oberholtzer
2013-06-13 0:48 ` Dave Chinner
2013-06-11 19:35 ` Ben Myers
2013-06-11 19:55 ` Steve Bergman
2013-06-11 20:08 ` Ben Myers
2013-06-11 21:57 ` Matthias Schniedermeyer
2013-06-11 22:18 ` Steve Bergman
-- strict thread matches above, loose matches on Subject: below --
2013-10-25 14:28 harryxiyou
2013-10-25 14:42 ` Emmanuel Florac
2013-10-25 14:57 ` Eric Sandeen
2013-10-25 16:24 ` harryxiyou
2013-10-25 16:44 ` harryxiyou
2013-10-26 10:41 ` Stan Hoeppner
2013-10-27 3:29 ` Eric Sandeen
2013-10-25 16:13 ` harryxiyou
2013-10-25 16:16 ` Eric Sandeen
2007-03-13 13:40 clflush
2007-03-13 15:36 ` Klaus Strebel
2007-03-13 15:53 ` Stein M. Hugubakken
2007-03-13 15:55 ` Eric Sandeen
2007-03-14 16:33 ` Stewart Smith
2007-03-15 4:26 ` Taisuke Yamada
2007-03-15 9:07 ` clflush
2007-03-15 14:41 ` Geir A. Myrestrand
2007-03-16 10:36 ` Martin Steigerwald
2007-03-17 0:47 ` Jason White
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51B76666.1020900@sandeen.net \
--to=sandeen@sandeen.net \
--cc=rwheeler@redhat.com \
--cc=sbergman27@gmail.com \
--cc=stefanrin@gmail.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox