Re: [7.0.2] rotating log files ...

From: Ragnar Kjørstad <postgres(at)ragnark(dot)vestdata(dot)no>
To: Dana Hudes <dhudes(at)hudes(dot)org>
Cc: Chris Ryan <chris(at)greatbridge(dot)com>, Mitch Vincent <mitch(at)venux(dot)net>, pgsql-admin(at)postgresql(dot)org
Subject: Re: [7.0.2] rotating log files ...
Date: 2000-08-28 20:58:01
Message-ID: 20000828225801.C19112@vestdata.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ragnar Kjørstad 2000-08-28 21:07:11 Re: [7.0.2] rotating log files ...
Previous Message The Hermit Hacker 2000-08-28 20:52:17 RE: [7.0.2] rotating log files ...