Skip to content

Commit

Permalink
SERVER-26348: Dissallow oplog reads when in startup (like rollback)
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthernandez committed Sep 27, 2016
1 parent dc50fa5 commit dc791d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/mongo/db/repl/replication_coordinator_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1953,9 +1953,10 @@ bool ReplicationCoordinatorImpl::canAcceptWritesFor(const NamespaceString& ns) {
Status ReplicationCoordinatorImpl::checkCanServeReadsFor(OperationContext* txn,
const NamespaceString& ns,
bool slaveOk) {
if (_memberState.rollback() && ns.isOplog()) {
return Status(ErrorCodes::NotMasterOrSecondary,
"cannot read from oplog collection while in rollback");
if ((_memberState.startup() || _memberState.startup2() || _memberState.rollback()) &&
ns.isOplog()) {
return {ErrorCodes::NotMasterOrSecondary,
"Oplog collection reads are not allowed while in the rollback or startup state."};
}
if (txn->getClient()->isInDirectClient()) {
return Status::OK();
Expand Down

0 comments on commit dc791d2

Please sign in to comment.