Storage Engine API
mongo::WiredTigerRecordStore Class Referenceabstract

#include <wiredtiger_record_store.h>

Inheritance diagram for mongo::WiredTigerRecordStore:
mongo::RecordStore mongo::PrefixedWiredTigerRecordStore mongo::StandardWiredTigerRecordStore

Classes

class  DataSizeChange
 
class  NumRecordsChange
 
class  OplogStones
 
struct  Params
 
class  RandomCursor
 

Public Member Functions

 WiredTigerRecordStore (WiredTigerKVEngine *kvEngine, OperationContext *opCtx, Params params)
 
virtual ~WiredTigerRecordStore ()
 
virtual void postConstructorInit (OperationContext *opCtx)
 
virtual const char * name () const
 
virtual long long dataSize (OperationContext *opCtx) const
 The dataSize is an approximation of the sum of the sizes (in bytes) of the documents or entries in the recordStore. More...
 
virtual long long numRecords (OperationContext *opCtx) const
 Total number of record in the RecordStore. More...
 
virtual bool isCapped () const
 
virtual int64_t storageSize (OperationContext *opCtx, BSONObjBuilder *extraInfo=NULL, int infoLevel=0) const
 
virtual RecordData dataFor (OperationContext *opCtx, const RecordId &id) const
 Get the RecordData at loc, which must exist. More...
 
virtual bool findRecord (OperationContext *opCtx, const RecordId &id, RecordData *out) const
 
virtual void deleteRecord (OperationContext *opCtx, const RecordId &id)
 
virtual Status insertRecords (OperationContext *opCtx, std::vector< Record > *records, std::vector< Timestamp > *timestamps, bool enforceQuota)
 
virtual StatusWith< RecordId > insertRecord (OperationContext *opCtx, const char *data, int len, Timestamp timestamp, bool enforceQuota)
 
virtual Status insertRecordsWithDocWriter (OperationContext *opCtx, const DocWriter *const *docs, const Timestamp *timestamps, size_t nDocs, RecordId *idsOut)
 Inserts nDocs documents into this RecordStore using the DocWriter interface. More...
 
virtual Status updateRecord (OperationContext *opCtx, const RecordId &oldLocation, const char *data, int len, bool enforceQuota, UpdateNotifier *notifier)
 
virtual bool updateWithDamagesSupported () const
 
virtual StatusWith< RecordDataupdateWithDamages (OperationContext *opCtx, const RecordId &id, const RecordData &oldRec, const char *damageSource, const mutablebson::DamageVector &damages)
 Updates the record positioned at 'loc' in-place using the deltas described by 'damages'. More...
 
virtual std::unique_ptr< SeekableRecordCursorgetCursor (OperationContext *opCtx, bool forward) const =0
 Returns a new cursor over this record store. More...
 
std::unique_ptr< RecordCursorgetRandomCursor (OperationContext *opCtx) const final
 Constructs a cursor over a record store that returns documents in a randomized order, and allows storage engines to provide a more efficient way of random sampling of a record store than MongoDB's default sampling methods, which is used when this method returns {}. More...
 
virtual std::unique_ptr< RecordCursorgetRandomCursorWithOptions (OperationContext *opCtx, StringData extraConfig) const =0
 
std::vector< std::unique_ptr< RecordCursor > > getManyCursors (OperationContext *opCtx) const final
 Returns many RecordCursors that partition the RecordStore into many disjoint sets. More...
 
virtual Status truncate (OperationContext *opCtx)
 removes all Records More...
 
virtual bool compactSupported () const
 does this RecordStore support the compact operation? More...
 
virtual bool compactsInPlace () const
 Does compact() leave RecordIds alone or can they change. More...
 
virtual Status compact (OperationContext *opCtx, RecordStoreCompactAdaptor *adaptor, const CompactOptions *options, CompactStats *stats)
 Attempt to reduce the storage space used by this RecordStore. More...
 
virtual bool isInRecordIdOrder () const override
 Does the RecordStore cursor retrieve its document in RecordId Order? More...
 
