Re: [squid-users] Truncate vs Unlink

From: Squid Support (Henrik Nordstrom) <hno@dont-contact.us>
Date: Thu, 23 May 2002 18:29:54 +0200

Ron Vachiyer wrote:

> I have been looking to use truncate instead of unlink to see if I can
> reduce the load slightly on my caches, however I see in the ./configure
> that it recommends against it when using AIO (we are running Linux). This
> warning has been around for a while, therefore I wanted to ask it is still
> valid or if a recent GLIBC Linux 2.4 machine can run this properly?

It is still valid.

The asyncronous nature of Squid's store maintenance allows for a window where
the file got reused before truncate/unlink. If you are using truncate then
this will truncate the new use of the same file number while it is being
written out. In theory the same problem applies on all store format.

Using unlink at least guarantees if the race occurs then it will completely
delete the object from the cache directory, a situation Squid is a bit
happier about than having corrupted files..

-- 
Basic free Squid support provided thanks to MARA Systems AB
Your source of advanced reverse proxy solutions or customized
Squid solutions. http://www.marasystems.com/products/
Received on Thu May 23 2002 - 10:30:04 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:08:12 MST