diff options
author | Misha Tyulenev <misha@mongodb.com> | 2017-08-15 11:32:53 -0400 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2017-08-15 11:33:07 -0400 |
commit | eacef2db99841b1a88837f0e10d1c8726656dc0f (patch) | |
tree | 1c1b0f1e694ad775e0f826dc16531bd931c0775a /src/mongo/db | |
parent | 4824a25019fda373d8d149e117c857fcfbf77ad0 (diff) | |
download | mongo-eacef2db99841b1a88837f0e10d1c8726656dc0f.tar.gz |
SERVER-29987 pass afterClusterTime to all commands
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/commands.h | 20 | ||||
-rw-r--r-- | src/mongo/db/commands/count_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/distinct.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/find_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/geo_near_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/getmore_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/group_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/haystack.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/parallel_collection_scan.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/pipeline_command.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_mongod.cpp | 9 |
11 files changed, 26 insertions, 22 deletions
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index cc6a9aec3f7..dfcda118277 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -203,20 +203,21 @@ public: virtual bool maintenanceOk() const = 0; /** - * Returns true if this Command supports the readConcern argument. Takes the command object and - * the name of the database on which it was invoked as arguments, so that readConcern can be - * conditionally rejected based on the command's parameters and/or namespace. + * Returns true if this Command supports the non-local readConcern:level field value. Takes the + * command object and the name of the database on which it was invoked as arguments, so that + * readConcern can be conditionally rejected based on the command's parameters and/or namespace. * - * If the readConcern argument is sent to a command that returns false the command processor - * will reject the command, returning an appropriate error message. For commands that support - * the argument, the command processor will instruct the RecoveryUnit to only return - * "committed" data, failing if this isn't supported by the storage engine. + * If the readConcern non-local level argument is sent to a command that returns false the + * command processor will reject the command, returning an appropriate error message. For + * commands that support the argument, the command processor will instruct the RecoveryUnit to + * only return "committed" data, failing if this isn't supported by the storage engine. * * Note that this is never called on mongos. Sharded commands are responsible for forwarding * the option to the shards as needed. We rely on the shards to fail the commands in the * cases where it isn't supported. */ - virtual bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const = 0; + virtual bool supportsNonLocalReadConcern(const std::string& dbName, + const BSONObj& cmdObj) const = 0; /** * Returns LogicalOp for this command. @@ -327,7 +328,8 @@ public: return true; /* assumed true prior to commit */ } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const override { + bool supportsNonLocalReadConcern(const std::string& dbName, + const BSONObj& cmdObj) const override { return false; } diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp index 199c3e0be9b..3f18b9056fe 100644 --- a/src/mongo/db/commands/count_cmd.cpp +++ b/src/mongo/db/commands/count_cmd.cpp @@ -79,7 +79,7 @@ public: return false; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index a0eceaaa7d5..96f08dc80ed 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -87,7 +87,7 @@ public: return false; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 38712e3e920..73c7dbcee8f 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -94,7 +94,7 @@ public: return false; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp index 46c2ab30c50..2a5c5c32d6c 100644 --- a/src/mongo/db/commands/geo_near_cmd.cpp +++ b/src/mongo/db/commands/geo_near_cmd.cpp @@ -74,7 +74,7 @@ public: bool slaveOverrideOk() const { return true; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index f919343bda2..eb28d020927 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -102,7 +102,7 @@ public: return false; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { // Uses the readConcern setting from whatever created the cursor. return false; } diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp index 880030387c5..1bdcb3e70a9 100644 --- a/src/mongo/db/commands/group_cmd.cpp +++ b/src/mongo/db/commands/group_cmd.cpp @@ -79,7 +79,7 @@ private: return true; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/haystack.cpp b/src/mongo/db/commands/haystack.cpp index 565551401cd..de048b6f4c6 100644 --- a/src/mongo/db/commands/haystack.cpp +++ b/src/mongo/db/commands/haystack.cpp @@ -76,7 +76,7 @@ public: return true; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index 4e81a55ec6c..5fbe37b1132 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -66,7 +66,7 @@ public: return true; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { + bool supportsNonLocalReadConcern(const std::string& dbName, const BSONObj& cmdObj) const final { return true; } diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 9d0c83e7af9..68c74a0e865 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -65,7 +65,8 @@ public: return true; } - bool supportsReadConcern(const std::string& dbName, const BSONObj& cmdObj) const override { + bool supportsNonLocalReadConcern(const std::string& dbName, + const BSONObj& cmdObj) const override { return !AggregationRequest::parseNs(dbName, cmdObj).isCollectionlessAggregateNS(); } diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index 58d2ed0dcea..9a57f16df1f 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -411,7 +411,8 @@ bool runCommandImpl(OperationContext* opCtx, const std::string db = request.getDatabase().toString(); BSONObjBuilder inPlaceReplyBob = replyBuilder->getInPlaceReplyBuilder(bytesToReserve); - auto readConcernArgsStatus = _extractReadConcern(cmd, command->supportsReadConcern(db, cmd)); + auto readConcernArgsStatus = + _extractReadConcern(cmd, command->supportsNonLocalReadConcern(db, cmd)); if (!readConcernArgsStatus.isOK()) { auto result = @@ -478,7 +479,7 @@ bool runCommandImpl(OperationContext* opCtx, // When a linearizable read command is passed in, check to make sure we're reading // from the primary. - if (command->supportsReadConcern(db, cmd) && + if (command->supportsNonLocalReadConcern(db, cmd) && (readConcernArgsStatus.getValue().getLevel() == repl::ReadConcernLevel::kLinearizableReadConcern) && (request.getCommandName() != "getMore")) { @@ -712,8 +713,8 @@ void execCommandDatabase(OperationContext* opCtx, appendReplyMetadata(opCtx, request, &metadataBob); const std::string db = request.getDatabase().toString(); - auto readConcernArgsStatus = - _extractReadConcern(request.body, command->supportsReadConcern(db, request.body)); + auto readConcernArgsStatus = _extractReadConcern( + request.body, command->supportsNonLocalReadConcern(db, request.body)); auto operationTime = readConcernArgsStatus.isOK() ? computeOperationTime( opCtx, startOperationTime, readConcernArgsStatus.getValue().getLevel()) |