virtual Status validate (OperationContext *opCtx, ValidateCmdLevel level, ValidateAdaptor *adaptor, ValidateResults *results, BSONObjBuilder *output)
 
virtual void appendCustomStats (OperationContext *opCtx, BSONObjBuilder *result, double scale) const
 
virtual Status touch (OperationContext *opCtx, BSONObjBuilder *output) const
 Load all data into cache. More...
 
virtual void cappedTruncateAfter (OperationContext *opCtx, RecordId end, bool inclusive)
 Truncate documents newer than the document at 'end' from the capped collection. More...
 
virtual boost::optional< RecordId > oplogStartHack (OperationContext *opCtx, const RecordId &startingPosition) const
 Return the RecordId of an oplog entry as close to startingPosition as possible without being higher. More...
 
virtual Status oplogDiskLocRegister (OperationContext *opCtx, const Timestamp &opTime, bool orderedCommit)
 When we write to an oplog, we call this so that if the storage engine supports doc locking, it can manage the visibility of oplog entries to ensure they are ordered. More...
 
virtual void updateStatsAfterRepair (OperationContext *opCtx, long long numRecords, long long dataSize)
 Called after a repair operation is run with the recomputed numRecords and dataSize. More...
 
void waitForAllEarlierOplogWritesToBeVisible (OperationContext *opCtx) const override
 Waits for all writes that completed before this call to be visible to forward scans. More...
 
Status updateCappedSize (OperationContext *opCtx, long long cappedSize) final
 used to support online change oplog size. More...
 
void setCappedCallback (CappedCallback *cb)
 
int64_t cappedMaxDocs () const
 
int64_t cappedMaxSize () const
 
const std::string & getURI () const
 
uint64_t tableId () const
 
void setSizeStorer (WiredTigerSizeStorer *ss)
 
bool isOpHidden_forTest (const RecordId &id) const
 
bool inShutdown () const
 
void reclaimOplog (OperationContext *opCtx)
 
void reclaimOplog (OperationContext *opCtx, Timestamp persistedTimestamp)
 The persistedTimestamp is when replication recovery would need to replay from on a restart. More...
 
int64_t cappedDeleteAsNeeded (OperationContext *opCtx, const RecordId &justInserted)
 
int64_t cappedDeleteAsNeeded_inlock (OperationContext *opCtx, const RecordId &justInserted)
 
bool yieldAndAwaitOplogDeletionRequest (OperationContext *opCtx)
 
bool haveCappedWaiters ()
 
void notifyCappedWaitersIfNeeded ()
 
OplogStonesoplogStones ()
 
- Public Member Functions inherited from mongo::RecordStore
 RecordStore (StringData ns)
 
virtual ~RecordStore ()
 
virtual const std::string & ns () const
 
StatusWith< RecordId > insertRecordWithDocWriter (OperationContext *opCtx, const DocWriter *doc, Timestamp timestamp)
 A thin wrapper around insertRecordsWithDocWriter() to simplify handling of single DocWriters. More...
 
virtual std::unique_ptr< RecordCursorgetCursorForRepair (OperationContext *opCtx) const
 Constructs a cursor over a potentially corrupted store, which can be used to salvage damaged records. More...
 

Static Public Member Functions

static StatusWith< std::string > parseOptionsField (const BSONObj options)
 Parses collections options for wired tiger configuration string for table creation. More...
 
static StatusWith< std::string > generateCreateString (const std::string &engineName, StringData ns, const CollectionOptions &options, StringData extraStrings, bool prefixed)
 Creates a configuration string suitable for 'config' parameter in WT_SESSION::create(). More...
 

Protected Member Functions

virtual RecordId getKey (WT_CURSOR *cursor) const =0
 
virtual void setKey (WT_CURSOR *cursor, RecordId id) const =0
 

Private Member Functions

Status _insertRecords (OperationContext *opCtx, Record *records, const Timestamp *timestamps, size_t nRecords)
 
RecordId _nextId ()
 
void _setId (RecordId id)
 
bool cappedAndNeedDelete () const
 
