From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079343919494.tru64-unix-managers.marc@archive.invalid> From: Klas.Erlandsson () europolitan ! se Date: Mon, 17 Apr 2000 12:24:38 +0000 To: tru64-unix-managers Subject: SUMMARY: "Touch time" X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079343919494 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