Re: [7.0.2] rotating log files ...

Поиск
Список
Период
Сортировка
От Ragnar Kjørstad
Тема Re: [7.0.2] rotating log files ...
Дата
Msg-id 20000828225801.C19112@vestdata.no
обсуждение исходный текст
Ответ на Re: [7.0.2] rotating log files ...  (Dana Hudes <dhudes@hudes.org>)
Список 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

В списке pgsql-admin по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: RE: [7.0.2] rotating log files ...
Следующее
От: Ragnar Kjørstad
Дата:
Сообщение: Re: [7.0.2] rotating log files ...