RecordData _getData (const WiredTigerCursor &cursor) const
 
void _positionAtFirstRecordId (OperationContext *opCtx, WT_CURSOR *cursor, const RecordId &firstKey, bool forTruncate) const
 Position the cursor at the first key. More...
 
void _changeNumRecords (OperationContext *opCtx, int64_t diff)
 Adjusts the record count and data size metadata for this record store, respectively. More...
 
void _increaseDataSize (OperationContext *opCtx, int64_t amount)
 

Static Private Member Functions

static WiredTigerRecoveryUnit_getRecoveryUnit (OperationContext *opCtx)
 

Private Attributes

const std::string _uri
 
const uint64_t _tableId
 
const std::string _engineName
 
const bool _isCapped
 
const bool _isEphemeral
 
const bool _isOplog
 
int64_t _cappedMaxSize
 
const int64_t _cappedMaxSizeSlack
 
const int64_t _cappedMaxDocs
 
RecordId _cappedFirstRecord
 
AtomicInt64 _cappedSleep
 
AtomicInt64 _cappedSleepMS
 
CappedCallback_cappedCallback
 
bool _shuttingDown
 
stdx::mutex _cappedCallbackMutex
 
int _cappedDeleteCheckCount
 
stdx::timed_mutex _cappedDeleterMutex
 
AtomicInt64 _nextIdNum
 
WiredTigerSizeStorer_sizeStorer
 
std::shared_ptr< WiredTigerSizeStorer::SizeInfo_sizeInfo
 
WiredTigerKVEngine_kvEngine
 
std::shared_ptr< OplogStones_oplogStones
 

Friends

class WiredTigerRecordStoreCursorBase
 
class StandardWiredTigerRecordStore
 
class PrefixedWiredTigerRecordStore
 

Additional Inherited Members

- Protected Attributes inherited from mongo::RecordStore
std::string _ns
 

Constructor & Destructor Documentation

◆ WiredTigerRecordStore()

mongo::WiredTigerRecordStore::WiredTigerRecordStore ( WiredTigerKVEngine kvEngine,
OperationContext *  opCtx,
Params  params 
)

◆ ~WiredTigerRecordStore()

mongo::WiredTigerRecordStore::~WiredTigerRecordStore ( )
virtual

Member Function Documentation

◆ _changeNumRecords()

void mongo::WiredTigerRecordStore::_changeNumRecords ( OperationContext *  opCtx,
int64_t  diff 
)
private

Adjusts the record count and data size metadata for this record store, respectively.

These functions consult the SizeRecoveryState to determine whether or not to actually change the size metadata if the server is undergoing recovery.

For most record stores, we will not update the size metadata during recovery, as we trust that the values in the SizeStorer are accurate with respect to the end state of recovery. However, there are two exceptions:

  1. When a record store is created as part of the recovery process. The SizeStorer will have no information about that newly-created ident.
  2. When a record store is created at startup but constains no records as of the stable checkpoint timestamp. In this scenario, we will assume that the record store has a size of zero and will discard all cached size metadata. This assumption is incorrect if there are pending writes to this ident as part of the recovery process, and so we must always adjust size metadata for these idents.

◆ _getData()

RecordData mongo::WiredTigerRecordStore::_getData ( const WiredTigerCursor cursor) const
private

◆ _getRecoveryUnit()

WiredTigerRecoveryUnit * mongo::WiredTigerRecordStore::_getRecoveryUnit ( OperationContext *  opCtx)
staticprivate

◆ _increaseDataSize()

void mongo::WiredTigerRecordStore::_increaseDataSize ( OperationContext *  opCtx,
int64_t  amount 
)
private

◆ _insertRecords()

Status mongo::WiredTigerRecordStore::_insertRecords ( OperationContext *  opCtx,
Record records,
const Timestamp *  timestamps,
size_t  nRecords 
)
private

◆ _nextId()

RecordId mongo::WiredTigerRecordStore::_nextId ( )
private

◆ _positionAtFirstRecordId()

