#include <RockRebuild.h>

Inheritance diagram for Rock::Rebuild:
Collaboration diagram for Rock::Rebuild:

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 Rebuild (SwapDir *dir)
virtual ~Rebuild () override
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
void callStart (AsyncCall &call)
virtual void callEnd ()
 called right after the called job method More...
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
virtual void * toCbdata ()=0

Static Public Member Functions

static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...

Protected Member Functions

virtual void start () override
 prepares and initiates entry loading sequence More...
virtual bool doneAll () const override
 whether positive goal has been reached More...
virtual void swanSong () override
bool doneLoading () const
bool doneValidating () const
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...
virtual const char * status () const
 internal cleanup; do not call directly More...

Protected Attributes

const char * stopReason
 reason for forcing done() to be true More...
const char * typeName
 kid (leaf) class name, for debugging More...
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
const InstanceId< AsyncJobid
 job identifier More...

Private Member Functions

void checkpoint ()
 continues after a pause if not done More...
void steps ()
void loadingSteps ()
void validationSteps ()
void loadOneSlot ()
void validateOneEntry (const sfileno fileNo)
void validateOneSlot (const SlotId slotId)
bool importEntry (Ipc::StoreMapAnchor &anchor, const sfileno slotId, const DbCellHeader &header)
 parse StoreEntry basics and add them to the map, returning true on success More...
