38 #include <wiredtiger.h> 40 #include "mongo/bson/ordering.h" 41 #include "mongo/bson/timestamp.h" 46 #include "mongo/stdx/functional.h" 47 #include "mongo/stdx/mutex.h" 48 #include "mongo/util/elapsed_tracker.h" 53 class JournalListener;
54 class WiredTigerRecordStore;
55 class WiredTigerSessionCache;
56 class WiredTigerSizeStorer;
62 bool shouldDowngrade(
bool readOnly,
bool repairMode,
bool hasRecoveryTimestamp);
70 const std::string& path,
72 const std::string& extraOpenOptions,
114 const IndexDescriptor*
desc) {
120 const IndexDescriptor*
desc) {
138 const IndexDescriptor*
desc,
143 const IndexDescriptor*
desc,
150 const IndexDescriptor*
desc);
168 virtual bool hasIdent(OperationContext*
opCtx, StringData ident)
const;
215 std::list<WiredTigerCachedCursor>* cache);
230 const std::string&
uri,
281 class WiredTigerJournalFlusher;
282 class WiredTigerCheckpointThread;
287 bool _hasUri(WT_SESSION* session,
const std::string&
uri)
const;
289 std::string
_uri(StringData ident)
const;
int reconfigure(const char *str)
Definition: wiredtiger_kv_engine.cpp:1081
virtual Status repairIdent(OperationContext *opCtx, StringData ident)
Definition: wiredtiger_kv_engine.cpp:682
std::string _canonicalName
Definition: wiredtiger_kv_engine.h:318
StartupVersion _startupVersion
Definition: wiredtiger_kv_engine.h:61
WT_CONNECTION * getConnection()
Definition: wiredtiger_kv_engine.h:210
virtual SortedDataInterface * getGroupedSortedDataInterface(OperationContext *opCtx, StringData ident, const IndexDescriptor *desc, KVPrefix prefix)
Get a SortedDataInterface that may share an underlying table with other SortedDataInterface.
Definition: wiredtiger_kv_engine.cpp:884
Definition: kv_engine.h:53
virtual bool isEphemeral() const
Returns true if the KVEngine is ephemeral – that is, it is NOT persistent and all data is lost after ...
Definition: wiredtiger_kv_engine.h:92
Timestamp getOldestTimestamp() const
Definition: wiredtiger_kv_engine.cpp:1419
virtual bool isDurable() const
Definition: wiredtiger_kv_engine.h:88
static bool initRsOplogBackgroundThread(StringData ns)
Initializes a background job to remove excess documents in the oplog collections.
Definition: wiredtiger_kv_engine.cpp:1116
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.
Definition: wiredtiger_kv_engine.cpp:804
virtual bool supportsRecoverToStableTimestamp() const override
See StorageEngine::supportsRecoverToStableTimestamp
Definition: wiredtiger_kv_engine.cpp:1286
void _setOldestTimestamp(Timestamp newOldestTimestamp, bool force)
Sets the oldest timestamp for which the storage engine must maintain snapshot history through.
Definition: wiredtiger_kv_engine.cpp:1207
std::string _wtOpenConfig
Definition: wiredtiger_kv_engine.h:320
stdx::mutex _stableTimestampMutex
Definition: wiredtiger_kv_engine.h:348
Definition: wiredtiger_record_store.h:73
std::unique_ptr< WiredTigerCheckpointThread > _checkpointThread
Definition: wiredtiger_kv_engine.h:331
stdx::mutex _oplogManagerMutex
Definition: wiredtiger_kv_engine.h:314
Collection *const const NamespaceString & ns
Definition: collection_info_cache_impl.cpp:53
virtual Status createRecordStore(OperationContext *opCtx, StringData ns, StringData ident, const CollectionOptions &options)
The create and drop methods on KVEngine are not transactional.
Definition: wiredtiger_kv_engine.h:98
WiredTigerEventHandler _eventHandler
Definition: wiredtiger_kv_engine.h:309
virtual Status beginBackup(OperationContext *opCtx)
See StorageEngine::beginBackup for details.
Definition: wiredtiger_kv_engine.cpp:734
virtual SortedDataInterface * getSortedDataInterface(OperationContext *opCtx, StringData ident, const IndexDescriptor *desc)
Definition: wiredtiger_kv_engine.h:118
std::string _uri(StringData ident) const
Definition: wiredtiger_kv_engine.cpp:844
Definition: collection_options.h:57
virtual void setInitialDataTimestamp(Timestamp initialDataTimestamp) override
See StorageEngine::setInitialDataTimestamp
Definition: wiredtiger_kv_engine.cpp:1280
virtual void endBackup(OperationContext *opCtx)
See StorageEngine::endBackup for details.
Definition: wiredtiger_kv_engine.cpp:754
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
WiredTigerFileVersion _fileVersion
Definition: wiredtiger_kv_engine.h:344
ElapsedTracker _sizeStorerSyncTracker
Definition: wiredtiger_kv_engine.h:324
std::list< std::string > _identToDrop
Definition: wiredtiger_kv_engine.h:338
StartupVersion
Definition: wiredtiger_kv_engine.h:59
void setSortedDataInterfaceExtraOptions(const std::string &options)
Definition: wiredtiger_kv_engine.cpp:777
stdx::mutex _dropAllQueuesMutex
Definition: wiredtiger_kv_engine.h:336
virtual Status dropIdent(OperationContext *opCtx, StringData ident)
Definition: wiredtiger_kv_engine.cpp:909
virtual boost::optional< Timestamp > getRecoveryTimestamp() const override
See StorageEngine::getRecoveryTimestamp
Definition: wiredtiger_kv_engine.cpp:1347
virtual int64_t getIdentSize(OperationContext *opCtx, StringData ident)
Definition: wiredtiger_kv_engine.cpp:677
Timestamp getStableTimestamp() const
These are timestamp access functions for serverStatus to be able to report the actual snapshot window...
Definition: wiredtiger_kv_engine.cpp:1414
bool _readOnly
Definition: wiredtiger_kv_engine.h:329
const bool _inRepairMode
Definition: wiredtiger_kv_engine.h:328
virtual int flushAllFiles(OperationContext *opCtx, bool sync)
Definition: wiredtiger_kv_engine.cpp:720
bool shouldDowngrade(bool readOnly, bool repairMode, bool hasRecoveryTimestamp)
Definition: wiredtiger_kv_engine.cpp:96
ClockSource *const _clockSource
Definition: wiredtiger_kv_engine.h:311
std::string _sizeStorerUri
Definition: wiredtiger_kv_engine.h:323
std::unique_ptr< WiredTigerJournalFlusher > _journalFlusher
Definition: wiredtiger_kv_engine.h:330
Date_t _previousCheckedDropsQueued
Definition: wiredtiger_kv_engine.h:340
bool _hasUri(WT_SESSION *session, const std::string &uri) const
Definition: wiredtiger_kv_engine.cpp:1037
std::vector< std::string > getAllIdents(OperationContext *opCtx) const
Definition: wiredtiger_kv_engine.cpp:1050
virtual Timestamp getAllCommittedTimestamp() const override
See StorageEngine::getAllCommittedTimestamp
Definition: wiredtiger_kv_engine.cpp:1343
std::unique_ptr< WiredTigerSizeStorer > _sizeStorer
Definition: wiredtiger_kv_engine.h:322
virtual void setStableTimestamp(Timestamp stableTimestamp) override
See StorageEngine::setStableTimestamp
Definition: wiredtiger_kv_engine.cpp:1126
void dropSomeQueuedIdents()
Definition: wiredtiger_kv_engine.cpp:987
void _checkIdentPath(StringData ident)
Definition: wiredtiger_kv_engine.cpp:1085
virtual bool supportsDocLocking() const
This must not change over the lifetime of the engine.
Definition: wiredtiger_kv_engine.cpp:1025
Timestamp _oldestTimestamp
Definition: wiredtiger_kv_engine.h:351
void haltOplogManager()
Definition: wiredtiger_kv_engine.cpp:1391
virtual ~WiredTigerKVEngine()
Definition: wiredtiger_kv_engine.cpp:586
Definition: wiredtiger_kv_engine.h:66
virtual StatusWith< Timestamp > recoverToStableTimestamp(OperationContext *opCtx) override
See StorageEngine::recoverToStableTimestamp
Definition: wiredtiger_kv_engine.cpp:1294
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 a...
Definition: wiredtiger_kv_engine.h:105
virtual void cleanShutdown()
This method will be called before there is a clean shutdown.
Definition: wiredtiger_kv_engine.cpp:613
This class allows for the storageEngine to alert the rest of the system about journaled write progres...
Definition: journal_listener.h:48
static void appendGlobalStats(BSONObjBuilder &b)
Definition: wiredtiger_kv_engine.cpp:594
static const KVPrefix kNotPrefixed
Definition: kv_prefix.h:47
OperationContext Database StringData CollectionOptions bool const BSONObj &idIndex Status
Definition: database_impl.cpp:955
virtual void setOldestTimestamp(Timestamp newOldestTimestamp) override
See StorageEngine::setOldestTimestamp
Definition: wiredtiger_kv_engine.cpp:1203
std::unique_ptr< WiredTigerSessionCache > _sessionCache
Definition: wiredtiger_kv_engine.h:310
virtual Status okToRename(OperationContext *opCtx, StringData fromNS, StringData toNS, StringData ident, const RecordStore *originalRecordStore) const
Definition: wiredtiger_kv_engine.cpp:667
WT_CONNECTION * _conn
Definition: wiredtiger_kv_engine.h:308
Status _salvageIfNeeded(const char *uri)
Definition: wiredtiger_kv_engine.cpp:693
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)
Definition: wiredtiger_kv_engine.cpp:443
Definition: wiredtiger_oplog_manager.h:47
std::string _path
Definition: wiredtiger_kv_engine.h:319
Timestamp _calculateHistoryLagFromStableTimestamp(Timestamp stableTimestamp)
Uses the 'stableTimestamp', the 'targetSnapshotHistoryWindowInSeconds' setting and the current _oldes...
Definition: wiredtiger_kv_engine.cpp:1252
Definition: index_key_validate.h:40
std::string _indexOptions
Definition: wiredtiger_kv_engine.h:334
stdx::mutex _oldestTimestampMutex
Definition: wiredtiger_kv_engine.h:347
A RecoveryUnit is responsible for ensuring that data is persisted.
Definition: recovery_unit.h:51
bool _durable
Definition: wiredtiger_kv_engine.h:326
std::unique_ptr< WiredTigerOplogManager > _oplogManager
Definition: wiredtiger_kv_engine.h:316
stdx::mutex _identToDropMutex
Definition: wiredtiger_kv_engine.h:337
std::string _rsOptions
Definition: wiredtiger_kv_engine.h:333
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 wi...
Definition: wiredtiger_kv_engine.cpp:848
An abstraction used for storing documents in a collection or entries in an index.
Definition: record_store.h:282
void setJournalListener(JournalListener *jl) final
Sets a new JournalListener, which is used to alert the rest of the system about journaled write progr...
Definition: wiredtiger_kv_engine.cpp:1107
void startOplogManager(OperationContext *opCtx, const std::string &uri, WiredTigerRecordStore *oplogRecordStore)
Definition: wiredtiger_kv_engine.cpp:1382
bool supportsReadConcernSnapshot() const final
See StorageEngine::supportsReadConcernSnapshot
Definition: wiredtiger_kv_engine.cpp:1378
virtual boost::optional< Timestamp > getLastStableCheckpointTimestamp() const override
Returns a timestamp value that is at or before the last checkpoint.
Definition: wiredtiger_kv_engine.cpp:1360
virtual bool hasIdent(OperationContext *opCtx, StringData ident) const
Definition: wiredtiger_kv_engine.cpp:1033
WiredTigerOplogManager * getOplogManager() const
Definition: wiredtiger_kv_engine.h:244
std::list< WiredTigerCachedCursor > filterCursorsWithQueuedDrops(std::list< WiredTigerCachedCursor > *cache)
Definition: wiredtiger_kv_engine.cpp:945
std::string getDowngradeString()
Definition: wiredtiger_kv_engine.cpp:141
virtual bool supportsDirectoryPerDB() const
Returns true if storage engine supports –directoryperdb.
Definition: wiredtiger_kv_engine.cpp:1029
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...
Definition: wiredtiger_kv_engine.cpp:781
void replicationBatchIsComplete() const override
See StorageEngine::replicationBatchIsComplete()
Definition: wiredtiger_kv_engine.cpp:1400
Returns a WT_EVENT_HANDLER with MongoDB's default handlers.
Definition: wiredtiger_util.h:103
A KVPrefix may be prepended to the keys of entries in an underlying KV store.
Definition: kv_prefix.h:44
std::size_t _oplogManagerCount
Definition: wiredtiger_kv_engine.h:315
Timestamp _stableTimestamp
Definition: wiredtiger_kv_engine.h:352
Timestamp _recoveryTimestamp
Definition: wiredtiger_kv_engine.h:343
void setRecordStoreExtraOptions(const std::string &options)
Definition: wiredtiger_kv_engine.cpp:773
Manages snapshots that can be read from at a later time.
Definition: snapshot_manager.h:47
virtual void alterIdentMetadata(OperationContext *opCtx, StringData ident, const IndexDescriptor *desc)
Definition: wiredtiger_kv_engine.cpp:895
virtual void setOldestTimestampFromStable() override
See StorageEngine::setOldestTimestampFromStable
Definition: wiredtiger_kv_engine.cpp:1174
virtual Status createSortedDataInterface(OperationContext *opCtx, StringData ident, const IndexDescriptor *desc)
Definition: wiredtiger_kv_engine.h:112
bool isCacheUnderPressure(OperationContext *opCtx) const override
See StorageEngine::isCacheUnderPressure()
Definition: wiredtiger_kv_engine.cpp:1404
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
static void setInitRsOplogBackgroundThreadCallback(stdx::function< bool(StringData)> cb)
Sets the implementation for initRsOplogBackgroundThread (allowing tests to skip the background job,...
Definition: wiredtiger_kv_engine.cpp:1111
bool haveDropsQueued() const
Definition: wiredtiger_kv_engine.cpp:967
bool _ephemeral
Definition: wiredtiger_kv_engine.h:327
OperationContext const IndexDescriptor * desc
Definition: index_catalog_impl.cpp:97
static const int kDefaultJournalDelayMillis
Definition: wiredtiger_kv_engine.h:68
std::unique_ptr< WiredTigerSession > _backupSession
Definition: wiredtiger_kv_engine.h:342
Definition: wiredtiger_kv_engine.h:58
std::string uri
Definition: wiredtiger_standard_record_store_test.cpp:367
SnapshotManager * getSnapshotManager() const final
Return the SnapshotManager for this KVEngine or NULL if not supported.
Definition: wiredtiger_kv_engine.h:174
void syncSizeInfo(bool sync) const
Definition: wiredtiger_kv_engine.cpp:758
This interface is a work in progress.
Definition: sorted_data_interface.h:64
virtual RecoveryUnit * newRecoveryUnit()
Definition: wiredtiger_kv_engine.cpp:769