void mongo::WiredTigerRecordStore::_positionAtFirstRecordId ( OperationContext *  opCtx,
WT_CURSOR *  cursor,
const RecordId &  firstKey,
bool  forTruncate 
) const
private

Position the cursor at the first key.

The previously known first key is provided, as well as an indicator that this is being positioned for use by a truncate call.

◆ _setId()

void mongo::WiredTigerRecordStore::_setId ( RecordId  id)
private

◆ appendCustomStats()

void mongo::WiredTigerRecordStore::appendCustomStats ( OperationContext *  opCtx,
BSONObjBuilder *  result,
double  scale 
) const
virtual
Parameters
scaleSize- amount by which to scale size metrics appends any custom stats from the RecordStore or other unique stats

Implements mongo::RecordStore.

◆ cappedAndNeedDelete()

bool mongo::WiredTigerRecordStore::cappedAndNeedDelete ( ) const
private

◆ cappedDeleteAsNeeded()

int64_t mongo::WiredTigerRecordStore::cappedDeleteAsNeeded ( OperationContext *  opCtx,
const RecordId &  justInserted 
)

◆ cappedDeleteAsNeeded_inlock()

int64_t mongo::WiredTigerRecordStore::cappedDeleteAsNeeded_inlock ( OperationContext *  opCtx,
const RecordId &  justInserted 
)

◆ cappedMaxDocs()

int64_t mongo::WiredTigerRecordStore::cappedMaxDocs ( ) const

◆ cappedMaxSize()

int64_t mongo::WiredTigerRecordStore::cappedMaxSize ( ) const

◆ cappedTruncateAfter()

void mongo::WiredTigerRecordStore::cappedTruncateAfter ( OperationContext *  opCtx,
RecordId  end,
bool  inclusive 
)
virtual

Truncate documents newer than the document at 'end' from the capped collection.

The collection cannot be completely emptied using this function. An assertion will be thrown if that is attempted.

Parameters
inclusive- Truncate 'end' as well iff true

Implements mongo::RecordStore.

◆ compact()

Status mongo::WiredTigerRecordStore::compact ( OperationContext *  opCtx,
RecordStoreCompactAdaptor adaptor,
const CompactOptions options,
CompactStats stats 
)
virtual

Attempt to reduce the storage space used by this RecordStore.

Only called if compactSupported() returns true. No RecordStoreCompactAdaptor will be passed if compactsInPlace() returns true.

Reimplemented from mongo::RecordStore.

◆ compactsInPlace()

virtual bool mongo::WiredTigerRecordStore::compactsInPlace ( ) const
inlinevirtual

Does compact() leave RecordIds alone or can they change.

Only called if compactSupported() returns true.

Reimplemented from mongo::RecordStore.

◆ compactSupported()

virtual bool mongo::WiredTigerRecordStore::compactSupported ( ) const
inlinevirtual

does this RecordStore support the compact operation?

If you return true, you must provide implementations of all compact methods.

Reimplemented from mongo::RecordStore.

◆ dataFor()

RecordData mongo::WiredTigerRecordStore::dataFor ( OperationContext *  opCtx,
const RecordId &  loc 
) const
virtual

Get the RecordData at loc, which must exist.

If unowned data is returned, it is valid until the next modification of this Record or the lock on this collection is released.

In general, prefer findRecord or RecordCursor::seekExact since they can tell you if a record has been removed.

Reimplemented from mongo::RecordStore.

◆ dataSize()

long long mongo::WiredTigerRecordStore::dataSize ( OperationContext *  opCtx) const
virtual

The dataSize is an approximation of the sum of the sizes (in bytes) of the documents or entries in the recordStore.

Implements mongo::RecordStore.

◆ deleteRecord()

void mongo::WiredTigerRecordStore::deleteRecord ( OperationContext *  opCtx,
const RecordId &  id 
)
virtual

Implements mongo::RecordStore.

◆ findRecord()

bool mongo::WiredTigerRecordStore::findRecord ( OperationContext *  opCtx,
const RecordId &  loc,
RecordData out 
) const
virtual
Parameters
out- If the record exists, the contents of this are set.
Returns
true iff there is a Record for loc