void freeBadEntry (const sfileno fileno, const char *eDescription)
void failure (const char *msg, int errNo=0)
LoadingEntry loadingEntry (const sfileno fileNo)
void startNewEntry (const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
 handle a slot from an entry that we have not seen before More...
void primeNewEntry (Ipc::StoreMapAnchor &anchor, const sfileno fileno, const DbCellHeader &header)
 initialize housekeeping information for a newly accepted entry More...
void finalizeOrFree (const sfileno fileNo, LoadingEntry &le)
void finalizeOrThrow (const sfileno fileNo, LoadingEntry &le)
void addSlotToEntry (const sfileno fileno, const SlotId slotId, const DbCellHeader &header)
void useNewSlot (const SlotId slotId, const DbCellHeader &header)
 handle freshly loaded (and validated) db slot header More...
LoadingSlot loadingSlot (const SlotId slotId)
void mapSlot (const SlotId slotId, const DbCellHeader &header)
 adds slot to the entry chain in the map More...
void freeUnusedSlot (const SlotId slotId, const bool invalid)
 freeSlot() for never-been-mapped slots More...
void freeSlot (const SlotId slotId, const bool invalid)
 adds slot to the free slot index More...
template<class SlotIdType >
void chainSlots (SlotIdType &from, const SlotId to)
bool sameEntry (const sfileno fileno, const DbCellHeader &header) const
 does the header belong to the fileno entry being loaded? More...

Static Private Member Functions

static void Steps (void *data)

Private Attributes

 parts of store entries being loaded from disk More...
int64_t dbSize
int dbSlotSize
 the size of a db cell, including the cell header More...
int dbSlotLimit
 total number of db cells More...
int dbEntryLimit
 maximum number of entries that can be stored in db More...
int fd
int64_t dbOffset
sfileno loadingPos
 index of the db slot being loaded from disk now More...
sfileno validationPos
 index of the loaded db slot being validated now More...
MemBuf buf
 space to load current db slot (and entry metadata) into More...
StoreRebuildData counts

Detailed Description

manages store rebuild process: loading meta information from db on disk

Definition at line 27 of file RockRebuild.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ Rebuild()

◆ ~Rebuild()

Rock::Rebuild::~Rebuild ( )

Definition at line 223 of file RockRebuild.cc.

References fd, file_close(), and parts.

Member Function Documentation

◆ addSlotToEntry()

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Referenced by AsyncJob::swanSong().


Rock::Rebuild::CBDATA_CHILD ( Rebuild  )

◆ chainSlots()

template<class SlotIdType >
void Rock::Rebuild::chainSlots ( SlotIdType &  from,
const SlotId  to 

Definition at line 628 of file RockRebuild.cc.

References assert, loadingSlot(), and Rock::LoadingSlot::more.

Referenced by addSlotToEntry().

◆ checkpoint()

void Rock::Rebuild::checkpoint ( )

Definition at line 266 of file RockRebuild.cc.

References AsyncJob::done(), eventAdd(), and Steps().

Referenced by start(), and steps().

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ done()

◆ doneAll()

bool Rock::Rebuild::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 287 of file RockRebuild.cc.

References AsyncJob::doneAll(), doneLoading(), and doneValidating().

◆ doneLoading()

bool Rock::Rebuild::doneLoading ( ) const

Definition at line 273 of file RockRebuild.cc.

References dbSlotLimit, and loadingPos.

Referenced by doneAll(), loadingSteps(), and steps().

◆ doneValidating()

bool Rock::Rebuild::doneValidating ( ) const

Definition at line 279 of file RockRebuild.cc.

References dbEntryLimit, dbSlotLimit, opt_store_doublecheck, and validationPos.

Referenced by doneAll(), and validationSteps().

◆ failure()

void Rock::Rebuild::failure ( const char *  msg,
int  errNo = 0 

◆ finalizeOrFree()

void Rock::Rebuild::finalizeOrFree ( const sfileno  fileNo,
LoadingEntry le 

Either make the entry accessible to all or free it. This method must only be called when no more entry slots are expected.

Definition at line 500 of file RockRebuild.cc.

References finalizeOrThrow(), and freeBadEntry().

Referenced by addSlotToEntry(), and validateOneEntry().

◆ finalizeOrThrow()

◆ freeBadEntry()

void Rock::Rebuild::freeBadEntry ( const sfileno  fileno,
const char *  eDescription 

Marks remaining bad entry slots as free and unlocks the entry. The map cannot do this because Loading entries may have holes in the slots chain.

Definition at line 538 of file RockRebuild.cc.

References assert, debugs, Ipc::StoreMap::forgetWritingEntry(), freeSlot(), Store::Disk::index, Rock::LoadingEntry::leCorrupted, loadingEntry(), loadingSlot(), Rock::SwapDir::map, Rock::LoadingSlot::more, sd, Rock::LoadingEntry::size, Ipc::StoreMapAnchor::start, Rock::LoadingEntry::state(), and Ipc::StoreMap::writeableEntry().

Referenced by addSlotToEntry(), finalizeOrFree(), and useNewSlot().

◆ freeSlot()

void Rock::Rebuild::freeSlot ( const SlotId  slotId,
const bool  invalid 

◆ freeUnusedSlot()

void Rock::Rebuild::freeUnusedSlot ( const SlotId  slotId,
const bool  invalid 

Definition at line 603 of file RockRebuild.cc.

References assert, freeSlot(), loadingSlot(), and Rock::LoadingSlot::mapped().

Referenced by loadOneSlot(), startNewEntry(), and useNewSlot().

◆ importEntry()

◆ loadingEntry()

Rock::LoadingEntry Rock::Rebuild::loadingEntry ( const sfileno  fileNo)

◆ loadingSlot()

Rock::LoadingSlot Rock::Rebuild::loadingSlot ( const SlotId  slotId)

◆ loadingSteps()

◆ loadOneSlot()

◆ mapSlot()

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)

Definition at line 69 of file AsyncJob.cc.

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Http::Tunneler::handleConnectionClosure(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), start(), Security::PeerConnector::start(), HttpStateData::start(), Ipc::UdsSender::timedout(), and HttpStateData::wroteLast().

◆ primeNewEntry()

◆ sameEntry()

bool Rock::Rebuild::sameEntry ( const sfileno  fileno,
const DbCellHeader header 
) const

◆ start()

◆ Start()

◆ startNewEntry()

void Rock::Rebuild::startNewEntry ( const sfileno  fileno,
const SlotId  slotId,
const DbCellHeader header 

◆ status()

◆ steps()

void Rock::Rebuild::steps ( )

Definition at line 300 of file RockRebuild.cc.

References checkpoint(), doneLoading(), loadingSteps(), and validationSteps().

Referenced by Steps().

◆ Steps()

void Rock::Rebuild::Steps ( void *  data)

Definition at line 293 of file RockRebuild.cc.

References CallJobHere, and steps().

Referenced by checkpoint().

◆ swanSong()

void Rock::Rebuild::swanSong ( )

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ useNewSlot()

◆ validateOneEntry()

◆ validateOneSlot()

void Rock::Rebuild::validateOneSlot ( const SlotId  slotId)

◆ validationSteps()

void Rock::Rebuild::validationSteps ( )

Member Data Documentation

◆ buf

MemBuf Rock::Rebuild::buf

Definition at line 87 of file RockRebuild.h.

Referenced by importEntry(), loadOneSlot(), and start().

◆ counts

StoreRebuildData Rock::Rebuild::counts

◆ dbEntryLimit

int Rock::Rebuild::dbEntryLimit

Definition at line 81 of file RockRebuild.h.

Referenced by doneValidating(), loadingEntry(), Rebuild(), start(), useNewSlot(), and validationSteps().

◆ dbOffset

int64_t Rock::Rebuild::dbOffset

Definition at line 84 of file RockRebuild.h.

Referenced by failure(), loadingSteps(), loadOneSlot(), and start().

◆ dbSize

int64_t Rock::Rebuild::dbSize

Definition at line 78 of file RockRebuild.h.

Referenced by failure(), loadingSteps(), loadOneSlot(), and Rebuild().

◆ dbSlotLimit

int Rock::Rebuild::dbSlotLimit

◆ dbSlotSize

int Rock::Rebuild::dbSlotSize

Definition at line 79 of file RockRebuild.h.

Referenced by loadingSteps(), loadOneSlot(), and Rebuild().

◆ fd

int Rock::Rebuild::fd

Definition at line 83 of file RockRebuild.h.

Referenced by loadOneSlot(), start(), and ~Rebuild().

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ loadingPos

sfileno Rock::Rebuild::loadingPos

Definition at line 85 of file RockRebuild.h.

Referenced by doneLoading(), failure(), loadingSlot(), loadingSteps(), and loadOneSlot().

◆ parts

LoadingParts* Rock::Rebuild::parts

Definition at line 76 of file RockRebuild.h.

Referenced by loadingEntry(), loadingSlot(), start(), and ~Rebuild().

◆ sd

◆ stopReason

const char* AsyncJob::stopReason

◆ typeName

◆ validationPos

sfileno Rock::Rebuild::validationPos

Definition at line 86 of file RockRebuild.h.

Referenced by doneValidating(), and validationSteps().

The documentation for this class was generated from the following files:






Web Site Translations