RockRebuild.cc
Go to the documentation of this file.
85DoneValidating(const int64_t validationPos, const int64_t dbSlotLimit, const int64_t dbEntryLimit)
225 versionsOwner(createOwner<Versions>(dir.path, "rebuild_versions", dir.entryLimitActual(), resuming)),
298Rock::Rebuild::Rebuild(SwapDir *dir, const Ipc::Mem::Pointer<Stats> &s): AsyncJob("Rock::Rebuild"),
530Rock::Rebuild::importEntry(Ipc::StoreMapAnchor &anchor, const sfileno fileno, const DbCellHeader &header)
770Rock::Rebuild::addSlotToEntry(const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
830Rock::Rebuild::primeNewEntry(Ipc::StoreMap::Anchor &anchor, const sfileno fileno, const DbCellHeader &header)
846Rock::Rebuild::startNewEntry(const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
#define CallJobHere(debugSection, debugLevel, job, Class, method)
Definition: AsyncJobCalls.h:58
T::Owner * createOwner(const char *dirPath, const char *sfx, const int64_t limit, const bool resuming)
Definition: RockRebuild.cc:217
CBDATA_NAMESPACED_CLASS_INIT(Rock, Rebuild)
Definition: AsyncJob.h:32
Definition: Pointer.h:26
Class * object()
Raw access; handy to finalize initiatization, but avoid if possible.
Definition: Pointer.h:43
static Owner * Old(const char *const id)
attaches to the existing shared memory segment, becoming its owner
Definition: Pointer.h:123
static PoolId IdForSwapDirSpace(const int dirIdx)
stack of free rock cache_dir slot numbers
Definition: PageStack.h:171
Definition: Pointer.h:83
static SBuf Name(const SBuf &prefix, const char *suffix)
concatenates parts of a name to form a complete name (or its prefix)
Definition: Segment.cc:52
Definition: StoreMap.h:57
std::atomic< StoreMapSliceId > start
where the chain of StoreEntry slices begins [app]
Definition: StoreMap.h:111
bool sameKey(const cache_key *const aKey) const
Definition: StoreMap.cc:951
struct Ipc::StoreMapAnchor::Basics basics
void set(const StoreEntry &anEntry, const cache_key *aKey=nullptr)
store StoreEntry key and basics for an inode slot
Definition: StoreMap.cc:958
Definition: StoreMap.h:122
Definition: StoreMap.h:29
Definition: MemBuf.h:24
advancement of work that consists of (usually known number) of similar steps
Definition: store_rebuild.h:47
Definition: RockDbCell.h:23
bool sane(const size_t slotSize, int slotLimit) const
whether this slot is not corrupted
Definition: RockDbCell.h:33
smart StoreEntry-level info pointer (hides anti-padding LoadingParts arrays)
Definition: RockRebuild.cc:110
LoadingEntry(const sfileno fileNo, LoadingParts &source)
Definition: RockRebuild.cc:198
uint32_t & version
DbCellHeader::version to distinguish same-URL chains.
Definition: RockRebuild.cc:115
low-level anti-padding storage class for LoadingEntry and LoadingSlot flags
Definition: RockRebuild.cc:94
uint8_t state
current entry state (one of the LoadingEntry::State values)
Definition: RockRebuild.cc:99
Definition: RockRebuild.cc:162
LoadingParts(LoadingParts &&)=delete
LoadingParts(const SwapDir &dir, const bool resuming)
Definition: RockRebuild.cc:223
smart db slot-level info pointer (hides anti-padding LoadingParts arrays)
Definition: RockRebuild.cc:134
LoadingSlot(const SlotId slotId, LoadingParts &source)
Definition: RockRebuild.cc:207
Ipc::StoreMapSliceId & more
another slot in some chain belonging to the same entry (unordered!)
Definition: RockRebuild.cc:139
cache_dir indexing statistics shared across same-kid process restarts
Definition: RockRebuild.h:37
static Ipc::Mem::Owner< Stats > * Init(const SwapDir &)
Definition: RockRebuild.cc:257
bool completed(const SwapDir &) const
whether the rebuild is finished already
Definition: RockRebuild.cc:263
Definition: RockRebuild.h:31
void freeBadEntry(const sfileno fileno, const char *eDescription)
Definition: RockRebuild.cc:670
void validateOneSlot(const SlotId slotId)
Definition: RockRebuild.cc:660
void finalizeOrThrow(const sfileno fileNo, LoadingEntry &le)
Definition: RockRebuild.cc:598
void freeSlot(const SlotId slotId, const bool invalid)
adds slot to the free slot index
Definition: RockRebuild.cc:714
void primeNewEntry(Ipc::StoreMapAnchor &anchor, const sfileno fileno, const DbCellHeader &header)
initialize housekeeping information for a newly accepted entry
Definition: RockRebuild.cc:830
void addSlotToEntry(const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
Definition: RockRebuild.cc:770
void mapSlot(const SlotId slotId, const DbCellHeader &header)
adds slot to the entry chain in the map
Definition: RockRebuild.cc:744
LoadingEntry loadingEntry(const sfileno fileNo)
Definition: RockRebuild.cc:453
LoadingSlot loadingSlot(const SlotId slotId)
Definition: RockRebuild.cc:460
void chainSlots(SlotIdType &from, const SlotId to)
Definition: RockRebuild.cc:759
void validateOneEntry(const sfileno fileNo)
Definition: RockRebuild.cc:642
Rebuild(SwapDir *dir, const Ipc::Mem::Pointer< Stats > &)
Definition: RockRebuild.cc:298
bool importEntry(Ipc::StoreMapAnchor &anchor, const sfileno slotId, const DbCellHeader &header)
parse StoreEntry basics and add them to the map, returning true on success
Definition: RockRebuild.cc:530
void startNewEntry(const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
handle a slot from an entry that we have not seen before
Definition: RockRebuild.cc:846
static bool IsResponsible(const SwapDir &)
whether the current kid is responsible for rebuilding the given cache_dir
Definition: RockRebuild.cc:272
void useNewSlot(const SlotId slotId, const DbCellHeader &header)
handle freshly loaded (and validated) db slot header
Definition: RockRebuild.cc:876
bool sameEntry(const sfileno fileno, const DbCellHeader &header) const
does the header belong to the fileno entry being loaded?
Definition: RockRebuild.cc:866
void freeUnusedSlot(const SlotId slotId, const bool invalid)
freeSlot() for never-been-mapped slots
Definition: RockRebuild.cc:734
void finalizeOrFree(const sfileno fileNo, LoadingEntry &le)
Definition: RockRebuild.cc:632
Definition: RockSwapDir.h:33
Definition: Stream.h:21
Definition: Store.h:42
void updateStartTime(const timeval &dirStartTime)
maintain earliest initiation time across multiple indexing cache_dirs
Definition: store_rebuild.cc:46
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
Definition: Controller.h:134
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
int opt_store_doublecheck
int opt_foreground_rebuild
class Ping::pingStats_ stats
Definition: forward.h:28
static bool DoneLoading(const int64_t loadingPos, const int64_t dbSlotLimit)
Definition: RockRebuild.cc:79
sfileno SlotId
db cell number, starting with cell 0 (always occupied by the db header)
Definition: forward.h:33
static bool DoneValidating(const int64_t validationPos, const int64_t dbSlotLimit, const int64_t dbEntryLimit)
Definition: RockRebuild.cc:85
bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &tmpe, cache_key *key, StoreRebuildData &stats, uint64_t expectedSize)
Definition: store_rebuild.cc:275
void storeRebuildProgress(int sd_index, int total, int sofar)
Definition: store_rebuild.cc:205
bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &)
loads entry from disk; fills supplied memory buffer on success
Definition: store_rebuild.cc:254
std::atomic< uint64_t > swap_file_sz
Definition: StoreMap.h:105
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
bool IamDiskProcess() STUB_RETVAL_NOP(false) bool InDaemonMode() STUB_RETVAL_NOP(false) bool UsingSmp() STUB_RETVAL_NOP(false) bool IamCoordinatorProcess() STUB_RETVAL(false) bool IamPrimaryProcess() STUB_RETVAL(false) int NumberOfKids() STUB_RETVAL(0) void setMaxFD(void) STUB void setSystemLimits(void) STUB void squid_signal(int
whether the current process is dedicated to managing a cache_dir
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:696