If unowned data is returned, it is valid until the next modification of this Record or the lock on this collection is released.

In general prefer RecordCursor::seekExact since it can avoid copying data in more storageEngines.

Warning: MMAPv1 cannot detect if RecordIds are valid. Therefore callers should only pass potentially deleted RecordIds to seek methods if they know that MMAPv1 is not the current storage engine. All new storage engines must support detecting the existence of Records.

Reimplemented from mongo::RecordStore.

◆ generateCreateString()

StatusWith< std::string > mongo::WiredTigerRecordStore::generateCreateString ( const std::string &  engineName,
StringData  ns,
const CollectionOptions options,
StringData  extraStrings,
bool  prefixed 
)
static

Creates a configuration string suitable for 'config' parameter in WT_SESSION::create().

Configuration string is constructed from: built-in defaults storageEngine.wiredTiger.configString in 'options' 'extraStrings' Performs simple validation on the supplied parameters. Returns error status if validation fails. Note that even if this function returns an OK status, WT_SESSION:create() may still fail with the constructed configuration string.

◆ getCursor()

virtual std::unique_ptr<SeekableRecordCursor> mongo::WiredTigerRecordStore::getCursor ( OperationContext *  opCtx,
bool  forward 
) const
pure virtual

Returns a new cursor over this record store.

The cursor is logically positioned before the first (or last if !forward) Record in the collection so that Record will be returned on the first call to next(). Implementations are allowed to lazily seek to the first Record when next() is called rather than doing it on construction.

Implements mongo::RecordStore.

Implemented in mongo::PrefixedWiredTigerRecordStore, and mongo::StandardWiredTigerRecordStore.

◆ getKey()

virtual RecordId mongo::WiredTigerRecordStore::getKey ( WT_CURSOR *  cursor) const
protectedpure virtual

◆ getManyCursors()

std::vector< std::unique_ptr< RecordCursor > > mongo::WiredTigerRecordStore::getManyCursors ( OperationContext *  opCtx) const
finalvirtual

Returns many RecordCursors that partition the RecordStore into many disjoint sets.

Iterating all returned RecordCursors is equivalent to iterating the full store.

Reimplemented from mongo::RecordStore.

◆ getRandomCursor()

std::unique_ptr< RecordCursor > mongo::WiredTigerRecordStore::getRandomCursor ( OperationContext *  opCtx) const
finalvirtual

Constructs a cursor over a record store that returns documents in a randomized order, and allows storage engines to provide a more efficient way of random sampling of a record store than MongoDB's default sampling methods, which is used when this method returns {}.

This method may be implemented using a pseudo-random walk over B-trees or a similar approach. Different cursors should return documents in a different order. Random cursors may return the same document more than once and, as a result, may return more documents than exist in the record store. Implementations should avoid obvious biases toward older, newer, larger smaller or other specific classes of documents.

Reimplemented from mongo::RecordStore.

◆ getRandomCursorWithOptions()

virtual std::unique_ptr<RecordCursor> mongo::WiredTigerRecordStore::getRandomCursorWithOptions ( OperationContext *  opCtx,
StringData  extraConfig 
) const
pure virtual

◆ getURI()

const std::string& mongo::WiredTigerRecordStore::getURI ( ) const
inline

◆ haveCappedWaiters()

bool mongo::WiredTigerRecordStore::haveCappedWaiters ( )

◆ insertRecord()

StatusWith< RecordId > mongo::WiredTigerRecordStore::insertRecord ( OperationContext *  opCtx,
const char *  data,
int  len,
Timestamp  timestamp,
bool  enforceQuota 
)
virtual

Implements mongo::RecordStore.

◆ insertRecords()

Status mongo::WiredTigerRecordStore::insertRecords ( OperationContext *  opCtx,
std::vector< Record > *  records,
std::vector< Timestamp > *  timestamps,
bool  enforceQuota 
)
virtual

Reimplemented from mongo::RecordStore.

