Re: [SQU] feature request

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 30 Dec 2000 09:33:35 +0100

Florin Andrei wrote:

> But your proxy service is a critical one, so you don't want to stop
> Squid. If you try to run "squid -z", you get "...already running"
> and stuff like that.
> Wouldn't be nice to be able to create new swap dirs even if Squid is already
> running? And then just add the new cache to squid.conf, then run "squid -k
> reconfigure" and that's it!

Hmm.. did not have this problem in the setup I made.. it happily allowed
squid -z while the first was running. Don't know if it was because we
used Squid-2.2, or because of the chroot_dir directive, or because of
one of my other patches..
(http://squid.sourceforge.net/hno/patch-2.2.html). But I am not sure
reconfigure is capable of adding the directories (always did a full
restart of Squid)

Anyway, "squid -z" for the ufs based stores (ufs,diskd,aufs) is nothing
more than a loop which creates the L1 and L2 directories, so it can
easily be done with some other program if Squid refuses to do it..

Something like this should work:

main() {
  int L1=16;
  int L2=256;
  int l1,l2;
  char dirname[256];
  for (l1 = 0; l1 < L1; l1++) {
    for (l2 = 0 ; l2 <= L2; l2++) {
      sprintf(dirname, "%02d/%02X");
      mkdir(dirname, 0755);
    }
  }
}

> Another possible advantage: if you already have multiple cache_dir's, and
> one is corrupted, you just comment out its entry in squid.conf, reconfigure
> Squid, umount the disk, reformat it, mount, uncomment the entry, run "squid
> -z" and there you are. cache_dir recovery without stopping the service! Way
> cool...

removing cache_dir's without stopping Squid certainly requires some
recoding. adding should be quite trivial, but removing is a bit more
complicated since there might be active requests using that drive, and
you need to tell Squid to forget about any objects on that drive.

But the good thing is that there is already work going on along these
lines as part of a much larger project changing the way Squid manages
the disks. Expected to appear in Squid-2.6 or later..

--
Henrik Nordstrom
Squid hacker
--
To unsubscribe, see http://www.squid-cache.org/mailing-lists.html
Received on Sat Dec 30 2000 - 01:56:32 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:57:09 MST