Storage Engine API
mongo::WiredTigerSnapshotManager Class Referencefinal

#include <wiredtiger_snapshot_manager.h>

Inheritance diagram for mongo::WiredTigerSnapshotManager:
mongo::SnapshotManager

Public Member Functions

 WiredTigerSnapshotManager ()=default
 
void setCommittedSnapshot (const Timestamp &timestamp) final
 Sets the snapshot to be used for committed reads. More...
 
void setLocalSnapshot (const Timestamp &timestamp) final
 Sets the snapshot for the last stable timestamp for reading on secondaries. More...
 
boost::optional< Timestamp > getLocalSnapshot () final
 Returns the local snapshot timestamp. More...
 
void dropAllSnapshots () final
 Drops all snapshots and clears the "committed" snapshot. More...
 
Timestamp beginTransactionOnCommittedSnapshot (WT_SESSION *session) const
 Starts a transaction and returns the SnapshotName used. More...
 
Timestamp beginTransactionOnLocalSnapshot (WT_SESSION *session, WiredTigerBeginTxnBlock::IgnorePrepared ignorePrepared) const
 Starts a transaction on the last stable local timestamp, set by setLocalSnapshot. More...
 
boost::optional< Timestamp > getMinSnapshotForNextCommittedRead () const
 Returns lowest SnapshotName that could possibly be used by a future call to beginTransactionOnCommittedSnapshot, or boost::none if there is currently no committed snapshot. More...
 

Private Member Functions

 MONGO_DISALLOW_COPYING (WiredTigerSnapshotManager)
 

Private Attributes

stdx::mutex _committedSnapshotMutex
 
boost::optional< Timestamp > _committedSnapshot
 
stdx::mutex _localSnapshotMutex
 
boost::optional< Timestamp > _localSnapshot
 

Additional Inherited Members

- Protected Member Functions inherited from mongo::SnapshotManager
virtual ~SnapshotManager ()=default
 SnapshotManagers are not intended to be deleted through pointers to base type. More...
 

Constructor & Destructor Documentation

◆ WiredTigerSnapshotManager()

mongo::WiredTigerSnapshotManager::WiredTigerSnapshotManager ( )
default

Member Function Documentation

◆ beginTransactionOnCommittedSnapshot()

Timestamp mongo::WiredTigerSnapshotManager::beginTransactionOnCommittedSnapshot ( WT_SESSION *  session) const

Starts a transaction and returns the SnapshotName used.

Throws if there is currently no committed snapshot.

◆ beginTransactionOnLocalSnapshot()

Timestamp mongo::WiredTigerSnapshotManager::beginTransactionOnLocalSnapshot ( WT_SESSION *  session,
WiredTigerBeginTxnBlock::IgnorePrepared  ignorePrepared 
) const

Starts a transaction on the last stable local timestamp, set by setLocalSnapshot.

Throws if no local snapshot has been set.

◆ dropAllSnapshots()

void mongo::WiredTigerSnapshotManager::dropAllSnapshots ( )
finalvirtual

Drops all snapshots and clears the "committed" snapshot.

Implements mongo::SnapshotManager.

◆ getLocalSnapshot()

boost::optional< Timestamp > mongo::WiredTigerSnapshotManager::getLocalSnapshot ( )
finalvirtual

Returns the local snapshot timestamp.

Implements mongo::SnapshotManager.

◆ getMinSnapshotForNextCommittedRead()

boost::optional< Timestamp > mongo::WiredTigerSnapshotManager::getMinSnapshotForNextCommittedRead ( ) const

Returns lowest SnapshotName that could possibly be used by a future call to beginTransactionOnCommittedSnapshot, or boost::none if there is currently no committed snapshot.

This should not be used for starting a transaction on this SnapshotName since the named snapshot may be deleted by the time you start the transaction.

◆ MONGO_DISALLOW_COPYING()

mongo::WiredTigerSnapshotManager::MONGO_DISALLOW_COPYING ( WiredTigerSnapshotManager  )
private

◆ setCommittedSnapshot()

void mongo::WiredTigerSnapshotManager::setCommittedSnapshot ( const Timestamp &  timestamp)
finalvirtual

Sets the snapshot to be used for committed reads.

Implementations are allowed to assume that all older snapshots have names that compare less than the passed in name, and newer ones compare greater.

This is called while holding a very hot mutex. Therefore it should avoid doing any work that can be done later.

Implements mongo::SnapshotManager.

◆ setLocalSnapshot()

void mongo::WiredTigerSnapshotManager::setLocalSnapshot ( const Timestamp &  timestamp)
finalvirtual

Sets the snapshot for the last stable timestamp for reading on secondaries.

Implements mongo::SnapshotManager.

Member Data Documentation

◆ _committedSnapshot

boost::optional<Timestamp> mongo::WiredTigerSnapshotManager::_committedSnapshot
private

◆ _committedSnapshotMutex

stdx::mutex mongo::WiredTigerSnapshotManager::_committedSnapshotMutex
mutableprivate

◆ _localSnapshot

boost::optional<Timestamp> mongo::WiredTigerSnapshotManager::_localSnapshot
private

◆ _localSnapshotMutex

stdx::mutex mongo::WiredTigerSnapshotManager::_localSnapshotMutex
mutableprivate

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