|
| WiredTigerRecoveryUnit (WiredTigerSessionCache *sc) |
|
| WiredTigerRecoveryUnit (WiredTigerSessionCache *sc, WiredTigerOplogManager *oplogManager) |
| It's expected a consumer would want to call the constructor that simply takes a WiredTigerSessionCache . More...
|
|
| ~WiredTigerRecoveryUnit () |
|
void | beginUnitOfWork (OperationContext *opCtx) override |
| Marks the beginning of a unit of work. More...
|
|
void | prepareUnitOfWork () override |
| Transitions the active unit of work to the "prepared" state. More...
|
|
void | commitUnitOfWork () override |
| Marks the end of a unit of work and commits all changes registered by calls to onCommit or registerChange, in order. More...
|
|
void | abortUnitOfWork () override |
| Marks the end of a unit of work and rolls back all changes registered by calls to onRollback or registerChange, in reverse order. More...
|
|
bool | waitUntilDurable () override |
| Waits until all commits that happened before this call are durable in the journal. More...
|
|
bool | waitUntilUnjournaledWritesDurable () override |
| Unlike waitUntilDurable , this method takes a stable checkpoint, making durable any writes on unjournaled tables that are behind the current stable timestamp. More...
|
|
void | registerChange (Change *change) override |
| The RecoveryUnit takes ownership of the change. More...
|
|
void | abandonSnapshot () override |
| If there is an open transaction, it is closed. More...
|
|
void | preallocateSnapshot () override |
| Informs the RecoveryUnit that a snapshot will be needed soon, if one was not already established. More...
|
|
Status | obtainMajorityCommittedSnapshot () override |
| Obtains a majority committed snapshot. More...
|
|
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 time. More...
|
|
SnapshotId | getSnapshotId () const override |
| Gets the local SnapshotId. More...
|
|
Status | setTimestamp (Timestamp timestamp) override |
| Sets a timestamp to assign to future writes in a transaction. More...
|
|
void | setCommitTimestamp (Timestamp timestamp) override |
| Sets a timestamp that will be assigned to all future writes on this RecoveryUnit until clearCommitTimestamp() is called. More...
|
|
void | clearCommitTimestamp () override |
|
Timestamp | getCommitTimestamp () override |
|
void | setPrepareTimestamp (Timestamp timestamp) override |
| Sets a prepare timestamp for the current transaction. More...
|
|
void | setIgnorePrepared (bool ignore) override |
| Sets whether or not to ignore prepared transactions if supported by this storage engine. More...
|
|
void | setTimestampReadSource (ReadSource source, boost::optional< Timestamp > provided=boost::none) override |
| Sets which timestamp to use for read transactions. More...
|
|
ReadSource | getTimestampReadSource () const override |
|
void * | writingPtr (void *data, size_t len) override |
| Declare that the data at [x, x + len) is being written. More...
|
|
void | setRollbackWritesDisabled () override |
| Sets a flag that declares this RecoveryUnit will skip rolling back writes, for the duration of the current outermost WriteUnitOfWork. More...
|
|
virtual void | setOrderedCommit (bool orderedCommit) override |
|
WiredTigerSession * | getSession () |
|
void | setIsOplogReader () |
|
void | beginIdle () |
| Enter a period of wait or computation during which there are no WT calls. More...
|
|
WiredTigerSession * | getSessionNoTxn () |
| Returns a session without starting a new WT txn on the session. More...
|
|
WiredTigerSessionCache * | getSessionCache () |
|
bool | inActiveTxn () const |
|
void | assertInActiveTxn () const |
|
virtual | ~RecoveryUnit () |
|
template<typename Callback > |
void | onRollback (Callback callback) |
| Registers a callback to be called if the current WriteUnitOfWork rolls back. More...
|
|
template<typename Callback > |
void | onCommit (Callback callback) |
| Registers a callback to be called if the current WriteUnitOfWork commits. More...
|
|
int & | writingInt (int &d) |
| Declare write intent for an int. More...
|
|
template<typename T > |
T * | writing (T *x) |
| A templated helper for writingPtr. More...
|
|
Status mongo::WiredTigerRecoveryUnit::obtainMajorityCommittedSnapshot |
( |
| ) |
|
|
overridevirtual |
Obtains a majority committed snapshot.
Snapshots should still be separately acquired and newer committed snapshots should be used if available whenever implementations would normally change snapshots.
If no snapshot has yet been marked as Majority Committed, returns a status with error code ReadConcernMajorityNotAvailableYet. After this returns successfully, at any point where implementations attempt to acquire committed snapshot, if there are none available due to a call to SnapshotManager::dropAllSnapshots(), a AssertionException with the same code should be thrown.
StorageEngines that don't support a SnapshotManager should use the default implementation.
Reimplemented from mongo::RecoveryUnit.
void mongo::WiredTigerRecoveryUnit::prepareUnitOfWork |
( |
| ) |
|
|
overridevirtual |
Transitions the active unit of work to the "prepared" state.
Must be called after beginUnitOfWork and before calling either abortUnitOfWork or commitUnitOfWork. Must be overridden by storage engines that support prepared transactions.
Must be preceded by a call to beginUnitOfWork and setPrepareTimestamp, in that order.
This cannot be called after setTimestamp or setCommitTimestamp.
Reimplemented from mongo::RecoveryUnit.
void mongo::WiredTigerRecoveryUnit::setRollbackWritesDisabled |
( |
| ) |
|
|
inlineoverridevirtual |
Sets a flag that declares this RecoveryUnit will skip rolling back writes, for the duration of the current outermost WriteUnitOfWork.
This function can only be called between a pair of unnested beginUnitOfWork() / endUnitOfWork() calls. The flag is cleared when endUnitOfWork() is called. While the flag is set, rollback will skip rolling back writes, but custom rollback change functions are still called. Clearly, this functionality should only be used when writing to temporary collections that can be cleaned up externally. For example, foreground index builds write to a temporary collection; if something goes wrong that normally requires a rollback, we can instead clean up the index by dropping the entire index. Setting the flag may permit increased performance.
Implements mongo::RecoveryUnit.
Status mongo::WiredTigerRecoveryUnit::setTimestamp |
( |
Timestamp |
timestamp | ) |
|
|
overridevirtual |
Sets a timestamp to assign to future writes in a transaction.
All subsequent writes will be assigned this timestamp. If setTimestamp() is called again, specifying a new timestamp, future writes will use this new timestamp but past writes remain with their originally assigned timestamps. Writes that occur before any setTimestamp() is called will be assigned the timestamp specified in the last setTimestamp() call in the transaction, at commit time.
setTimestamp() will fail if a commit timestamp is set using setCommitTimestamp() and not yet cleared with clearCommitTimestamp().
- Parameters
-
[in] | timestamp | Timestamp to assign to future writes in a transaction |
Reimplemented from mongo::RecoveryUnit.
bool mongo::WiredTigerRecoveryUnit::waitUntilUnjournaledWritesDurable |
( |
| ) |
|
|
overridevirtual |
Unlike waitUntilDurable
, this method takes a stable checkpoint, making durable any writes on unjournaled tables that are behind the current stable timestamp.
If the storage engine is starting from an "unstable" checkpoint, this method call will turn into an unstable checkpoint.
This must not be called by a system taking user writes until after a stable timestamp is passed to the storage engine.
- Returns
- Whether or not the storage engine can guarantee durability.
Reimplemented from mongo::RecoveryUnit.