![]() |
Storage Engine API
|
#include <wiredtiger_kv_engine.h>
Classes | |
class | WiredTigerCheckpointThread |
class | WiredTigerJournalFlusher |
Public Member Functions | |
WiredTigerKVEngine (const std::string &canonicalName, const std::string &path, ClockSource *cs, const std::string &extraOpenOptions, size_t cacheSizeGB, bool durable, bool ephemeral, bool repair, bool readOnly) | |
virtual | ~WiredTigerKVEngine () |
void | setRecordStoreExtraOptions (const std::string &options) |
void | setSortedDataInterfaceExtraOptions (const std::string &options) |
virtual bool | supportsDocLocking () const |
This must not change over the lifetime of the engine. More... | |
virtual bool | supportsDirectoryPerDB () const |
Returns true if storage engine supports –directoryperdb. More... | |
virtual bool | isDurable () const |
virtual bool | isEphemeral () const |
Returns true if the KVEngine is ephemeral – that is, it is NOT persistent and all data is lost after shutdown. More... | |
virtual RecoveryUnit * | newRecoveryUnit () |
virtual Status | createRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options) |
The create and drop methods on KVEngine are not transactional. More... | |
virtual std::unique_ptr< RecordStore > | getRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options) |
Having multiple out for the same ns is a rules violation; Calling on a non-created ident is invalid and may crash. More... | |
virtual Status | createSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc) |
virtual SortedDataInterface * | getSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc) |
virtual Status | createGroupedRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options, KVPrefix prefix) |
Create a RecordStore that MongoDB considers eligible to share space in an underlying table with other RecordStores. More... | |
virtual std::unique_ptr< RecordStore > | getGroupedRecordStore (OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options, KVPrefix prefix) |
Get a RecordStore that may share an underlying table with other RecordStores. More... | |
virtual Status | createGroupedSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc, KVPrefix prefix) |
Create a SortedDataInterface that MongoDB considers eligible to share space in an underlying table with other SortedDataInterfaces. More... | |
virtual SortedDataInterface * | getGroupedSortedDataInterface (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc, KVPrefix prefix) |
Get a SortedDataInterface that may share an underlying table with other SortedDataInterface. More... | |
virtual Status | dropIdent (OperationContext *opCtx, StringData ident) |
virtual void | alterIdentMetadata (OperationContext *opCtx, StringData ident, const IndexDescriptor *desc) |
virtual Status | okToRename (OperationContext *opCtx, StringData fromNS, StringData toNS, StringData ident, const RecordStore *originalRecordStore) const |
virtual int | flushAllFiles (OperationContext *opCtx, bool sync) |
virtual Status | beginBackup (OperationContext *opCtx) |
See StorageEngine::beginBackup for details. More... | |
virtual void | endBackup (OperationContext *opCtx) |
See StorageEngine::endBackup for details. More... | |
virtual int64_t | getIdentSize (OperationContext *opCtx, StringData ident) |
virtual Status | repairIdent (OperationContext *opCtx, StringData ident) |
virtual bool | hasIdent (OperationContext *opCtx, StringData ident) const |
std::vector< std::string > | getAllIdents (OperationContext *opCtx) const |
virtual void | cleanShutdown () |
This method will be called before there is a clean shutdown. More... | |
SnapshotManager * | getSnapshotManager () const final |
Return the SnapshotManager for this KVEngine or NULL if not supported. More... | |
void | setJournalListener (JournalListener *jl) final |
Sets a new JournalListener, which is used to alert the rest of the system about journaled write progress. More... | |
virtual void | setStableTimestamp (Timestamp stableTimestamp) override |
See StorageEngine::setStableTimestamp More... | |
virtual void | setInitialDataTimestamp (Timestamp initialDataTimestamp) override |
See StorageEngine::setInitialDataTimestamp More... | |
virtual void | setOldestTimestampFromStable () override |
See StorageEngine::setOldestTimestampFromStable More... | |
virtual void | setOldestTimestamp (Timestamp newOldestTimestamp) override |
See StorageEngine::setOldestTimestamp More... | |
virtual bool | supportsRecoverToStableTimestamp () const override |
See StorageEngine::supportsRecoverToStableTimestamp More... | |
virtual StatusWith< Timestamp > | recoverToStableTimestamp (OperationContext *opCtx) override |
See StorageEngine::recoverToStableTimestamp More... | |
virtual boost::optional< Timestamp > | getRecoveryTimestamp () const override |
See StorageEngine::getRecoveryTimestamp More... | |
virtual boost::optional< Timestamp > | getLastStableCheckpointTimestamp () const override |
Returns a timestamp value that is at or before the last checkpoint. More... | |
virtual Timestamp | getAllCommittedTimestamp () const override |
See StorageEngine::getAllCommittedTimestamp More... | |
bool | supportsReadConcernSnapshot () const final |
See StorageEngine::supportsReadConcernSnapshot More... | |
int | reconfigure (const char *str) |
WT_CONNECTION * | getConnection () |
void | dropSomeQueuedIdents () |
std::list< WiredTigerCachedCursor > | filterCursorsWithQueuedDrops (std::list< WiredTigerCachedCursor > *cache) |
bool | haveDropsQueued () const |
void | syncSizeInfo (bool sync) const |
void | startOplogManager (OperationContext *opCtx, const std::string &uri, WiredTigerRecordStore *oplogRecordStore) |
void | haltOplogManager () |
WiredTigerOplogManager * | getOplogManager () const |
void | replicationBatchIsComplete () const override |
See StorageEngine::replicationBatchIsComplete() More... | |
bool | isCacheUnderPressure (OperationContext *opCtx) const override |
See StorageEngine::isCacheUnderPressure() More... | |
Timestamp | getStableTimestamp () const |
These are timestamp access functions for serverStatus to be able to report the actual snapshot window size. More... | |
Timestamp | getOldestTimestamp () const |
![]() | |
virtual bool | supportsDBLocking () const |
This must not change over the lifetime of the engine. More... | |
virtual bool | supportsCappedCollections () const |
This must not change over the lifetime of the engine. More... | |
virtual void | setCachePressureForTest (int pressure) |
See 'StorageEngine::setCachePressureForTest()'. More... | |
virtual | ~KVEngine () |
The destructor will never be called from mongod, but may be called from tests. More... | |
Static Public Member Functions | |
static void | setInitRsOplogBackgroundThreadCallback (stdx::function< bool(StringData)> cb) |
Sets the implementation for initRsOplogBackgroundThread (allowing tests to skip the background job, for example). More... | |
static bool | initRsOplogBackgroundThread (StringData ns) |
Initializes a background job to remove excess documents in the oplog collections. More... | |
static void | appendGlobalStats (BSONObjBuilder &b) |
Static Public Attributes | |
static const int | kDefaultJournalDelayMillis = 100 |
Private Member Functions | |
Status | _salvageIfNeeded (const char *uri) |
void | _checkIdentPath (StringData ident) |
bool | _hasUri (WT_SESSION *session, const std::string &uri) const |
std::string | _uri (StringData ident) const |
Timestamp | _calculateHistoryLagFromStableTimestamp (Timestamp stableTimestamp) |
Uses the 'stableTimestamp', the 'targetSnapshotHistoryWindowInSeconds' setting and the current _oldestTimestamp to calculate what the new oldest_timestamp should be, in order to maintain a window of available snapshots on the storage engine from oldest to stable timestamp. More... | |
void | _setOldestTimestamp (Timestamp newOldestTimestamp, bool force) |
Sets the oldest timestamp for which the storage engine must maintain snapshot history through. More... | |
mongo::WiredTigerKVEngine::WiredTigerKVEngine | ( | const std::string & | canonicalName, |
const std::string & | path, | ||
ClockSource * | cs, | ||
const std::string & | extraOpenOptions, | ||
size_t | cacheSizeGB, | ||
bool | durable, | ||
bool | ephemeral, | ||
bool | repair, | ||
bool | readOnly | ||
) |
|
virtual |
|
private |
Uses the 'stableTimestamp', the 'targetSnapshotHistoryWindowInSeconds' setting and the current _oldestTimestamp to calculate what the new oldest_timestamp should be, in order to maintain a window of available snapshots on the storage engine from oldest to stable timestamp.
If the returned Timestamp isNull(), oldest_timestamp should not be moved forward.
|
private |
|
private |
|
private |
|
private |
Sets the oldest timestamp for which the storage engine must maintain snapshot history through.
If force is true, oldest will be set to the given input value, unmodified, even if it is backwards in time from the last oldest timestamp (accomodating initial sync).
|
private |
|
virtual |
Reimplemented from mongo::KVEngine.
|
static |
|
virtual |
See StorageEngine::beginBackup for details.
Reimplemented from mongo::KVEngine.
|
virtual |
This method will be called before there is a clean shutdown.
Storage engines should override this method if they have clean-up to do that is different from unclean shutdown. MongoDB will not call into the storage subsystem after calling this function.
There is intentionally no uncleanShutdown().
Implements mongo::KVEngine.
|
virtual |
Create a RecordStore that MongoDB considers eligible to share space in an underlying table with other RecordStores.
'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.
prefix | signals whether the RecordStore may be shared by an underlying table. A prefix of KVPrefix::kNotPrefixed must remain isolated in its own table. Otherwise the storage engine implementation ultimately chooses which RecordStores share a table. Sharing RecordStores belonging to different databases within the same table is forbidden. |
Reimplemented from mongo::KVEngine.
|
virtual |
Create a SortedDataInterface that MongoDB considers eligible to share space in an underlying table with other SortedDataInterfaces.
'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.
prefix | signals whether the SortedDataInterface (index) may be shared by an underlying table. A prefix of KVPrefix::kNotPrefixed must remain isolated in its own table. Otherwise the storage engine implementation ultimately chooses which indexes share a table. Sharing indexes belonging to different databases is forbidden. |
Reimplemented from mongo::KVEngine.
|
inlinevirtual |
The create and drop methods on KVEngine are not transactional.
Transactional semantics are provided by the KVStorageEngine code that calls these. For example, drop will be called if a create is rolled back. A higher-level drop operation will only propagate to a drop call on the KVEngine once the WUOW commits. Therefore drops will never be rolled back and it is safe to immediately reclaim storage.
Implements mongo::KVEngine.
|
inlinevirtual |
Implements mongo::KVEngine.
|
virtual |
Implements mongo::KVEngine.
void mongo::WiredTigerKVEngine::dropSomeQueuedIdents | ( | ) |
|
virtual |
See StorageEngine::endBackup for details.
Reimplemented from mongo::KVEngine.
std::list< WiredTigerCachedCursor > mongo::WiredTigerKVEngine::filterCursorsWithQueuedDrops | ( | std::list< WiredTigerCachedCursor > * | cache | ) |
|
virtual |
Reimplemented from mongo::KVEngine.
|
overridevirtual |
See StorageEngine::getAllCommittedTimestamp
Implements mongo::KVEngine.
|
virtual |
Implements mongo::KVEngine.
|
inline |
|
virtual |
Get a RecordStore that may share an underlying table with other RecordStores.
'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.
prefix | dictates the value keys for the RecordStore should be prefixed with to distinguish between RecordStores sharing an underlying table. A value of KVPrefix::kNotPrefixed guarantees the index is the sole resident of the table. |
Reimplemented from mongo::KVEngine.
|
virtual |
Get a SortedDataInterface that may share an underlying table with other SortedDataInterface.
'prefix' is guaranteed to be 'KVPrefix::kNotPrefixed' when 'groupCollections' is not enabled.
prefix | dictates the value keys for the index should be prefixed with to distinguish between indexes sharing an underlying table. A value of KVPrefix::kNotPrefixed guarantees the index is the sole resident of the table. |
Reimplemented from mongo::KVEngine.
|
virtual |
Implements mongo::KVEngine.
|
overridevirtual |
Returns a timestamp value that is at or before the last checkpoint.
Everything before this value is guaranteed to be persisted on disk and replication recovery will not need to replay documents with an earlier time.
Reimplemented from mongo::KVEngine.
Timestamp mongo::WiredTigerKVEngine::getOldestTimestamp | ( | ) | const |
|
inline |
|
inlinevirtual |
Having multiple out for the same ns is a rules violation; Calling on a non-created ident is invalid and may crash.
Implements mongo::KVEngine.
|
overridevirtual |
See StorageEngine::getRecoveryTimestamp
Reimplemented from mongo::KVEngine.
|
inlinefinalvirtual |
Return the SnapshotManager for this KVEngine or NULL if not supported.
Pointer remains owned by the StorageEngine, not the caller.
Reimplemented from mongo::KVEngine.
|
inlinevirtual |
Implements mongo::KVEngine.
Timestamp mongo::WiredTigerKVEngine::getStableTimestamp | ( | ) | const |
These are timestamp access functions for serverStatus to be able to report the actual snapshot window size.
void mongo::WiredTigerKVEngine::haltOplogManager | ( | ) |
|
virtual |
Implements mongo::KVEngine.
bool mongo::WiredTigerKVEngine::haveDropsQueued | ( | ) | const |
|
static |
Initializes a background job to remove excess documents in the oplog collections.
This applies to the capped collections in the local.oplog.* namespaces (specifically local.oplog.rs for replica sets). Returns true if a background job is running for the namespace.
|
overridevirtual |
See StorageEngine::isCacheUnderPressure()
Reimplemented from mongo::KVEngine.
|
inlinevirtual |
Implements mongo::KVEngine.
|
inlinevirtual |
Returns true if the KVEngine is ephemeral – that is, it is NOT persistent and all data is lost after shutdown.
Otherwise, returns false.
Implements mongo::KVEngine.
|
virtual |
Implements mongo::KVEngine.
|
virtual |
Reimplemented from mongo::KVEngine.
int mongo::WiredTigerKVEngine::reconfigure | ( | const char * | str | ) |
|
overridevirtual |
See StorageEngine::recoverToStableTimestamp
Reimplemented from mongo::KVEngine.
|
virtual |
Implements mongo::KVEngine.
|
overridevirtual |
See StorageEngine::replicationBatchIsComplete()
Reimplemented from mongo::KVEngine.
|
overridevirtual |
See StorageEngine::setInitialDataTimestamp
Reimplemented from mongo::KVEngine.
|
static |
Sets the implementation for initRsOplogBackgroundThread
(allowing tests to skip the background job, for example).
Intended to be called from a MONGO_INITIALIZER and therefore in a single threaded context.
|
finalvirtual |
Sets a new JournalListener, which is used to alert the rest of the system about journaled write progress.
Implements mongo::KVEngine.
|
overridevirtual |
See StorageEngine::setOldestTimestamp
Reimplemented from mongo::KVEngine.
|
overridevirtual |
See StorageEngine::setOldestTimestampFromStable
Reimplemented from mongo::KVEngine.
void mongo::WiredTigerKVEngine::setRecordStoreExtraOptions | ( | const std::string & | options | ) |
void mongo::WiredTigerKVEngine::setSortedDataInterfaceExtraOptions | ( | const std::string & | options | ) |
|
overridevirtual |
See StorageEngine::setStableTimestamp
Reimplemented from mongo::KVEngine.
void mongo::WiredTigerKVEngine::startOplogManager | ( | OperationContext * | opCtx, |
const std::string & | uri, | ||
WiredTigerRecordStore * | oplogRecordStore | ||
) |
|
virtual |
Returns true if storage engine supports –directoryperdb.
See: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption–directoryperdb
Implements mongo::KVEngine.
|
virtual |
This must not change over the lifetime of the engine.
Implements mongo::KVEngine.
|
finalvirtual |
See StorageEngine::supportsReadConcernSnapshot
Reimplemented from mongo::KVEngine.
|
overridevirtual |
See StorageEngine::supportsRecoverToStableTimestamp
Reimplemented from mongo::KVEngine.
void mongo::WiredTigerKVEngine::syncSizeInfo | ( | bool | sync | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
private |
|
static |