31 #include <wiredtiger.h> 33 #include <boost/optional.hpp> 38 #include "mongo/base/checked_cast.h" 39 #include "mongo/bson/timestamp.h" 40 #include "mongo/db/operation_context.h" 41 #include "mongo/db/record_id.h" 42 #include "mongo/db/repl/read_concern_level.h" 46 #include "mongo/util/timer.h" 99 boost::optional<Timestamp> provided = boost::none)
override;
180 typedef std::vector<std::unique_ptr<Change>>
Changes;
192 OperationContext*
opCtx);
197 WT_CURSOR*
get()
const {
213 _ru->assertInActiveTxn();
WiredTigerSession * getSessionNoTxn()
Returns a session without starting a new WT txn on the session.
Definition: wiredtiger_recovery_unit.cpp:215
ReadSource getTimestampReadSource() const override
Definition: wiredtiger_recovery_unit.cpp:486
uint64_t _mySnapshotId
Definition: wiredtiger_recovery_unit.h:175
void beginIdle()
Enter a period of wait or computation during which there are no WT calls.
Definition: wiredtiger_recovery_unit.cpp:490
WiredTigerOplogManager * _oplogManager
Definition: wiredtiger_recovery_unit.h:154
SnapshotId getSnapshotId() const override
Gets the local SnapshotId.
Definition: wiredtiger_recovery_unit.cpp:301
bool waitUntilDurable() override
Waits until all commits that happened before this call are durable in the journal.
Definition: wiredtiger_recovery_unit.cpp:180
void registerChange(Change *change) override
The RecoveryUnit takes ownership of the change.
Definition: wiredtiger_recovery_unit.cpp:199
void _txnOpen()
Definition: wiredtiger_recovery_unit.cpp:336
~WiredTigerRecoveryUnit()
Definition: wiredtiger_recovery_unit.cpp:75
std::vector< std::unique_ptr< Change > > Changes
Definition: wiredtiger_recovery_unit.h:180
virtual void setOrderedCommit(bool orderedCommit) override
Definition: wiredtiger_recovery_unit.h:107
IgnorePrepared
Definition: wiredtiger_begin_transaction_block.h:48
WiredTigerRecoveryUnit(WiredTigerSessionCache *sc)
Definition: wiredtiger_recovery_unit.cpp:64
Timestamp _commitTimestamp
Definition: wiredtiger_recovery_unit.h:172
void setIsOplogReader()
Definition: wiredtiger_recovery_unit.h:114
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
void setRollbackWritesDisabled() override
Sets a flag that declares this RecoveryUnit will skip rolling back writes, for the duration of the cu...
Definition: wiredtiger_recovery_unit.h:105
WT_CURSOR * _cursor
Definition: wiredtiger_recovery_unit.h:220
boost::optional< WiredTigerCursor > _cursor
Definition: wiredtiger_index.cpp:1124
WiredTigerSessionCache * _sessionCache
Definition: wiredtiger_recovery_unit.h:153
WiredTigerSession * getSession()
Definition: wiredtiger_recovery_unit.cpp:208
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
ReadSource
The ReadSource indicates which exteral or provided timestamp to read from for future transactions...
Definition: recovery_unit.h:235
void setIgnorePrepared(bool ignore) override
Sets whether or not to ignore prepared transactions if supported by this storage engine.
Definition: wiredtiger_recovery_unit.cpp:467
void assertInActiveTxn() const
Definition: wiredtiger_recovery_unit.cpp:204
This is a structure that caches 1 cursor for each uri.
Definition: wiredtiger_session_cache.h:65
void prepareUnitOfWork() override
Transitions the active unit of work to the "prepared" state.
Definition: wiredtiger_recovery_unit.cpp:147
Timestamp _majorityCommittedSnapshot
Definition: wiredtiger_recovery_unit.h:176
void setCommitTimestamp(Timestamp timestamp) override
Sets a timestamp that will be assigned to all future writes on this RecoveryUnit until clearCommitTim...
Definition: wiredtiger_recovery_unit.cpp:429
bool _areWriteUnitOfWorksBanned
Definition: wiredtiger_recovery_unit.h:156
std::shared_ptr< void > data
Definition: ephemeral_for_test_record_store_test.cpp:74
void abortUnitOfWork() override
Marks the end of a unit of work and rolls back all changes registered by calls to onRollback or regis...
Definition: wiredtiger_recovery_unit.cpp:168
void preallocateSnapshot() override
Informs the RecoveryUnit that a snapshot will be needed soon, if one was not already established...
Definition: wiredtiger_recovery_unit.cpp:234
bool _isTimestamped
Definition: wiredtiger_recovery_unit.h:159
WT_CURSOR * operator->() const
Definition: wiredtiger_recovery_unit.h:202
void _abort()
Definition: wiredtiger_recovery_unit.cpp:111
Status obtainMajorityCommittedSnapshot() override
Obtains a majority committed snapshot.
Definition: wiredtiger_recovery_unit.cpp:306
This is a smart pointer that wraps a WT_CURSOR and knows how to obtain and get from pool...
Definition: wiredtiger_recovery_unit.h:187
Timestamp _prepareTimestamp
Definition: wiredtiger_recovery_unit.h:173
void setPrepareTimestamp(Timestamp timestamp) override
Sets a prepare timestamp for the current transaction.
Definition: wiredtiger_recovery_unit.cpp:459
WiredTigerSession * getSession()
Definition: wiredtiger_recovery_unit.h:206
void beginUnitOfWork(OperationContext *opCtx) override
Marks the beginning of a unit of work.
Definition: wiredtiger_recovery_unit.cpp:141
WiredTigerSessionCache * getSessionCache()
Definition: wiredtiger_recovery_unit.h:131
bool _orderedCommit
Definition: wiredtiger_recovery_unit.h:166
Definition: wiredtiger_oplog_manager.h:47
Timestamp getCommitTimestamp() override
Definition: wiredtiger_recovery_unit.cpp:444
A RecoveryUnit is responsible for ensuring that data is persisted.
Definition: recovery_unit.h:51
bool waitUntilUnjournaledWritesDurable() override
Unlike waitUntilDurable, this method takes a stable checkpoint, making durable any writes on unjourna...
Definition: wiredtiger_recovery_unit.cpp:188
Changes _changes
Definition: wiredtiger_recovery_unit.h:181
UniqueWiredTigerSession _session
Definition: wiredtiger_recovery_unit.h:155
boost::optional< Timestamp > _lastTimestampSet
Definition: wiredtiger_recovery_unit.h:174
void assertInActiveTxn() const
Definition: wiredtiger_recovery_unit.h:212
WiredTigerBeginTxnBlock::IgnorePrepared _ignorePrepared
Definition: wiredtiger_recovery_unit.h:170
void _commit()
Definition: wiredtiger_recovery_unit.cpp:80
void * writingPtr(void *data, size_t len) override
Declare that the data at [x, x + len) is being written.
Definition: wiredtiger_recovery_unit.cpp:239
boost::optional< Timestamp > getPointInTimeReadTimestamp() const override
Returns the Timestamp being used by this recovery unit or boost::none if not reading from a point in ...
Definition: wiredtiger_recovery_unit.cpp:317
void abandonSnapshot() override
If there is an open transaction, it is closed.
Definition: wiredtiger_recovery_unit.cpp:225
ReadSource _timestampReadSource
Definition: wiredtiger_recovery_unit.h:162
bool inActiveTxn() const
Definition: wiredtiger_recovery_unit.h:134
static void appendGlobalStats(BSONObjBuilder &b)
void setTimestampReadSource(ReadSource source, boost::optional< Timestamp > provided=boost::none) override
Sets which timestamp to use for read transactions.
Definition: wiredtiger_recovery_unit.cpp:472
A Change is an action that is registerChange()'d while a WriteUnitOfWork exists.
Definition: recovery_unit.h:281
void _txnClose(bool commit)
Definition: wiredtiger_recovery_unit.cpp:244
bool _inUnitOfWork
Definition: wiredtiger_recovery_unit.h:157
WiredTigerSession * _session
Definition: wiredtiger_recovery_unit.h:219
Status setTimestamp(Timestamp timestamp) override
Sets a timestamp to assign to future writes in a transaction.
Definition: wiredtiger_recovery_unit.cpp:405
bool _isOplogReader
Definition: wiredtiger_recovery_unit.h:179
bool _active
Definition: wiredtiger_recovery_unit.h:158
Timestamp _readAtTimestamp
Definition: wiredtiger_recovery_unit.h:177
Definition: snapshot.h:37
This cache implements a shared pool of WiredTiger sessions with the goal to amortize the cost of sess...
Definition: wiredtiger_session_cache.h:156
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
uint64_t _tableID
Definition: wiredtiger_recovery_unit.h:217
std::unique_ptr< WiredTigerSession, typename WiredTigerSessionCache::WiredTigerSessionDeleter > UniqueWiredTigerSession
A unique handle type for WiredTigerSession pointers obtained from a WiredTigerSessionCache.
Definition: wiredtiger_session_cache.h:305
void clearCommitTimestamp() override
Definition: wiredtiger_recovery_unit.cpp:448
void commitUnitOfWork() override
Marks the end of a unit of work and commits all changes registered by calls to onCommit or registerCh...
Definition: wiredtiger_recovery_unit.cpp:162
std::unique_ptr< Timer > _timer
Definition: wiredtiger_recovery_unit.h:178
Definition: wiredtiger_recovery_unit.h:52
std::string uri
Definition: wiredtiger_standard_record_store_test.cpp:367
void _ensureSession()
Definition: wiredtiger_recovery_unit.cpp:174
WiredTigerRecoveryUnit * _ru
Definition: wiredtiger_recovery_unit.h:218