#include <RockRebuild.h>

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


class  Stats
 cache_dir indexing statistics shared across same-kid process restarts More...

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

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...
void handleStopRequest ()
 process external request to terminate now (i.e. during this async call) More...
virtual void * toCbdata ()=0

Static Public Member Functions

static bool Start (SwapDir &dir)
static void Start (const Pointer &job)

Public Attributes

const InstanceId< AsyncJobid
 job identifier More...

Protected Member Functions

 Rebuild (SwapDir *dir, const Ipc::Mem::Pointer< Stats > &)
virtual ~Rebuild () override
virtual void startShutdown () override
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...

Static Protected Member Functions

static bool IsResponsible (const SwapDir &)
 whether the current kid is responsible for rebuilding the given cache_dir 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...
bool started_ = false
 Start() has finished successfully. More...
bool swanSang_ = false
 swanSong() was called More...

Private Types

typedef void(RegisteredRunner::* Method) ()
 a pointer to one of the above notification methods 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...
SBuf progressDescription () const
void registerRunner ()
void unregisterRunner ()
 unregisters self; safe to call multiple times More...
virtual void finalizeConfig ()
virtual void claimMemoryNeeds ()
virtual void useConfig ()
virtual void startReconfigure ()
virtual void syncConfig ()
virtual void endingShutdown ()
virtual void finishShutdown ()
 Meant for cleanup of services needed by the already destroyed objects. More...

Static Private Member Functions

static void Steps (void *data)

Private Attributes

 parts of store entries being loaded from disk More...
Ipc::Mem::Pointer< Statsstats
 indexing statistics in shared memory More...
int64_t dbSize
int dbSlotSize
 the size of a db cell, including the cell header More...
int64_t dbSlotLimit
 total number of db cells More...
int64_t dbEntryLimit
 maximum number of entries that can be stored in db More...
int fd
int64_t dbOffset
int64_t loadingPos
 index of the db slot being loaded from disk now More...
int64_t validationPos
 index of the loaded db slot being validated now More...
MemBuf buf
 space to load current db slot (and entry metadata) into More...
 a reference to the shared memory counters More...
const bool resuming

Detailed Description

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

Definition at line 30 of file RockRebuild.h.

Member Typedef Documentation

◆ Method

typedef void(RegisteredRunner::* RegisteredRunner::Method) ()

Definition at line 90 of file RunnersRegistry.h.

◆ Pointer

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ Rebuild()

◆ ~Rebuild()

Rock::Rebuild::~Rebuild ( )

Definition at line 321 of file RockRebuild.cc.

References file_close().

Member Function Documentation

◆ addSlotToEntry()

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

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 102 of file AsyncJob.cc.

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


Rock::Rebuild::CBDATA_CHILD ( Rebuild  )

◆ chainSlots()

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

Definition at line 738 of file RockRebuild.cc.

References assert, and Rock::LoadingSlot::more.

◆ checkpoint()

void Rock::Rebuild::checkpoint ( )

Definition at line 374 of file RockRebuild.cc.

References eventAdd(), and Steps().

◆ claimMemoryNeeds()

virtual void RegisteredRunner::claimMemoryNeeds ( )

Called after finalizeConfig(). Meant for announcing memory reservations before memory is allocated.

Reimplemented in MemStoreRr, and IpcIoRr.

Definition at line 51 of file RunnersRegistry.h.

Referenced by RunConfigUsers().

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ done()

bool AsyncJob::done ( ) const

◆ doneAll()

bool Rock::Rebuild::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 393 of file RockRebuild.cc.

References AsyncJob::doneAll().

◆ doneLoading()

bool Rock::Rebuild::doneLoading ( ) const

Definition at line 381 of file RockRebuild.cc.

References Rock::DoneLoading().

◆ doneValidating()

bool Rock::Rebuild::doneValidating ( ) const

Definition at line 387 of file RockRebuild.cc.