◆ insertRecordsWithDocWriter()

Status mongo::WiredTigerRecordStore::insertRecordsWithDocWriter ( OperationContext *  opCtx,
const DocWriter *const *  docs,
const Timestamp *  timestamps,
size_t  nDocs,
RecordId *  idsOut 
)
virtual

Inserts nDocs documents into this RecordStore using the DocWriter interface.

This allows the storage engine to reserve space for a record and have it built in-place rather than building the record then copying it into its destination.

On success, if idsOut is non-null the RecordIds of the inserted records will be written into it. It must have space for nDocs RecordIds.

Implements mongo::RecordStore.

◆ inShutdown()

bool mongo::WiredTigerRecordStore::inShutdown ( ) const

◆ isCapped()

bool mongo::WiredTigerRecordStore::isCapped ( ) const
virtual

Implements mongo::RecordStore.

◆ isInRecordIdOrder()

virtual bool mongo::WiredTigerRecordStore::isInRecordIdOrder ( ) const
inlineoverridevirtual

Does the RecordStore cursor retrieve its document in RecordId Order?

If a subclass overrides the default value to true, the RecordStore cursor must retrieve its documents in RecordId order.

This enables your storage engine to run collection validation in the background.

Reimplemented from mongo::RecordStore.

◆ isOpHidden_forTest()

bool mongo::WiredTigerRecordStore::isOpHidden_forTest ( const RecordId &  id) const

◆ name()

const char * mongo::WiredTigerRecordStore::name ( ) const
virtual

Implements mongo::RecordStore.

◆ notifyCappedWaitersIfNeeded()

void mongo::WiredTigerRecordStore::notifyCappedWaitersIfNeeded ( )

◆ numRecords()

long long mongo::WiredTigerRecordStore::numRecords ( OperationContext *  opCtx) const
virtual

Total number of record in the RecordStore.

You may need to cache it, so this call takes constant time, as it is called often.

Implements mongo::RecordStore.

◆ oplogDiskLocRegister()

Status mongo::WiredTigerRecordStore::oplogDiskLocRegister ( OperationContext *  opCtx,
const Timestamp &  opTime,
bool  orderedCommit 
)
virtual

When we write to an oplog, we call this so that if the storage engine supports doc locking, it can manage the visibility of oplog entries to ensure they are ordered.

Since this is called inside of a WriteUnitOfWork while holding a std::mutex, it is illegal to acquire any LockManager locks inside of this function.

If orderedCommit is true, the storage engine can assume the input opTime has become visible in the oplog. Otherwise the storage engine must continue to maintain its own visibility management. Calls with orderedCommit true will not be concurrent with calls of orderedCommit false.

Reimplemented from mongo::RecordStore.

◆ oplogStartHack()

boost::optional< RecordId > mongo::WiredTigerRecordStore::oplogStartHack ( OperationContext *  opCtx,
const RecordId &  startingPosition 
) const
virtual

Return the RecordId of an oplog entry as close to startingPosition as possible without being higher.

If there are no entries <= startingPosition, return RecordId().

If you don't implement the oplogStartHack, just use the default implementation which returns boost::none.

Reimplemented from mongo::RecordStore.

◆ oplogStones()

OplogStones* mongo::WiredTigerRecordStore::oplogStones ( )
inline

◆ parseOptionsField()

StatusWith< std::string > mongo::WiredTigerRecordStore::parseOptionsField ( const BSONObj  options)
static

Parses collections options for wired tiger configuration string for table creation.

The document 'options' is typically obtained from the 'wiredTiger' field of CollectionOptions::storageEngine.

◆ postConstructorInit()

void mongo::WiredTigerRecordStore::postConstructorInit ( OperationContext *  opCtx)
virtual

◆ reclaimOplog() [1/2]

void mongo::WiredTigerRecordStore::reclaimOplog ( OperationContext *  opCtx)

◆ reclaimOplog() [2/2]

void mongo::WiredTigerRecordStore::reclaimOplog ( OperationContext *  opCtx,
Timestamp  persistedTimestamp 
)

