squid-2.HEAD: storeCleanup and -F option (foreground rebuild)

From: Alexander V. Lukyanov <lav_at_netis.ru>
Date: Tue, 5 Aug 2008 09:58:37 +0400

Hello!

I use squid in transparent mode, so I don't want degraded performance
while rebuilding and cleanup. Here is a patch I use to make storeCleanup
do all the work at once before squid starts processing requests, when
-F option is specified on command line.

Index: store_rebuild.c
===================================================================
RCS file: /squid/squid/src/store_rebuild.c,v
retrieving revision 1.80
diff -u -p -r1.80 store_rebuild.c
--- store_rebuild.c 1 Sep 2007 23:09:32 -0000 1.80
+++ store_rebuild.c 5 Aug 2008 05:51:43 -0000
@@ -68,7 +68,8 @@ storeCleanup(void *datanotused)
     hash_link *link_ptr = NULL;
     hash_link *link_next = NULL;
     validnum_start = validnum;
- while (validnum - validnum_start < 500) {
+ int limit = opt_foreground_rebuild ? 1 << 30 : 500;
+ while (validnum - validnum_start < limit) {
         if (++bucketnum >= store_hash_buckets) {
             debug(20, 1) (" Completed Validation Procedure\n");
             debug(20, 1) (" Validated %d Entries\n", validnum);
@@ -147,8 +148,8 @@ storeRebuildComplete(struct _store_rebui
     debug(20, 1) (" Took %3.1f seconds (%6.1f objects/sec).\n", dt,
         (double) counts.objcount / (dt > 0.0 ? dt : 1.0));
     debug(20, 1) ("Beginning Validation Procedure\n");
- eventAdd("storeCleanup", storeCleanup, NULL, 0.0, 1);
     safe_free(RebuildProgress);
+ storeCleanup(0);
 }
 
 /*
Received on Tue Aug 05 2008 - 06:15:40 MDT

This archive was generated by hypermail 2.2.0 : Tue Aug 05 2008 - 01:06:36 MDT