0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

SERVER-19833 Error out when attempting to do committed reads on non-supported storage engines

This commit is contained in:
matt dannenberg 2015-08-11 11:39:01 -04:00
parent 71545d3b8e
commit 01f2a40e33
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,12 @@
// Ensure read majority works on a standalone node, even with non-snapshotting storage engines.
(function() {
"use strict";
var name = "readMajority";
db = db.getSiblingDB(name);
assert.writeOK(db.foo.insert({x: 3}));
assert.commandWorked(db.foo.runCommand({find: name, readConcern: {level: "majority"}}));
}());

View File

@ -1320,7 +1320,11 @@ bool Command::run(OperationContext* txn,
return false;
}
}
if (readConcern.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern) {
if ((replCoord->getReplicationMode() ==
repl::ReplicationCoordinator::Mode::modeReplSet ||
testingSnapshotBehaviorInIsolation) &&
readConcern.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern) {
Status status = txn->recoveryUnit()->setReadFromMajorityCommittedSnapshot();
if (!status.isOK()) {
replyBuilder->setMetadata(rpc::makeEmptyMetadata()).setCommandReply(status);