The persistedTimestamp is when replication recovery would need to replay from on a restart.

reclaimOplog will not truncate oplog entries in front of this time.

◆ setCappedCallback()

void mongo::WiredTigerRecordStore::setCappedCallback ( CappedCallback cb)
inlinevirtual

Reimplemented from mongo::RecordStore.

◆ setKey()

virtual void mongo::WiredTigerRecordStore::setKey ( WT_CURSOR *  cursor,
RecordId  id 
) const
protectedpure virtual

◆ setSizeStorer()

void mongo::WiredTigerRecordStore::setSizeStorer ( WiredTigerSizeStorer ss)
inline

◆ storageSize()

int64_t mongo::WiredTigerRecordStore::storageSize ( OperationContext *  opCtx,
BSONObjBuilder *  extraInfo = NULL,
int  infoLevel = 0 
) const
virtual
Parameters
extraInfo- optional more debug info
level- optional, level of debug info to put in (higher is more)
Returns
total estimate size (in bytes) on stable storage

Implements mongo::RecordStore.

◆ tableId()

uint64_t mongo::WiredTigerRecordStore::tableId ( ) const
inline

◆ touch()

Status mongo::WiredTigerRecordStore::touch ( OperationContext *  opCtx,
BSONObjBuilder *  output 
) const
virtual

Load all data into cache.

What cache depends on implementation.

If the underlying storage engine does not support the operation, returns ErrorCodes::CommandNotSupported

Parameters
output(optional) - where to put detailed stats

Reimplemented from mongo::RecordStore.

◆ truncate()

Status mongo::WiredTigerRecordStore::truncate ( OperationContext *  opCtx)
virtual

removes all Records

Implements mongo::RecordStore.

◆ updateCappedSize()

Status mongo::WiredTigerRecordStore::updateCappedSize ( OperationContext *  opCtx,
long long  cappedSize 
)
finalvirtual

used to support online change oplog size.

Reimplemented from mongo::RecordStore.

◆ updateRecord()

Status mongo::WiredTigerRecordStore::updateRecord ( OperationContext *  opCtx,
const RecordId &  oldLocation,
const char *  data,
int  len,
bool  enforceQuota,
UpdateNotifier notifier 
)
virtual
Parameters
notifier- Only used by record stores which do not support doc-locking. Called only in the case of an in-place update. Called just before the in-place write occurs.
Returns
Status - If a document move is required (MMAPv1 only) then a status of ErrorCodes::NeedsDocumentMove will be returned. On receipt of this status no update will be performed. It is the caller's responsibility to:
  1. Remove the existing document and associated index keys.
  2. Insert a new document and index keys.

For capped record stores, the record size will never change.

Implements mongo::RecordStore.

◆ updateStatsAfterRepair()

void mongo::WiredTigerRecordStore::updateStatsAfterRepair ( OperationContext *  opCtx,
long long  numRecords,
long long  dataSize 
)
virtual

Called after a repair operation is run with the recomputed numRecords and dataSize.

Implements mongo::RecordStore.

◆ updateWithDamages()

StatusWith< RecordData > mongo::WiredTigerRecordStore::updateWithDamages ( OperationContext *  opCtx,
const RecordId &  loc,
const RecordData oldRec,
const char *  damageSource,
const mutablebson::DamageVector &  damages 
)
virtual

Updates the record positioned at 'loc' in-place using the deltas described by 'damages'.

The 'damages' vector describes contiguous ranges of 'damageSource' from which to copy and apply byte-level changes to the data.

Returns
the updated version of the record. If unowned data is returned, then it is valid until the next modification of this Record or the lock on the collection has been released.

Implements mongo::RecordStore.

◆ updateWithDamagesSupported()

bool mongo::WiredTigerRecordStore::updateWithDamagesSupported ( ) const
virtual
Returns
Returns 'false' if this record store does not implement 'updatewithDamages'. If this method returns false, 'updateWithDamages' must not be called, and all updates must be routed through 'updateRecord' above. This allows the update framework to avoid doing the work of damage tracking if the underlying record store cannot utilize that information.

