65 static int store_errors = 0;
67 static int validated = 0;
70 if (currentSearch ==
nullptr || currentSearch->
isDone())
73 size_t statCount = 500;
76 while (statCount-- && !currentSearch->
isDone() && currentSearch->
next()) {
104 if ((++validated & 0x3FFFF) == 0)
109 if (currentSearch->
isDone()) {
110 debugs(20, 2,
"Seen: " << seen <<
" entries");
112 Debug::Extra <<
"Validated " << validated <<
" Entries" <<
116 fatalf(
"Quitting after finding %d cache index inconsistencies. " \
117 "Removing cache index will force its slow rebuild. " \
118 "Removing -S will let Squid start with an inconsistent " \
119 "cache index (at your own risk).\n", store_errors);
124 currentSearch =
nullptr;
179 Debug::Extra <<
"Took " << std::setprecision(2) << dt <<
" seconds (" <<
180 ((
double)
counts.
objcount / (dt > 0.0 ? dt : 1.0)) <<
" objects/sec).");
216 static time_t last_report = 0;
221 if (sd_index_raw < 0)
225 const auto sd_index =
static_cast<size_t>(sd_index_raw);
252 const auto savedPrecision = os.precision(2);
254 os << percent <<
"% (" <<
completed <<
" out of " <<
goal <<
")";
255 (void)os.precision(savedPrecision);
257 os <<
"nothing to do";
275 const int xerrno = errno;
277 "Ignoring cached entry after meta data read failure: " <<
xstrerr(xerrno));
288 uint64_t expectedSize)
290 uint64_t swap_hdr_len = 0;
312 if (expectedSize > 0) {
315 }
else if (tmpe.
swap_file_sz == (uint64_t)(expectedSize - swap_hdr_len)) {
319 "SIZE MISMATCH " << tmpe.
swap_file_sz <<
"!=" << expectedSize);
324 debugs(47, 7,
"unknown size: " << tmpe);
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
static std::ostream & Extra(std::ostream &)
mb_size_t spaceSize() const
char * space()
returns buffer after data; does not check space existence
void appended(mb_size_t sz)
updates content size after external append
advancement of work that consists of (usually known number) of similar steps
int64_t goal
the known total number of work steps (or negative)
void print(std::ostream &os) const
brief progress report suitable for level-0/1 debugging
int64_t completed
the number of finished work steps
Store::DiskConfig cacheSwap
struct StatCounters::@112 syscalls
struct StatCounters::@112::@116 disk
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Store::Disk & disk() const
the disk this entry is [being] cached on; asserts for entries w/o a disk
cache_dir(s) indexing statistics
void updateStartTime(const timeval &dirStartTime)
maintain earliest initiation time across multiple indexing cache_dirs
bool started() const
whether we have worked on indexing this(these) cache_dir(s) before
timeval startTime
absolute time when the rebuild was initiated
int64_t validations
the number of validated cache entries, slots
virtual void next(void(callback)(void *cbdata), void *cbdata)=0
virtual StoreEntry * currentItem()=0
virtual bool isDone() const =0
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
virtual bool doubleCheck(StoreEntry &)
#define debugs(SECTION, LEVEL, CONTENT)
#define EBIT_SET(flag, bit)
#define EBIT_TEST(flag, bit)
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
void fatalf(const char *fmt,...)
int FD_READ_METHOD(int fd, char *buf, int len)
int opt_store_doublecheck
CacheDigest * store_digest
Controller & Root()
safely access controller singleton
size_t UnpackIndexSwapMeta(const MemBuf &, StoreEntry &, cache_key *)
unsigned char cache_key
Store key.
void storeDigestNoteStoreReady(void)
bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &tmpe, cache_key *key, StoreRebuildData &stats, uint64_t expectedSize)
bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &)
loads entry from disk; fills supplied memory buffer on success
static StoreRebuildData counts
void storeRebuildComplete(StoreRebuildData *dc)
static void storeCleanupComplete()
handles the completion of zero or more post-rebuild storeCleanup() steps
static store_rebuild_progress * RebuildProgress
void storeRebuildProgress(const int sd_index_raw, const int total, const int sofar)
void storeRebuildStart(void)
static void storeCleanup(void *)
double tvSubDsec(struct timeval t1, struct timeval t2)
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
void * xcalloc(size_t n, size_t sz)
const char * xstrerr(int error)