summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.cpp16
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.h4
2 files changed, 14 insertions, 6 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp
index bbe14690c7a..31a307a96b0 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.cpp
+++ b/src/mongo/db/repl/replication_coordinator_mock.cpp
@@ -236,11 +236,11 @@ void ReplicationCoordinatorMock::setMyHeartbeatMessage(const std::string& msg) {
}
void ReplicationCoordinatorMock::_setMyLastAppliedOpTimeAndWallTime(
- const OpTimeAndWallTime& opTimeAndWallTime) {
+ WithLock lk, const OpTimeAndWallTime& opTimeAndWallTime) {
_myLastAppliedOpTime = opTimeAndWallTime.opTime;
_myLastAppliedWallTime = opTimeAndWallTime.wallTime;
- setCurrentCommittedSnapshotOpTime(opTimeAndWallTime.opTime);
+ _setCurrentCommittedSnapshotOpTime(lk, opTimeAndWallTime.opTime);
if (auto storageEngine = _service->getStorageEngine()) {
if (auto snapshotManager = storageEngine->getSnapshotManager()) {
@@ -253,7 +253,7 @@ void ReplicationCoordinatorMock::setMyLastAppliedOpTimeAndWallTime(
const OpTimeAndWallTime& opTimeAndWallTime) {
stdx::lock_guard<Mutex> lk(_mutex);
- _setMyLastAppliedOpTimeAndWallTime(opTimeAndWallTime);
+ _setMyLastAppliedOpTimeAndWallTime(lk, opTimeAndWallTime);
}
void ReplicationCoordinatorMock::setMyLastDurableOpTimeAndWallTime(
@@ -269,7 +269,7 @@ void ReplicationCoordinatorMock::setMyLastAppliedOpTimeAndWallTimeForward(
stdx::lock_guard<Mutex> lk(_mutex);
if (opTimeAndWallTime.opTime > _myLastAppliedOpTime) {
- _setMyLastAppliedOpTimeAndWallTime(opTimeAndWallTime);
+ _setMyLastAppliedOpTimeAndWallTime(lk, opTimeAndWallTime);
}
}
@@ -657,11 +657,17 @@ Status ReplicationCoordinatorMock::updateTerm(OperationContext* opCtx, long long
void ReplicationCoordinatorMock::clearCommittedSnapshot() {}
-void ReplicationCoordinatorMock::setCurrentCommittedSnapshotOpTime(OpTime time) {
+void ReplicationCoordinatorMock::_setCurrentCommittedSnapshotOpTime(WithLock lk, OpTime time) {
_currentCommittedSnapshotOpTime = time;
}
+void ReplicationCoordinatorMock::setCurrentCommittedSnapshotOpTime(OpTime time) {
+ stdx::lock_guard<Mutex> lk(_mutex);
+ _setCurrentCommittedSnapshotOpTime(lk, time);
+}
+
OpTime ReplicationCoordinatorMock::getCurrentCommittedSnapshotOpTime() const {
+ stdx::lock_guard<Mutex> lk(_mutex);
return _currentCommittedSnapshotOpTime;
}
diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h
index 3ac7686ea34..dbe7b28ef83 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_mock.h
@@ -422,7 +422,9 @@ public:
virtual WriteConcernTagChanges* getWriteConcernTagChanges() override;
private:
- void _setMyLastAppliedOpTimeAndWallTime(const OpTimeAndWallTime& opTimeAndWallTime);
+ void _setMyLastAppliedOpTimeAndWallTime(WithLock lk,
+ const OpTimeAndWallTime& opTimeAndWallTime);
+ void _setCurrentCommittedSnapshotOpTime(WithLock lk, OpTime time);
ServiceContext* const _service;
ReplSettings _settings;