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

2008-09-12 Thread Adrian Chadd
I've committed a slightly modified version of this - store_rebuild.c
r1.80 . Take a look and see if it works for you.

Thanks!



Adrian

2008/8/5 Alexander V. Lukyanov [EMAIL PROTECTED]:
 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 -   1.80
 +++ store_rebuild.c 5 Aug 2008 05:51:43 -
 @@ -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);
  }

  /*




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

2008-08-05 Thread Alexander V. Lukyanov
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 -   1.80
+++ store_rebuild.c 5 Aug 2008 05:51:43 -
@@ -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);
 }
 
 /*


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

2008-08-05 Thread Adrian Chadd
Ok. Well, the intent of the patch makes sense to me; I'd have to stare
at it a bit to make sure the patch is the right way to do it.

Henrik?



Adrian

2008/8/5 Alexander V. Lukyanov [EMAIL PROTECTED]:
 On Tue, Aug 05, 2008 at 02:25:34PM +0800, Adrian Chadd wrote:
 Hm, so whats the behaviour without this patch?

 rebuild is done in foreground as expected, but cleanup goes in background
 in parallel with client requests. The patch fixes the second part - the 
 cleanup.

 --
   Alexander.




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

2008-08-05 Thread Adrian Chadd
Hm, so whats the behaviour without this patch?

I thought -F was meant to rebuild everything before Squid began
listening for requests..



Adrian

2008/8/5 Alexander V. Lukyanov [EMAIL PROTECTED]:
 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 -   1.80
 +++ store_rebuild.c 5 Aug 2008 05:51:43 -
 @@ -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);
  }

  /*