References Rock::DoneValidating().

◆ endingShutdown()

virtual void RegisteredRunner::endingShutdown ( )

Called after shutdown_lifetime grace period ends and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented in Dns::ConfigRr, Auth::CredentialCacheRr, IdleConnList, and ConnStateData.

Definition at line 80 of file RunnersRegistry.h.

Referenced by SignalEngine::FinalShutdownRunners().

◆ failure()

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

Definition at line 677 of file RockRebuild.cc.

References assert, DBG_CRITICAL, debugs, fatalf(), and xstrerr().

◆ finalizeConfig()

virtual void RegisteredRunner::finalizeConfig ( )

Called after parsing squid.conf. Meant for setting configuration options that depend on other configuration options and were not explicitly configured.

Reimplemented in MemStoreRr, and sslBumpCfgRr.

Definition at line 47 of file RunnersRegistry.h.

Referenced by SquidMain().

◆ 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 611 of file RockRebuild.cc.

◆ finalizeOrThrow()

◆ finishShutdown()

virtual void RegisteredRunner::finishShutdown ( )

Definition at line 87 of file RunnersRegistry.h.

Referenced by RunRegistered(), SquidShutdown(), testRock::tearDown(), and watch_child().

◆ 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 649 of file RockRebuild.cc.

References assert, debugs, Rock::LoadingEntry::leCorrupted, Rock::LoadingEntry::size, Ipc::StoreMapAnchor::start, and Rock::LoadingEntry::state().

◆ 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 713 of file RockRebuild.cc.

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

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )

Definition at line 71 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ importEntry()

◆ IsResponsible()

bool Rock::Rebuild::IsResponsible ( const SwapDir )

Definition at line 271 of file RockRebuild.cc.

References IamDiskProcess(), and UsingSmp().

◆ loadingEntry()

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

Definition at line 452 of file RockRebuild.cc.

References Must.

◆ loadingSlot()

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

Definition at line 459 of file RockRebuild.cc.

References Must.

◆ loadingSteps()

void Rock::Rebuild::loadingSteps ( )

◆ loadOneSlot()

void Rock::Rebuild::loadOneSlot ( )

◆ mapSlot()

