summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h191
1 files changed, 103 insertions, 88 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h
index 4dcb216c060..6979f47af09 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h
@@ -44,116 +44,131 @@
namespace mongo {
- class BSONObjBuilder;
- class WiredTigerSession;
- class WiredTigerSessionCache;
+class BSONObjBuilder;
+class WiredTigerSession;
+class WiredTigerSessionCache;
- class WiredTigerRecoveryUnit : public RecoveryUnit {
- public:
- WiredTigerRecoveryUnit(WiredTigerSessionCache* sc);
+class WiredTigerRecoveryUnit : public RecoveryUnit {
+public:
+ WiredTigerRecoveryUnit(WiredTigerSessionCache* sc);
- virtual ~WiredTigerRecoveryUnit();
+ virtual ~WiredTigerRecoveryUnit();
- virtual void reportState( BSONObjBuilder* b ) const;
+ virtual void reportState(BSONObjBuilder* b) const;
- void beginUnitOfWork(OperationContext* opCtx) final;
- void commitUnitOfWork() final;
- void abortUnitOfWork() final;
+ void beginUnitOfWork(OperationContext* opCtx) final;
+ void commitUnitOfWork() final;
+ void abortUnitOfWork() final;
- virtual bool waitUntilDurable();
- virtual void goingToWaitUntilDurable();
+ virtual bool waitUntilDurable();
+ virtual void goingToWaitUntilDurable();
- virtual void registerChange(Change *);
+ virtual void registerChange(Change*);
- virtual void beingReleasedFromOperationContext();
- virtual void beingSetOnOperationContext();
+ virtual void beingReleasedFromOperationContext();
+ virtual void beingSetOnOperationContext();
- virtual void abandonSnapshot();
+ virtual void abandonSnapshot();
- // un-used API
- virtual void* writingPtr(void* data, size_t len) { invariant(!"don't call writingPtr"); }
+ // un-used API
+ virtual void* writingPtr(void* data, size_t len) {
+ invariant(!"don't call writingPtr");
+ }
- virtual void setRollbackWritesDisabled() {}
+ virtual void setRollbackWritesDisabled() {}
- virtual SnapshotId getSnapshotId() const;
+ virtual SnapshotId getSnapshotId() const;
- // ---- WT STUFF
+ // ---- WT STUFF
- WiredTigerSession* getSession(OperationContext* opCtx);
- WiredTigerSessionCache* getSessionCache() { return _sessionCache; }
- bool inActiveTxn() const { return _active; }
- void assertInActiveTxn() const;
+ WiredTigerSession* getSession(OperationContext* opCtx);
+ WiredTigerSessionCache* getSessionCache() {
+ return _sessionCache;
+ }
+ bool inActiveTxn() const {
+ return _active;
+ }
+ void assertInActiveTxn() const;
- bool everStartedWrite() const { return _everStartedWrite; }
+ bool everStartedWrite() const {
+ return _everStartedWrite;
+ }
- void setOplogReadTill( const RecordId& loc );
- RecordId getOplogReadTill() const { return _oplogReadTill; }
+ void setOplogReadTill(const RecordId& loc);
+ RecordId getOplogReadTill() const {
+ return _oplogReadTill;
+ }
- void markNoTicketRequired();
+ void markNoTicketRequired();
- static WiredTigerRecoveryUnit* get(OperationContext *txn);
+ static WiredTigerRecoveryUnit* get(OperationContext* txn);
- static void appendGlobalStats(BSONObjBuilder& b);
- private:
+ static void appendGlobalStats(BSONObjBuilder& b);
- void _abort();
- void _commit();
+private:
+ void _abort();
+ void _commit();
- void _txnClose( bool commit );
- void _txnOpen(OperationContext* opCtx);
+ void _txnClose(bool commit);
+ void _txnOpen(OperationContext* opCtx);
- WiredTigerSessionCache* _sessionCache; // not owned
- WiredTigerSession* _session; // owned, but from pool
- bool _defaultCommit;
- bool _inUnitOfWork;
- bool _active;
- uint64_t _myTransactionCount;
- bool _everStartedWrite;
- Timer _timer;
- bool _currentlySquirreled;
- bool _syncing;
- RecordId _oplogReadTill;
+ WiredTigerSessionCache* _sessionCache; // not owned
+ WiredTigerSession* _session; // owned, but from pool
+ bool _defaultCommit;
+ bool _inUnitOfWork;
+ bool _active;
+ uint64_t _myTransactionCount;
+ bool _everStartedWrite;
+ Timer _timer;
+ bool _currentlySquirreled;
+ bool _syncing;
+ RecordId _oplogReadTill;
- typedef OwnedPointerVector<Change> Changes;
- Changes _changes;
+ typedef OwnedPointerVector<Change> Changes;
+ Changes _changes;
- bool _noTicketNeeded;
- void _getTicket(OperationContext* opCtx);
- TicketHolderReleaser _ticket;
- };
-
- /**
- * This is a smart pointer that wraps a WT_CURSOR and knows how to obtain and get from pool.
- */
- class WiredTigerCursor {
- public:
- WiredTigerCursor(const std::string& uri,
- uint64_t uriID,
- bool forRecordStore,
- OperationContext* txn);
-
- ~WiredTigerCursor();
-
-
- WT_CURSOR* get() const {
- // TODO(SERVER-16816): assertInActiveTxn();
- return _cursor;
- }
-
- WT_CURSOR* operator->() const { return get(); }
-
- WiredTigerSession* getSession() { return _session; }
- WT_SESSION* getWTSession();
-
- void reset();
-
- void assertInActiveTxn() const { _ru->assertInActiveTxn(); }
-
- private:
- uint64_t _uriID;
- WiredTigerRecoveryUnit* _ru; // not owned
- WiredTigerSession* _session;
- WT_CURSOR* _cursor; // owned, but pulled
- };
+ bool _noTicketNeeded;
+ void _getTicket(OperationContext* opCtx);
+ TicketHolderReleaser _ticket;
+};
+/**
+ * This is a smart pointer that wraps a WT_CURSOR and knows how to obtain and get from pool.
+ */
+class WiredTigerCursor {
+public:
+ WiredTigerCursor(const std::string& uri,
+ uint64_t uriID,
+ bool forRecordStore,
+ OperationContext* txn);
+
+ ~WiredTigerCursor();
+
+
+ WT_CURSOR* get() const {
+ // TODO(SERVER-16816): assertInActiveTxn();
+ return _cursor;
+ }
+
+ WT_CURSOR* operator->() const {
+ return get();
+ }
+
+ WiredTigerSession* getSession() {
+ return _session;
+ }
+ WT_SESSION* getWTSession();
+
+ void reset();
+
+ void assertInActiveTxn() const {
+ _ru->assertInActiveTxn();
+ }
+
+private:
+ uint64_t _uriID;
+ WiredTigerRecoveryUnit* _ru; // not owned
+ WiredTigerSession* _session;
+ WT_CURSOR* _cursor; // owned, but pulled
+};
}