summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/storage_interface_mock.cpp
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-07-20 16:40:47 -0400
committerJudah Schvimer <judah@mongodb.com>2017-07-20 16:45:00 -0400
commitd8bcead30c25f076728f7115cdf98d7a93ab7a4f (patch)
treeaf85b9db5913e3f5cc792e4e7966bbe0127a181e /src/mongo/db/repl/storage_interface_mock.cpp
parent808368314d1036b022334b67a9b2bd306daab840 (diff)
downloadmongo-d8bcead30c25f076728f7115cdf98d7a93ab7a4f.tar.gz
SERVER-30184 Add mock getters to storage interface for stable timestamp and initial data timestamp
Diffstat (limited to 'src/mongo/db/repl/storage_interface_mock.cpp')
-rw-r--r--src/mongo/db/repl/storage_interface_mock.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/mongo/db/repl/storage_interface_mock.cpp b/src/mongo/db/repl/storage_interface_mock.cpp
index 89fb5831083..2bb4e8c4597 100644
--- a/src/mongo/db/repl/storage_interface_mock.cpp
+++ b/src/mongo/db/repl/storage_interface_mock.cpp
@@ -40,7 +40,7 @@ namespace mongo {
namespace repl {
StatusWith<int> StorageInterfaceMock::getRollbackID(OperationContext* opCtx) {
- stdx::lock_guard<stdx::mutex> lock(_rbidMutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
if (!_rbidInitialized) {
return Status(ErrorCodes::NamespaceNotFound, "Rollback ID not initialized");
}
@@ -48,7 +48,7 @@ StatusWith<int> StorageInterfaceMock::getRollbackID(OperationContext* opCtx) {
}
Status StorageInterfaceMock::initializeRollbackID(OperationContext* opCtx) {
- stdx::lock_guard<stdx::mutex> lock(_rbidMutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
if (_rbidInitialized) {
return Status(ErrorCodes::NamespaceExists, "Rollback ID already initialized");
}
@@ -60,13 +60,35 @@ Status StorageInterfaceMock::initializeRollbackID(OperationContext* opCtx) {
}
Status StorageInterfaceMock::incrementRollbackID(OperationContext* opCtx) {
- stdx::lock_guard<stdx::mutex> lock(_rbidMutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
if (!_rbidInitialized) {
return Status(ErrorCodes::NamespaceNotFound, "Rollback ID not initialized");
}
_rbid++;
return Status::OK();
}
+
+void StorageInterfaceMock::setStableTimestamp(OperationContext* opCtx, SnapshotName snapshotName) {
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
+ _stableTimestamp = snapshotName;
+}
+
+void StorageInterfaceMock::setInitialDataTimestamp(OperationContext* opCtx,
+ SnapshotName snapshotName) {
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
+ _initialDataTimestamp = snapshotName;
+}
+
+SnapshotName StorageInterfaceMock::getStableTimestamp() const {
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
+ return _stableTimestamp;
+}
+
+SnapshotName StorageInterfaceMock::getInitialDataTimestamp() const {
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
+ return _initialDataTimestamp;
+}
+
Status CollectionBulkLoaderMock::init(const std::vector<BSONObj>& secondaryIndexSpecs) {
LOG(1) << "CollectionBulkLoaderMock::init called";
stats->initCalled = true;