void Rock::Rebuild::mapSlot ( const SlotId  slotId,
const DbCellHeader header 

◆ mustStop()

◆ primeNewEntry()

◆ progressDescription()

SBuf Rock::Rebuild::progressDescription ( ) const

Definition at line 911 of file RockRebuild.cc.

References SBufStream::buf(), Debug::Extra(), and opt_store_doublecheck.

◆ registerRunner()

void IndependentRunner::registerRunner ( )

◆ sameEntry()

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

Definition at line 845 of file RockRebuild.cc.

References Rock::DbCellHeader::key, and Ipc::StoreMapAnchor::sameKey().

◆ start()

void Rock::Rebuild::start ( )

◆ Start() [1/2]

◆ Start() [2/2]

bool Rock::Rebuild::Start ( SwapDir dir)

starts indexing the given cache_dir if that indexing is necessary

whether the indexing was necessary (and, hence, started)

Definition at line 278 of file RockRebuild.cc.

References debugs, Rock::SwapDir::filePath, Store::Disk::index, Store::Disk::path, shm_old, AsyncJob::Start(), and Ping::stats.

Referenced by Rock::SwapDir::ioCompletedNotification().

◆ startNewEntry()

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

◆ startReconfigure()

virtual void RegisteredRunner::startReconfigure ( )

Called after receiving a reconfigure request and before parsing squid.conf. Meant for modules that need to prepare for their configuration being changed [outside their control]. The changes end with the syncConfig() event.

Reimplemented in Dns::ConfigRr.

Definition at line 63 of file RunnersRegistry.h.

Referenced by mainReconfigureStart().

◆ startShutdown()

void Rock::Rebuild::startShutdown ( )

Called after receiving a shutdown request and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented from RegisteredRunner.

Definition at line 331 of file RockRebuild.cc.

◆ status()

◆ steps()

void Rock::Rebuild::steps ( )

Definition at line 406 of file RockRebuild.cc.

◆ Steps()

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

Definition at line 399 of file RockRebuild.cc.

References CallJobHere.

Referenced by checkpoint().

◆ swanSong()

void Rock::Rebuild::swanSong ( )

Reimplemented from AsyncJob.

Definition at line 669 of file RockRebuild.cc.

References counts, debugs, HERE(), Store::Controller::store_dirs_rebuilding, and storeRebuildComplete().

◆ syncConfig()

virtual void RegisteredRunner::syncConfig ( )

Called after parsing squid.conf during reconfiguration. Meant for adjusting the module state based on configuration changes.

Reimplemented in Auth::CredentialCacheRr, and PeerPoolMgrsRr.

Definition at line 67 of file RunnersRegistry.h.

Referenced by mainReconfigureFinish().

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ unregisterRunner()

void IndependentRunner::unregisterRunner ( )

Definition at line 96 of file RunnersRegistry.cc.

References FindRunners().

Referenced by IndependentRunner::~IndependentRunner().

◆ useConfig()

virtual void RegisteredRunner::useConfig ( )

Called after claimMemoryNeeds(). Meant for activating modules and features using a finalized configuration with known memory requirements.

Reimplemented in TransientsRr, SharedSessionCacheRr, PeerPoolMgrsRr, MemStoreRr, Ipc::Mem::RegisteredRunner, SharedMemPagesRr, and ClientDbRr.

Definition at line 56 of file RunnersRegistry.h.

Referenced by RunConfigUsers().

◆ 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 120 of file RockRebuild.h.

◆ counts

StoreRebuildData& Rock::Rebuild::counts

Definition at line 122 of file RockRebuild.h.

◆ dbEntryLimit

int64_t Rock::Rebuild::dbEntryLimit

Definition at line 114 of file RockRebuild.h.

Referenced by Rebuild().

◆ dbOffset

int64_t Rock::Rebuild::dbOffset

Definition at line 117 of file RockRebuild.h.

◆ dbSize

int64_t Rock::Rebuild::dbSize

Definition at line 111 of file RockRebuild.h.

Referenced by Rebuild().

◆ dbSlotLimit

int64_t Rock::Rebuild::dbSlotLimit

Definition at line 113 of file RockRebuild.h.

Referenced by Rebuild().

◆ dbSlotSize

int Rock::Rebuild::dbSlotSize

Definition at line 112 of file RockRebuild.h.

Referenced by Rebuild().

◆ fd

int Rock::Rebuild::fd

Definition at line 116 of file RockRebuild.h.

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 73 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall

◆ loadingPos

int64_t Rock::Rebuild::loadingPos

Definition at line 118 of file RockRebuild.h.

◆ parts

LoadingParts* Rock::Rebuild::parts

Definition at line 107 of file RockRebuild.h.

◆ resuming

const bool Rock::Rebuild::resuming

whether we have started indexing this cache_dir before, presumably in the previous process performing the same-kid role

Definition at line 126 of file RockRebuild.h.

◆ sd

SwapDir* Rock::Rebuild::sd

Definition at line 106 of file RockRebuild.h.

Referenced by Rebuild().

◆ started_

bool AsyncJob::started_ = false

Definition at line 83 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().

◆ stats

Ipc::Mem::Pointer<Stats> Rock::Rebuild::stats

Definition at line 109 of file RockRebuild.h.

◆ stopReason

const char* AsyncJob::stopReason

◆ swanSang_

bool AsyncJob::swanSang_ = false

Definition at line 84 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().

◆ typeName

◆ validationPos

int64_t Rock::Rebuild::validationPos

Definition at line 119 of file RockRebuild.h.

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






Web Site Translations