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:
parent
71545d3b8e
commit
01f2a40e33
12
jstests/core/read_majority_mmap.js
Normal file
12
jstests/core/read_majority_mmap.js
Normal 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"}}));
|
||||
|
||||
}());
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user