#include "squid.h"
#include "event.h"
+#include "globals.h"
+#include "md5.h"
+#include "protos.h"
+#include "StatCounters.h"
#include "Store.h"
#include "SwapDir.h"
#include "StoreSearch.h"
size_t statCount = 500;
+ // TODO: Avoid the loop (and ENTRY_VALIDATED) unless opt_store_doublecheck.
while (statCount-- && !currentSearch->isDone() && currentSearch->next()) {
StoreEntry *e;
if (opt_store_doublecheck)
if (storeCleanupDoubleCheck(e))
- store_errors++;
+ ++store_errors;
EBIT_SET(e->flags, ENTRY_VALIDATED);
if ((++validated & 0x3FFFF) == 0)
/* TODO format the int with with a stream operator */
- debugs(20, 1, " " << validated << " Entries Validated so far.");
+ debugs(20, DBG_IMPORTANT, " " << validated << " Entries Validated so far.");
}
if (currentSearch->isDone()) {
- debugs(20, 1, " Completed Validation Procedure");
- debugs(20, 1, " Validated " << validated << " Entries");
- debugs(20, 1, " store_swap_size = " << Store::Root().currentSize() / 1024.0 << " KB");
- StoreController::store_dirs_rebuilding--;
+ debugs(20, DBG_IMPORTANT, " Completed Validation Procedure");
+ debugs(20, DBG_IMPORTANT, " Validated " << validated << " Entries");
+ debugs(20, DBG_IMPORTANT, " store_swap_size = " << Store::Root().currentSize() / 1024.0 << " KB");
+ --StoreController::store_dirs_rebuilding;
assert(0 == StoreController::store_dirs_rebuilding);
- if (opt_store_doublecheck)
- assert(store_errors == 0);
+ if (opt_store_doublecheck && store_errors) {
+ fatalf("Quitting after finding %d cache index inconsistencies. " \
+ "Removing cache index will force its slow rebuild. " \
+ "Removing -S will let Squid start with an inconsistent " \
+ "cache index (at your own risk).\n", store_errors);
+ }
if (store_digest)
storeDigestNoteStoreReady();
dt = tvSubDsec(rebuild_start, current_time);
- debugs(20, 1, "Finished rebuilding storage from disk.");
- debugs(20, 1, " " << std::setw(7) << counts.scancount << " Entries scanned");
- debugs(20, 1, " " << std::setw(7) << counts.invalid << " Invalid entries.");
- debugs(20, 1, " " << std::setw(7) << counts.badflags << " With invalid flags.");
- debugs(20, 1, " " << std::setw(7) << counts.objcount << " Objects loaded.");
- debugs(20, 1, " " << std::setw(7) << counts.expcount << " Objects expired.");
- debugs(20, 1, " " << std::setw(7) << counts.cancelcount << " Objects cancelled.");
- debugs(20, 1, " " << std::setw(7) << counts.dupcount << " Duplicate URLs purged.");
- debugs(20, 1, " " << std::setw(7) << counts.clashcount << " Swapfile clashes avoided.");
- debugs(20, 1, " Took "<< std::setw(3)<< std::setprecision(2) << dt << " seconds ("<< std::setw(6) <<
+ debugs(20, DBG_IMPORTANT, "Finished rebuilding storage from disk.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.scancount << " Entries scanned");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.invalid << " Invalid entries.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.badflags << " With invalid flags.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.objcount << " Objects loaded.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.expcount << " Objects expired.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.cancelcount << " Objects cancelled.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.dupcount << " Duplicate URLs purged.");
+ debugs(20, DBG_IMPORTANT, " " << std::setw(7) << counts.clashcount << " Swapfile clashes avoided.");
+ debugs(20, DBG_IMPORTANT, " Took "<< std::setw(3)<< std::setprecision(2) << dt << " seconds ("<< std::setw(6) <<
((double) counts.objcount / (dt > 0.0 ? dt : 1.0)) << " objects/sec).");
- debugs(20, 1, "Beginning Validation Procedure");
+ debugs(20, DBG_IMPORTANT, "Beginning Validation Procedure");
eventAdd("storeCleanup", storeCleanup, NULL, 0.0, 1);
if (squid_curtime - last_report < 15)
return;
- for (sd_index = 0; sd_index < Config.cacheSwap.n_configured; sd_index++) {
+ for (sd_index = 0; sd_index < Config.cacheSwap.n_configured; ++sd_index) {
n += (double) RebuildProgress[sd_index].scanned;
d += (double) RebuildProgress[sd_index].total;
}
- debugs(20, 1, "Store rebuilding is "<< std::setw(4)<< std::setprecision(2) << 100.0 * n / d << "% complete");
+ debugs(20, DBG_IMPORTANT, "Store rebuilding is "<< std::setw(4)<< std::setprecision(2) << 100.0 * n / d << "% complete");
last_report = squid_curtime;
}
assert(buf.hasSpace()); // caller must allocate
const int len = FD_READ_METHOD(fd, buf.space(), buf.spaceSize());
- statCounter.syscalls.disk.reads++;
+ ++ statCounter.syscalls.disk.reads;
if (len < 0) {
const int xerrno = errno;
debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << diskIndex << "]: " <<
}
if (EBIT_TEST(tmpe.flags, KEY_PRIVATE)) {
- counts.badflags++;
+ ++ counts.badflags;
return false;
}
if (e->lastref >= tmpe.lastref) {
/* key already exists, old entry is newer */
/* keep old, ignore new */
- counts.dupcount++;
+ ++counts.dupcount;
// For some stores, get() creates/unpacks a store entry. Signal
// such stores that we will no longer use the get() result:
/* URL already exists, this swapfile not being used */
/* junk old, load new */
e->release(); /* release old entry */
- counts.dupcount++;
+ ++counts.dupcount;
}
}