summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2019-02-07 18:15:44 -0500
committerVesselina Ratcheva <vesselina.ratcheva@10gen.com>2019-02-11 16:21:07 -0500
commit302a4f91a54a77221f7408b95fcbb988a9366d03 (patch)
tree7a3fef3edaf6c96d932113bb2265e25ff050c98b /src/mongo/db
parenta27f223e14ddfe73bc300e4e1801d51575b44795 (diff)
downloadmongo-302a4f91a54a77221f7408b95fcbb988a9366d03.tar.gz
SERVER-39139 Make canAcceptWritesFor, canAcceptWritesForDatabase and canServeReadsFor check RSTL
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/replication_coordinator.h4
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h
index 8d109bf4be9..b61b2e71495 100644
--- a/src/mongo/db/repl/replication_coordinator.h
+++ b/src/mongo/db/repl/replication_coordinator.h
@@ -214,8 +214,8 @@ public:
* will not be able to receive writes to a database other than local (it will not be
* treated as standalone node).
*
- * NOTE: This function can only be meaningfully called while the caller holds the global
- * lock in some mode other than MODE_NONE.
+ * NOTE: This function can only be meaningfully called while the caller holds the
+ * ReplicationStateTransitionLock in some mode other than MODE_NONE.
*/
virtual bool canAcceptWritesForDatabase(OperationContext* opCtx, StringData dbName) = 0;
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index f003bfdba66..3becf53450a 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -2050,8 +2050,8 @@ bool ReplicationCoordinatorImpl::isMasterForReportingPurposes() {
bool ReplicationCoordinatorImpl::canAcceptWritesForDatabase(OperationContext* opCtx,
StringData dbName) {
- // The answer isn't meaningful unless we hold the global lock.
- invariant(opCtx->lockState()->isLocked());
+ // The answer isn't meaningful unless we hold the ReplicationStateTransitionLock.
+ invariant(opCtx->lockState()->isRSTLLocked());
return canAcceptWritesForDatabase_UNSAFE(opCtx, dbName);
}
@@ -2073,7 +2073,7 @@ bool ReplicationCoordinatorImpl::canAcceptWritesForDatabase_UNSAFE(OperationCont
bool ReplicationCoordinatorImpl::canAcceptWritesFor(OperationContext* opCtx,
const NamespaceString& ns) {
- invariant(opCtx->lockState()->isLocked());
+ invariant(opCtx->lockState()->isRSTLLocked());
return canAcceptWritesFor_UNSAFE(opCtx, ns);
}
@@ -2109,7 +2109,7 @@ bool ReplicationCoordinatorImpl::canAcceptWritesFor_UNSAFE(OperationContext* opC
Status ReplicationCoordinatorImpl::checkCanServeReadsFor(OperationContext* opCtx,
const NamespaceString& ns,
bool slaveOk) {
- invariant(opCtx->lockState()->isLocked());
+ invariant(opCtx->lockState()->isRSTLLocked());
return checkCanServeReadsFor_UNSAFE(opCtx, ns, slaveOk);
}