37 #include <wiredtiger.h> 41 #include "mongo/platform/atomic_word.h" 42 #include "mongo/stdx/mutex.h" 43 #include "mongo/util/concurrency/spin_lock.h" 47 class WiredTigerKVEngine;
48 class WiredTigerSessionCache;
74 WiredTigerSession(WT_CONNECTION* conn, uint64_t epoch = 0, uint64_t cursorEpoch = 0);
87 uint64_t cursorEpoch = 0);
95 WT_CURSOR* getCursor(
const std::string&
uri, uint64_t
id,
bool forRecordStore);
97 void releaseCursor(uint64_t
id, WT_CURSOR* cursor);
105 void closeAllCursors(
const std::string& uri);
112 return _dropQueuedIdentsAtSessionEnd;
116 _dropQueuedIdentsAtSessionEnd = dropQueuedIdentsAtSessionEnd;
119 static uint64_t genTableId();
124 static const uint64_t kMetadataTableId = 0;
149 bool _dropQueuedIdentsAtSessionEnd =
true;
173 static bool isEngineCachingCursors();
180 std::unique_ptr<WiredTigerSession, WiredTigerSessionDeleter> getSession();
191 void closeCursorsForQueuedDrops();
197 void closeAllCursors(
const std::string&
uri);
212 void waitUntilDurable(
bool forceCheckpoint,
bool stableCheckpoint);
226 void waitUntilPreparedUnitOfWorkCommitsOrAborts(OperationContext*
opCtx);
232 void notifyPreparedUnitOfWorkHasCommittedOrAborted();
239 return _snapshotManager;
242 return _snapshotManager;
248 return _cursorEpoch.load();
264 static const uint32_t kShuttingDownMask = 1 << 31;
290 WT_SESSION* _waitUntilDurableSession =
nullptr;
stdx::condition_variable _prepareCommittedOrAbortedCond
Definition: wiredtiger_session_cache.h:282
static NoOpJournalListener instance
Definition: journal_listener.h:70
WT_CONNECTION * conn() const
Definition: wiredtiger_session_cache.h:234
const uint64_t _epoch
Definition: wiredtiger_session_cache.h:142
WT_SESSION * _session
Definition: wiredtiger_session_cache.h:145
KVEngine * engine
Definition: kv_engine_test_timestamps.cpp:205
void setJournalListener(JournalListener *jl)
Definition: dur.cpp:906
CursorCache _cursors
Definition: wiredtiger_session_cache.h:146
uint64_t getCursorEpoch() const
Definition: wiredtiger_session_cache.h:247
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
WT_CURSOR * _cursor
Definition: wiredtiger_session_cache.h:57
int cursorsOut() const
Definition: wiredtiger_session_cache.h:107
std::list< WiredTigerCachedCursor > CursorCache
Definition: wiredtiger_session_cache.h:130
stdx::mutex _journalListenerMutex
Definition: wiredtiger_session_cache.h:286
AtomicUInt64 _epoch
Definition: wiredtiger_session_cache.h:271
WiredTigerCachedCursor(uint64_t id, uint64_t gen, WT_CURSOR *cursor)
Definition: wiredtiger_session_cache.h:52
WiredTigerSessionCache * _cache
Definition: wiredtiger_session_cache.h:144
This is a structure that caches 1 cursor for each uri.
Definition: wiredtiger_session_cache.h:65
uint64_t _cursorEpoch
Definition: wiredtiger_session_cache.h:143
const WiredTigerSnapshotManager & snapshotManager() const
Definition: wiredtiger_session_cache.h:241
uint64_t _cursorGen
Definition: wiredtiger_session_cache.h:147
AtomicUInt64 _cursorEpoch
Definition: wiredtiger_session_cache.h:274
uint64_t _getEpoch() const
Definition: wiredtiger_session_cache.h:133
bool isDropQueuedIdentsAtSessionEndAllowed() const
Definition: wiredtiger_session_cache.h:111
AtomicUInt32 _shuttingDown
Definition: wiredtiger_session_cache.h:263
Definition: wiredtiger_kv_engine.h:65
WiredTigerKVEngine * _engine
Definition: wiredtiger_session_cache.h:256
std::unique_ptr< EphemeralForTestEngine > _engine
Definition: ephemeral_for_test_engine_test.cpp:53
This class allows for the storageEngine to alert the rest of the system about journaled write progres...
Definition: journal_listener.h:48
Definition: wiredtiger_session_cache.h:50
stdx::mutex _cacheLock
Definition: wiredtiger_session_cache.h:266
WiredTigerKVEngine * getKVEngine() const
Definition: wiredtiger_session_cache.h:251
SessionCache _sessions
Definition: wiredtiger_session_cache.h:268
std::vector< WiredTigerSession * > SessionCache
Definition: wiredtiger_session_cache.h:267
stdx::mutex _prepareCommittedOrAbortedMutex
Definition: wiredtiger_session_cache.h:281
WiredTigerSnapshotManager & snapshotManager()
Definition: wiredtiger_session_cache.h:238
WT_SESSION * getSession() const
Definition: wiredtiger_session_cache.h:91
void dropQueuedIdentsAtSessionEndAllowed(bool dropQueuedIdentsAtSessionEnd)
Definition: wiredtiger_session_cache.h:115
stdx::mutex _lastSyncMutex
Definition: wiredtiger_session_cache.h:278
int _cursorsOut
Definition: wiredtiger_session_cache.h:148
uint64_t _id
Definition: wiredtiger_session_cache.h:55
std::uint64_t _lastCommitOrAbortCounter
Definition: wiredtiger_session_cache.h:283
AtomicUInt32 _lastSyncTime
Definition: wiredtiger_session_cache.h:277
WT_CONNECTION * _conn
Definition: wiredtiger_prefixed_index_test.cpp:100
This deleter automatically releases WiredTigerSession objects when no longer needed.
Definition: wiredtiger_session_cache.h:165
uint64_t _gen
Definition: wiredtiger_session_cache.h:56
This cache implements a shared pool of WiredTiger sessions with the goal to amortize the cost of sess...
Definition: wiredtiger_session_cache.h:156
WiredTigerSnapshotManager _snapshotManager
Definition: wiredtiger_session_cache.h:258
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
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
uint64_t _getCursorEpoch() const
Definition: wiredtiger_session_cache.h:138
WT_CONNECTION * _conn
Definition: wiredtiger_session_cache.h:257
Definition: wiredtiger_snapshot_manager.h:45
std::string uri
Definition: wiredtiger_standard_record_store_test.cpp:367