SUMMARY: "Touch time"

From: <Klas.Erlandsson_at_europolitan.se>
Date: Mon, 17 Apr 2000 14:24:38 +0200

Hi!

Thanks to:
Dr. Thomas P. Blinn
Joerg Bruehe

> > Hi!
>
> > This is a deep unix question.
>
> > I want to know when the "touch time" is set on a file.
> > The are two possibilities:
>
> > 1. There is a write to the file and when the write is done, that's the
> > "touch time"
>
> > 2. The "touch time" is set when the write begins.
>
> > If our system with C-ISAM files crash we can then know which files we
have
> > to check for inconstancy.
>
> > Mvh Klas Erlandsson

Well, yes and no. The "mtime" in the kernel is updated, typically, for
each "write" on a file (there are various system calls that are in the
path, and the details differ depending on the file system). However,
what you REALLY need to know is "when does the updated mtime value for
a file get written persistently to disk as part of the file system's
metadata associated with the file", since, after all, it's impractical
to update the metadata on every file write. I *believe* it's updated
during a "sync" cycle, since it's modified file system data, and "sync"
is supposed to write back all modified file system data to disk, but I
would not want to promise this always happens. I am quite sure that it
is updated to disk on file close, but as long as the file is open, it's
not obvious to me (and I was looking at kernel sources) exactly when it
gets written back to the disk.

This matters because you are interested in using the data AFTER you've
had a system crash -- during a crash, if it's bad enough (power failure
is the classic case), some data may not get written back to disk, and
that's when you have problems.

What you really need to know is "which files were OPEN when the system
crashed", since C-ISAM is very sensitive to transaction semantics and
the order in which things get written to disk. Files that were not open
are not likely to have problems. There are ways to deal with this, but
they are NOT pretty. You might be better off with a relational database
system; most of them have transactional semantics and journalling built
in.

Tom
Received on Mon Apr 17 2000 - 12:25:28 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT