--------------------- PatchSet 869 Date: 2000/11/26 00:25:43 Author: rbcollins Branch: store_check Tag: (none) Log: Scheduling ACL code in place, debug levels adjusted. now onto aufs & diskd Members: src/cf.data.pre:1.4.8.1->1.4.8.2 src/store.c:1.5.4.2->1.5.4.3 src/structs.h:1.7.4.1->1.7.4.2 src/fs/ufs/store_dir_ufs.c:1.4.6.1->1.4.6.2 Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.4.8.1 retrieving revision 1.4.8.2 diff -u -r1.4.8.1 -r1.4.8.2 --- squid/src/cf.data.pre 25 Nov 2000 22:34:43 -0000 1.4.8.1 +++ squid/src/cf.data.pre 26 Nov 2000 00:25:43 -0000 1.4.8.2 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.4.8.1 2000/11/25 22:34:43 rbcollins Exp $ +# $Id: cf.data.pre,v 1.4.8.2 2000/11/26 00:25:43 rbcollins Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -3271,6 +3271,35 @@ Set this to 'round-robin' as an alternative. DOC_END +NAME: store_background_permit +TYPE: acl_access +LOC: Config.accessList.storebackgroundcheck +DEFAULT: none +DEFAULT_IF_NONE: deny all +DOC_START + Allow the store background consistency check to run. Only use + time ACL's! + + store_background_permit allow [!]aclname + + NOTE on default values: + + If there are no "background_permit" lines present, the default is to + run 24x7. + + If none of the "background_permit" lines cause a match, the check will + never run. + +NOCOMMENT_START +#Recommended configuration: +# +acl eleventotwo time 23:00-23:59 +acl eleventotwo time 00:00-02:00 +store_background_permit allow eleventotwo +NOCOMMENT_END +DOC_END + + NAME: store_background_check_rate TYPE: int LOC: Config.store_background_check_rate Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.5.4.2 retrieving revision 1.5.4.3 diff -u -r1.5.4.2 -r1.5.4.3 --- squid/src/store.c 25 Nov 2000 22:58:02 -0000 1.5.4.2 +++ squid/src/store.c 26 Nov 2000 00:25:44 -0000 1.5.4.3 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.5.4.2 2000/11/25 22:58:02 rbcollins Exp $ + * $Id: store.c,v 1.5.4.3 2000/11/26 00:25:44 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -795,20 +795,42 @@ static int bucketnum = -1; static int validnum = 0; static int store_errors = 0; + static unsigned int checkedonce = 0; + int runnow = 1; int validnum_start; + aclCheck_t *cl; StoreEntry *e; hash_link *link_ptr = NULL; hash_link *link_next = NULL; validnum_start = validnum; + if (checkedonce!=0) { + if (Config.accessList.storebackgroundcheck != NULL) { + cl = aclChecklistCreate(Config.accessList.storebackgroundcheck, + NULL, NULL); + runnow = aclCheckFast(Config.accessList.storebackgroundcheck, cl); + aclChecklistFree(cl); + } + } + if (!runnow) { + /* we don't calculate when next to run, because a reconfigure might + * occur in the middle. + * TODO: calculate when to run, and on reconfigure remove and reinsert + * the event + */ + debug (20,9) ("storeBackgroundCheck: deferring check\n"); + eventAdd("storeBackground", storeBackgroundCheck, NULL, 1.0, 1); + return; + } if (validnum==0) - debug(20,1) (" Beginning store background check at rate %d\n", Config.store_background_check_rate); + debug(20,2) (" Beginning store background check at rate %d\n", Config.store_background_check_rate); while (validnum - validnum_start < Config.store_background_check_rate) { if (++bucketnum >= store_hash_buckets) { - debug(20, 1) (" Completed Background Check Loop\n"); - debug(20, 1) (" Rechecked %d Entries\n", validnum); - debug(20, 1) (" store_swap_size = %dk\n", store_swap_size); + debug(20, 2) (" Completed Background Check Loop\n"); + debug(20, 2) (" Rechecked %d Entries\n", validnum); + debug(20, 2) (" store_swap_size = %dk\n", store_swap_size); bucketnum = -1; validnum = 0; + checkedonce=1; eventAdd("storeBackground", storeBackgroundCheck, NULL, 1.0, 1); return; } @@ -830,7 +852,7 @@ storeDirUpdateSwapSize(&Config.cacheSwap.swapDirs[e->swap_dirn], e->swap_file_sz, 1); #endif if ((++validnum & 0x3FFFF) == 0) - debug(20, 1) (" %7d Entries Validated so far.\n", validnum); + debug(20, 2) (" %7d Entries Validated so far.\n", validnum); } } eventAdd("storeBackground", storeBackgroundCheck, NULL, 1.0, 1); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.7.4.1 retrieving revision 1.7.4.2 diff -u -r1.7.4.1 -r1.7.4.2 --- squid/src/structs.h 25 Nov 2000 22:34:43 -0000 1.7.4.1 +++ squid/src/structs.h 26 Nov 2000 00:25:44 -0000 1.7.4.2 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.7.4.1 2000/11/25 22:34:43 rbcollins Exp $ + * $Id: structs.h,v 1.7.4.2 2000/11/26 00:25:44 rbcollins Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -447,6 +447,7 @@ acl_access *identLookup; #endif acl_access *redirector; + acl_access *storebackgroundcheck; } accessList; acl_deny_info_list *denyInfoList; char *proxyAuthRealm; Index: squid/src/fs/ufs/store_dir_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_dir_ufs.c,v retrieving revision 1.4.6.1 retrieving revision 1.4.6.2 diff -u -r1.4.6.1 -r1.4.6.2 --- squid/src/fs/ufs/store_dir_ufs.c 25 Nov 2000 22:34:46 -0000 1.4.6.1 +++ squid/src/fs/ufs/store_dir_ufs.c 26 Nov 2000 00:25:44 -0000 1.4.6.2 @@ -1595,7 +1595,7 @@ /* we shouldn't be called until the rebuild finishes... but who knows? */ if (store_dirs_rebuilding) return 0; - rv = storeUfsCheckFile(sd, e->swap_filen, e->swap_file_sz, 1); + rv = storeUfsCheckFile(sd, e->swap_filen, e->swap_file_sz, 3); if (rv) { /* the file is faulty - missing or has a size mismatch from the