diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-02 17:01:35 -0400 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-04-02 20:04:36 -0400 |
commit | a16f90edd5339d3f58bec24e2a1639c0b2fd938e (patch) | |
tree | 1142d5c3bc277ca44b407dd28fa04e8303b8867f /src/mongo/db/commands.cpp | |
parent | c872bdd8d24a7beb9df42cbe227e99d6738ba71e (diff) | |
download | mongo-a16f90edd5339d3f58bec24e2a1639c0b2fd938e.tar.gz |
SERVER-34179 refactor isGenericArgument
Remove the static tables floating around at namespace scope.
break CommandHelpers::isGenericArgument into
command_generic_argument library so it doesn't have to be inline.
Some callers depend on it but would have a circularity if they
actually added db/commands to their LIBDEPS.
Diffstat (limited to 'src/mongo/db/commands.cpp')
-rw-r--r-- | src/mongo/db/commands.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 6ebd7f38a34..103bd17dbeb 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -44,6 +44,7 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/auth/privilege.h" #include "mongo/db/client.h" +#include "mongo/db/command_generic_argument.h" #include "mongo/db/curop.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" @@ -285,18 +286,11 @@ void CommandHelpers::filterCommandRequestForPassthrough(BSONObjIterator* cmdIter const auto name = elem.fieldNameStringData(); if (name == "$readPreference") { BSONObjBuilder(requestBuilder->subobjStart("$queryOptions")).append(elem); - } else if (!isGenericArgument(name) || // - name == "$queryOptions" || // - name == "maxTimeMS" || // - name == "readConcern" || // - name == "writeConcern" || // - name == "lsid" || // - name == "txnNumber" || // - name == "stmtId") { - // This is the whitelist of generic arguments that commands can be trusted to blindly - // forward to the shards. - requestBuilder->append(elem); + continue; } + if (isRequestStripArgument(name)) + continue; + requestBuilder->append(elem); } } @@ -304,15 +298,8 @@ void CommandHelpers::filterCommandReplyForPassthrough(const BSONObj& cmdObj, BSONObjBuilder* output) { for (auto elem : cmdObj) { const auto name = elem.fieldNameStringData(); - if (name == "$configServerState" || // - name == "$gleStats" || // - name == "$clusterTime" || // - name == "$oplogQueryData" || // - name == "$replData" || // - name == "operationTime" || - name == "lastCommittedOpTime") { + if (isReplyStripArgument(name)) continue; - } output->append(elem); } } |