summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2016-06-27 08:44:45 -0400
committerEric Milkie <milkie@10gen.com>2016-06-27 08:44:45 -0400
commit15d3d1f9bd151a2cd21fc7bee0bffc61caaaeb1d (patch)
tree459eb2373a65531ac145958a17afb3f6f46a8850
parent52f29d0dc82569e3fb8a008c418f50be2bc61844 (diff)
downloadmongo-15d3d1f9bd151a2cd21fc7bee0bffc61caaaeb1d.tar.gz
Revert "SERVER-24494 Implemented parsing for linearizable read concern."r3.3.9
This reverts commit cd5b90cfe19732cd576fc7b55e935fd4c74d187b.
-rw-r--r--jstests/replsets/linearizable_read_concern_parsing.js45
-rw-r--r--src/mongo/db/dbcommands.cpp15
-rw-r--r--src/mongo/db/repl/read_concern_args.cpp10
3 files changed, 7 insertions, 63 deletions
diff --git a/jstests/replsets/linearizable_read_concern_parsing.js b/jstests/replsets/linearizable_read_concern_parsing.js
deleted file mode 100644
index f2a7871cf68..00000000000
--- a/jstests/replsets/linearizable_read_concern_parsing.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This tests that commands passed with 'readConcern: linearizable' are parsed correctly. It
- * first expects a success on the primary node. Then it expects a failure when a
- * linearizable read concern is sent to the secondary node. Finally, it expects a
- * failure when the afterOpTime field is also provided.
- *
- */
-load("jstests/replsets/rslib.js");
-(function() {
-
- var replTest = new ReplSetTest({
- name: 'linearizable_read_concern_parsing',
- nodes: 3,
- nodeOptions: {enableMajorityReadConcern: ''}
- });
-
- if (!startSetIfSupportsReadMajority(replTest)) {
- jsTest.log("skipping test since storage engine doesn't support committed reads");
- return true;
- }
- replTest.initiate();
-
- var primary = replTest.getPrimary();
- primary.getDB("test").foo.insert({number: 2});
-
- var goodCmd = assert.commandWorked(
- primary.getDB("test").runCommand({'find': 'foo', readConcern: {level: "linearizable"}}));
-
- var secondary = replTest.getSecondary();
- var badCmd = assert.commandFailed(secondary.getDB("test").runCommand({
- 'find': 'foo',
- readConcern: {level: "linearizable"},
- }));
-
- assert.eq(badCmd.errmsg, "cannot satisfy linearizable read concern on non-primary node");
- assert.eq(badCmd.code, ErrorCodes.NotMaster);
-
- var opTimeCmd = assert.commandFailed(primary.getDB("test").runCommand({
- 'find': 'foo',
- readConcern: {level: "linearizable", 'afterOpTime': {ts: Timestamp(1, 2), t: 1}}
- }));
- assert.eq(opTimeCmd.errmsg, "afterOpTime not compatible with read concern level linearizable");
- assert.eq(opTimeCmd.code, ErrorCodes.FailedToParse);
-
-}()); \ No newline at end of file
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index ecf5b9b7cb0..9b5a6c3c6c8 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -1461,6 +1461,7 @@ bool Command::run(OperationContext* txn,
replyBuilder->setMetadata(rpc::makeEmptyMetadata());
return result;
}
+
if (!supportsReadConcern()) {
// Only return an error if a non-nullish readConcern was parsed, but do not process
// readConcern regardless.
@@ -1497,11 +1498,11 @@ bool Command::run(OperationContext* txn,
return result;
}
}
+
if ((replCoord->getReplicationMode() ==
repl::ReplicationCoordinator::Mode::modeReplSet ||
testingSnapshotBehaviorInIsolation) &&
- (readConcernArgs.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern ||
- readConcernArgs.getLevel() == repl::ReadConcernLevel::kLinearizableReadConcern)) {
+ readConcernArgs.getLevel() == repl::ReadConcernLevel::kMajorityReadConcern) {
// ReadConcern Majority is not supported in ProtocolVersion 0.
if (!testingSnapshotBehaviorInIsolation && !replCoord->isV1ElectionProtocol()) {
auto result = appendCommandStatus(
@@ -1538,15 +1539,6 @@ bool Command::run(OperationContext* txn,
}
}
}
-
- if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kLinearizableReadConcern) {
- uassert(ErrorCodes::FailedToParse,
- "afterOpTime not compatible with read concern level linearizable",
- readConcernArgs.getOpTime().isNull());
- uassert(ErrorCodes::NotMaster,
- "cannot satisfy linearizable read concern on non-primary node",
- replCoord->getMemberState().primary());
- }
}
// run expects non-const bsonobj
@@ -1559,7 +1551,6 @@ bool Command::run(OperationContext* txn,
StatusWith<WriteConcernOptions> wcResult =
extractWriteConcern(txn, cmd, db, this->supportsWriteConcern(cmd));
-
if (!wcResult.isOK()) {
auto result = appendCommandStatus(inPlaceReplyBob, wcResult.getStatus());
inPlaceReplyBob.doneFast();
diff --git a/src/mongo/db/repl/read_concern_args.cpp b/src/mongo/db/repl/read_concern_args.cpp
index c0af213fe56..79c9d7b65b4 100644
--- a/src/mongo/db/repl/read_concern_args.cpp
+++ b/src/mongo/db/repl/read_concern_args.cpp
@@ -112,17 +112,15 @@ Status ReadConcernArgs::initialize(const BSONElement& readConcernElem) {
if (!readCommittedStatus.isOK()) {
return readCommittedStatus;
}
+
if (levelString == kLocalReadConcernStr) {
_level = ReadConcernLevel::kLocalReadConcern;
} else if (levelString == kMajorityReadConcernStr) {
_level = ReadConcernLevel::kMajorityReadConcern;
- } else if (levelString == kLinearizableReadConcernStr) {
- _level = ReadConcernLevel::kLinearizableReadConcern;
} else {
- return Status(
- ErrorCodes::FailedToParse,
- str::stream() << kReadConcernFieldName << '.' << kLevelFieldName
- << " must be either 'local', 'majority' or 'linearizable'");
+ return Status(ErrorCodes::FailedToParse,
+ str::stream() << kReadConcernFieldName << '.' << kLevelFieldName
+ << " must be either 'local' or 'majority'");
}
} else {
return Status(ErrorCodes::InvalidOptions,