Implements mongo::RecordStore.

◆ validate()

Status mongo::WiredTigerRecordStore::validate ( OperationContext *  opCtx,
ValidateCmdLevel  level,
ValidateAdaptor adaptor,
ValidateResults results,
BSONObjBuilder *  output 
)
virtual
Returns
OK if the validate run successfully OK will be returned even if corruption is found deatils will be in result

Implements mongo::RecordStore.

◆ waitForAllEarlierOplogWritesToBeVisible()

void mongo::WiredTigerRecordStore::waitForAllEarlierOplogWritesToBeVisible ( OperationContext *  opCtx) const
overridevirtual

Waits for all writes that completed before this call to be visible to forward scans.

See the comment on RecordCursor for more details about the visibility rules.

It is only legal to call this on an oplog. It is illegal to call this inside a WriteUnitOfWork.

Implements mongo::RecordStore.

◆ yieldAndAwaitOplogDeletionRequest()

bool mongo::WiredTigerRecordStore::yieldAndAwaitOplogDeletionRequest ( OperationContext *  opCtx)

Friends And Related Function Documentation

◆ PrefixedWiredTigerRecordStore

friend class PrefixedWiredTigerRecordStore
friend

◆ StandardWiredTigerRecordStore

friend class StandardWiredTigerRecordStore
friend

◆ WiredTigerRecordStoreCursorBase

friend class WiredTigerRecordStoreCursorBase
friend

Member Data Documentation

◆ _cappedCallback

CappedCallback* mongo::WiredTigerRecordStore::_cappedCallback
private

◆ _cappedCallbackMutex

stdx::mutex mongo::WiredTigerRecordStore::_cappedCallbackMutex
mutableprivate

◆ _cappedDeleteCheckCount

int mongo::WiredTigerRecordStore::_cappedDeleteCheckCount
private

◆ _cappedDeleterMutex

stdx::timed_mutex mongo::WiredTigerRecordStore::_cappedDeleterMutex
mutableprivate

◆ _cappedFirstRecord

RecordId mongo::WiredTigerRecordStore::_cappedFirstRecord
private

◆ _cappedMaxDocs

const int64_t mongo::WiredTigerRecordStore::_cappedMaxDocs
private

◆ _cappedMaxSize

int64_t mongo::WiredTigerRecordStore::_cappedMaxSize
private

◆ _cappedMaxSizeSlack

const int64_t mongo::WiredTigerRecordStore::_cappedMaxSizeSlack
private

◆ _cappedSleep

AtomicInt64 mongo::WiredTigerRecordStore::_cappedSleep
private

◆ _cappedSleepMS

AtomicInt64 mongo::WiredTigerRecordStore::_cappedSleepMS
private

◆ _engineName

const std::string mongo::WiredTigerRecordStore::_engineName
private

◆ _isCapped

const bool mongo::WiredTigerRecordStore::_isCapped
private

◆ _isEphemeral

const bool mongo::WiredTigerRecordStore::_isEphemeral
private

◆ _isOplog

const bool mongo::WiredTigerRecordStore::_isOplog
private

◆ _kvEngine

WiredTigerKVEngine* mongo::WiredTigerRecordStore::_kvEngine
private

◆ _nextIdNum

AtomicInt64 mongo::WiredTigerRecordStore::_nextIdNum
private

◆ _oplogStones

std::shared_ptr<OplogStones> mongo::WiredTigerRecordStore::_oplogStones
private

◆ _shuttingDown

bool mongo::WiredTigerRecordStore::_shuttingDown
private

◆ _sizeInfo

std::shared_ptr<WiredTigerSizeStorer::SizeInfo> mongo::WiredTigerRecordStore::_sizeInfo
private

◆ _sizeStorer

WiredTigerSizeStorer* mongo::WiredTigerRecordStore::_sizeStorer
private

◆ _tableId

const uint64_t mongo::WiredTigerRecordStore::_tableId
private

◆ _uri

const std::string mongo::WiredTigerRecordStore::_uri
private

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