From: Ragnar Kjørstad <postgres@ragnark.vestdata.no>
To: Dana Hudes <dhudes@hudes.org>
Cc: Chris Ryan <chris@greatbridge.com>
Cc: Mitch Vincent <mitch@venux.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: [7.0.2] rotating log files ...
Date: Mon, 28 Aug 2000 22:58:01 +0200
Message-ID: <20000828225801.C19112@vestdata.no> (raw)
In-Reply-To: <Pine.LNX.4.21.0008281544300.32478-100000@advsol4.dsl.concentric.net>
References: <20000828212313.A19112@vestdata.no>
<Pine.LNX.4.21.0008281544300.32478-100000@advsol4.dsl.concentric.net>
On Mon, Aug 28, 2000 at 03:53:11PM -0400, Dana Hudes wrote:
> Filesystem corruption result highly likely.
> Reason: while you are touching the file, so is the process.
> It has a file handle open. Actually should be locked and it would
> be best if mv would honor that.
> Under other operating systems such as VMS, the file would be locked
> only SYSADMIN could mess with it.
> Think -- Linux is a Unix variant, a true multitasking
> multiprocessing operating (with thread (lightweight process) support, no
> less) system. While you are typing your mv command the process is running
> unless you suspend it somehow. Therefore it is busy writing to disk
> while you mess with its file. Even if you catch between writes, there is
> the write cache / ouptut buffers (which is why a close is often preceded
> by a fflush).
I think you may have gotten this wrong...
1. On linux (and most other unixes, I believe), the file-operations
(like read, write and so on) are not tied with the filenames at all.
They all work on an open filedescriptor, wich is linked to an inode.
(via a dentry, but I don't think that's rellevant). If the filename
is changed, or even removed, they don't care. Actually, if you look at
how tmpfiles are implemented, you'll find that in most systems they do
(open, unlink) and then go on working with a file.
2. rename is guaranteed to be atomic by posix, if I'm not mistaken.
The problem you're probably refering to is when deleted files stay open
and the system crashes. On non-journaling filesystems the blocks will
not be freed until fsck is run. A few filesystems have had bugs that
prevented the space from beeing freed up again - I'm not sure if theese
problems were only caused when the system crashed or also under normal
usage.
> REally you need to take some basic operating systems course (or at least
> read a book on the subject) if you do not understand.
Actually I have, and I'we been working with linux-kernel development for
some time (e.g. the reiserfs filesystem for linux) so I believe I have
some idea of what I'm talking about. I'm not too arrogant to learn
though, so let me know if there are errors in my argument.
--
Ragnar Kjorstad
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-admin@postgresql.org
Cc: postgres@ragnark.vestdata.no, dhudes@hudes.org, chris@greatbridge.com, mitch@venux.net
Subject: Re: [7.0.2] rotating log files ...
In-Reply-To: <20000828225801.C19112@vestdata.no>
References: <20000828212313.A19112@vestdata.no> <Pine.LNX.4.21.0008281544300.32478-100000@advsol4.dsl.concentric.net> <20000828225801.C19112@vestdata.no>
* 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