diff options
Diffstat (limited to 'src/mongo/s/commands')
20 files changed, 98 insertions, 69 deletions
diff --git a/src/mongo/s/commands/cluster_count_cmd.cpp b/src/mongo/s/commands/cluster_count_cmd.cpp index aafa05cd583..32306c3c7e2 100644 --- a/src/mongo/s/commands/cluster_count_cmd.cpp +++ b/src/mongo/s/commands/cluster_count_cmd.cpp @@ -31,8 +31,8 @@ #include <vector> #include "mongo/db/commands.h" -#include "mongo/s/commands/cluster_explain.h" #include "mongo/s/commands/cluster_commands_common.h" +#include "mongo/s/commands/cluster_explain.h" #include "mongo/s/commands/strategy.h" #include "mongo/util/timer.h" diff --git a/src/mongo/s/commands/cluster_current_op.cpp b/src/mongo/s/commands/cluster_current_op.cpp index 7cc9ce7e97a..68ab29cf1ad 100644 --- a/src/mongo/s/commands/cluster_current_op.cpp +++ b/src/mongo/s/commands/cluster_current_op.cpp @@ -30,8 +30,8 @@ #include "mongo/platform/basic.h" -#include <vector> #include <tuple> +#include <vector> #include "mongo/client/connpool.h" #include "mongo/db/auth/action_type.h" @@ -128,8 +128,10 @@ public: if (fieldName == kOpIdFieldName) { uassert(28630, str::stream() << "expected numeric opid from currentOp response" - << " from shard " << shardName - << ", got: " << shardOpElement, + << " from shard " + << shardName + << ", got: " + << shardOpElement, shardOpElement.isNumber()); modifiedShardOpBob.append(kOpIdFieldName, diff --git a/src/mongo/s/commands/cluster_explain.cpp b/src/mongo/s/commands/cluster_explain.cpp index acd915981ef..36fb17a0e61 100644 --- a/src/mongo/s/commands/cluster_explain.cpp +++ b/src/mongo/s/commands/cluster_explain.cpp @@ -150,14 +150,16 @@ Status ClusterExplain::validateShardResults(const vector<Strategy::CommandResult return Status(error, str::stream() << "Explain command on shard " << shardResults[i].target.toString() - << " failed, caused by: " << shardResults[i].result); + << " failed, caused by: " + << shardResults[i].result); } if (Object != shardResults[i].result["queryPlanner"].type()) { return Status(ErrorCodes::OperationFailed, str::stream() << "Explain command on shard " << shardResults[i].target.toString() - << " failed, caused by: " << shardResults[i].result); + << " failed, caused by: " + << shardResults[i].result); } if (shardResults[i].result.hasField("executionStats")) { diff --git a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp index c4c185e116e..196b0f5f722 100644 --- a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp @@ -36,18 +36,18 @@ #include "mongo/db/commands.h" #include "mongo/db/commands/find_and_modify.h" #include "mongo/s/balancer/balancer_configuration.h" +#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" -#include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/commands/cluster_explain.h" #include "mongo/s/commands/sharded_command_processing.h" +#include "mongo/s/commands/strategy.h" #include "mongo/s/config.h" -#include "mongo/s/chunk_manager.h" -#include "mongo/s/commands/cluster_explain.h" #include "mongo/s/grid.h" #include "mongo/s/mongos_options.h" #include "mongo/s/sharding_raii.h" #include "mongo/s/stale_exception.h" -#include "mongo/s/commands/strategy.h" #include "mongo/util/timer.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp index cc7323e28a7..2ff26bb1707 100644 --- a/src/mongo/s/commands/cluster_find_cmd.cpp +++ b/src/mongo/s/commands/cluster_find_cmd.cpp @@ -36,8 +36,8 @@ #include "mongo/db/matcher/extensions_callback_noop.h" #include "mongo/db/query/cursor_response.h" #include "mongo/db/stats/counters.h" -#include "mongo/s/query/cluster_find.h" #include "mongo/s/commands/strategy.h" +#include "mongo/s/query/cluster_find.h" namespace mongo { namespace { diff --git a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp index 49c4599f121..78d7e892391 100644 --- a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp @@ -30,11 +30,11 @@ #include <vector> +#include "mongo/client/remote_command_targeter.h" #include "mongo/db/client.h" #include "mongo/db/commands.h" #include "mongo/db/lasterror.h" #include "mongo/s/client/dbclient_multi_command.h" -#include "mongo/client/remote_command_targeter.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/cluster_last_error_info.h" #include "mongo/s/grid.h" diff --git a/src/mongo/s/commands/cluster_getmore_cmd.cpp b/src/mongo/s/commands/cluster_getmore_cmd.cpp index 3af7d0bbd84..270100a2b47 100644 --- a/src/mongo/s/commands/cluster_getmore_cmd.cpp +++ b/src/mongo/s/commands/cluster_getmore_cmd.cpp @@ -87,8 +87,8 @@ public: } const GetMoreRequest& request = parseStatus.getValue(); - return AuthorizationSession::get(client) - ->checkAuthForGetMore(request.nss, request.cursorid, request.term.is_initialized()); + return AuthorizationSession::get(client)->checkAuthForGetMore( + request.nss, request.cursorid, request.term.is_initialized()); } bool run(OperationContext* txn, diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp index 31590d3c5a9..1e626883ff9 100644 --- a/src/mongo/s/commands/cluster_kill_op.cpp +++ b/src/mongo/s/commands/cluster_kill_op.cpp @@ -91,7 +91,9 @@ public: uassert(28625, str::stream() << "The op argument to killOp must be of the format shardid:opid" - << " but found \"" << opToKill << '"', + << " but found \"" + << opToKill + << '"', (opToKill.size() >= 3) && // must have at least N:N (opSepPos != std::string::npos) && // must have ':' as separator (opSepPos != 0) && // can't be :NN diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp index 5cc29ea502f..352d5969927 100644 --- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp +++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp @@ -42,15 +42,15 @@ #include "mongo/s/balancer/balancer_configuration.h" #include "mongo/s/catalog/catalog_cache.h" #include "mongo/s/catalog/catalog_manager.h" -#include "mongo/s/client/shard_connection.h" +#include "mongo/s/catalog/dist_lock_manager.h" #include "mongo/s/chunk_manager.h" +#include "mongo/s/client/shard_connection.h" +#include "mongo/s/client/shard_registry.h" #include "mongo/s/commands/cluster_commands_common.h" #include "mongo/s/commands/sharded_command_processing.h" +#include "mongo/s/commands/strategy.h" #include "mongo/s/config.h" -#include "mongo/s/catalog/dist_lock_manager.h" -#include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" -#include "mongo/s/commands/strategy.h" #include "mongo/s/sharding_raii.h" #include "mongo/stdx/chrono.h" #include "mongo/util/log.h" @@ -319,7 +319,9 @@ public: Strategy::commandOp(txn, dbname, shardedCommand, 0, nss.ns(), q, &mrCommandResults); } catch (DBException& e) { e.addContext(str::stream() << "could not run map command on all shards for ns " - << nss.ns() << " and query " << q); + << nss.ns() + << " and query " + << q); throw; } @@ -341,8 +343,8 @@ public: if (!ok) { // At this point we will return - errmsg = str::stream() - << "MR parallel processing failed: " << singleResult.toString(); + errmsg = str::stream() << "MR parallel processing failed: " + << singleResult.toString(); continue; } @@ -503,7 +505,9 @@ public: ok = true; } catch (DBException& e) { e.addContext(str::stream() << "could not run final reduce on all shards for " - << nss.ns() << ", output " << outputCollNss.ns()); + << nss.ns() + << ", output " + << outputCollNss.ns()); throw; } diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp index ca08547f300..5afec743ab3 100644 --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp @@ -141,7 +141,8 @@ public: const auto to = grid.shardRegistry()->getShard(txn, toString); if (!to) { string msg(str::stream() << "Could not move chunk in '" << nss.ns() << "' to shard '" - << toString << "' because that shard does not exist"); + << toString + << "' because that shard does not exist"); log() << msg; return appendCommandStatus(result, Status(ErrorCodes::ShardNotFound, msg)); } diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp index 5be8441a951..f5ba8b9fb93 100644 --- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp @@ -133,7 +133,8 @@ public: shared_ptr<Shard> toShard = grid.shardRegistry()->getShard(txn, to); if (!toShard) { string msg(str::stream() << "Could not move database '" << dbname << "' to shard '" - << to << "' because the shard does not exist"); + << to + << "' because the shard does not exist"); log() << msg; return appendCommandStatus(result, Status(ErrorCodes::ShardNotFound, msg)); } @@ -192,8 +193,11 @@ public: bool worked = toconn->runCommand( dbname.c_str(), BSON("clone" << fromShard->getConnString().toString() << "collsToIgnore" << barr.arr() - << bypassDocumentValidationCommandOption() << true - << "_checkForCatalogChange" << true << "writeConcern" + << bypassDocumentValidationCommandOption() + << true + << "_checkForCatalogChange" + << true + << "writeConcern" << txn->getWriteConcern().toBSON()), cloneRes); toconn.done(); @@ -233,7 +237,8 @@ public: } } catch (DBException& e) { e.addContext(str::stream() << "movePrimary could not drop the database " << dbname - << " on " << oldPrimary); + << " on " + << oldPrimary); throw; } @@ -268,7 +273,9 @@ public: } catch (DBException& e) { e.addContext(str::stream() << "movePrimary could not drop the cloned collection " - << el.String() << " on " << oldPrimary); + << el.String() + << " on " + << oldPrimary); throw; } } diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp index dc332571d23..e4e3dde7fbf 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -303,7 +303,8 @@ std::vector<DocumentSourceMergeCursors::CursorDescriptor> PipelineCommand::parse invariant(errCode == result["code"].numberInt() || errCode == 17022); uasserted(errCode, str::stream() << "sharded pipeline failed on shard " - << shardResults[i].shardTargetId << ": " + << shardResults[i].shardTargetId + << ": " << result.toString()); } @@ -321,7 +322,8 @@ std::vector<DocumentSourceMergeCursors::CursorDescriptor> PipelineCommand::parse massert(17025, str::stream() << "shard " << shardResults[i].shardTargetId - << " returned invalid ns: " << cursor["ns"], + << " returned invalid ns: " + << cursor["ns"], NamespaceString(cursor["ns"].String()).isValid()); cursors.emplace_back( @@ -340,8 +342,8 @@ void PipelineCommand::uassertAllShardsSupportExplain( const vector<Strategy::CommandResult>& shardResults) { for (size_t i = 0; i < shardResults.size(); i++) { uassert(17403, - str::stream() << "Shard " << shardResults[i].target.toString() - << " failed: " << shardResults[i].result, + str::stream() << "Shard " << shardResults[i].target.toString() << " failed: " + << shardResults[i].result, shardResults[i].result["ok"].trueValue()); uassert(17404, @@ -400,10 +402,10 @@ BSONObj PipelineCommand::aggRunCommand(DBClientBase* conn, 0, // nToSkip NULL, // fieldsToReturn queryOptions); - massert( - 17014, - str::stream() << "aggregate command didn't return results on host: " << conn->toString(), - cursor && cursor->more()); + massert(17014, + str::stream() << "aggregate command didn't return results on host: " + << conn->toString(), + cursor && cursor->more()); BSONObj result = cursor->nextSafe().getOwned(); diff --git a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp index 2ae15e1610f..32d87ac39bf 100644 --- a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp +++ b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp @@ -26,15 +26,15 @@ * it in the license file. */ -#include "mongo/base/init.h" #include "mongo/base/error_codes.h" +#include "mongo/base/init.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/client_basic.h" #include "mongo/db/commands.h" +#include "mongo/s/commands/strategy.h" #include "mongo/s/config.h" #include "mongo/s/grid.h" #include "mongo/s/stale_exception.h" -#include "mongo/s/commands/strategy.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp index c2aef2fd0e6..4443ad6f2e5 100644 --- a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp +++ b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp @@ -38,9 +38,9 @@ #include "mongo/db/operation_context.h" #include "mongo/s/catalog/catalog_manager.h" #include "mongo/s/catalog/type_chunk.h" +#include "mongo/s/client/shard.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" -#include "mongo/s/client/shard.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp index 11df2bbe8ab..49e33189ba2 100644 --- a/src/mongo/s/commands/cluster_split_cmd.cpp +++ b/src/mongo/s/commands/cluster_split_cmd.cpp @@ -41,8 +41,8 @@ #include "mongo/db/commands.h" #include "mongo/db/field_parser.h" #include "mongo/s/catalog/catalog_cache.h" -#include "mongo/s/client/shard_connection.h" #include "mongo/s/chunk_manager.h" +#include "mongo/s/client/shard_connection.h" #include "mongo/s/config.h" #include "mongo/s/grid.h" #include "mongo/s/shard_util.h" diff --git a/src/mongo/s/commands/cluster_user_management_commands.cpp b/src/mongo/s/commands/cluster_user_management_commands.cpp index 02a87dfc9d2..a282cd57d1d 100644 --- a/src/mongo/s/commands/cluster_user_management_commands.cpp +++ b/src/mongo/s/commands/cluster_user_management_commands.cpp @@ -34,11 +34,11 @@ #include "mongo/base/status.h" #include "mongo/bson/mutable/document.h" +#include "mongo/client/dbclientinterface.h" +#include "mongo/config.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager_global.h" #include "mongo/db/auth/user_management_commands_parser.h" -#include "mongo/client/dbclientinterface.h" -#include "mongo/config.h" #include "mongo/db/commands.h" #include "mongo/db/jsobj.h" #include "mongo/rpc/write_concern_error_detail.h" @@ -85,8 +85,8 @@ public: int options, string& errmsg, BSONObjBuilder& result) { - return grid.catalogManager(txn) - ->runUserManagementWriteCommand(txn, getName(), dbname, cmdObj, &result); + return grid.catalogManager(txn)->runUserManagementWriteCommand( + txn, getName(), dbname, cmdObj, &result); } virtual void redactForLogging(mutablebson::Document* cmdObj) { @@ -395,8 +395,8 @@ public: int options, string& errmsg, BSONObjBuilder& result) { - return grid.catalogManager(txn) - ->runUserManagementWriteCommand(txn, getName(), dbname, cmdObj, &result); + return grid.catalogManager(txn)->runUserManagementWriteCommand( + txn, getName(), dbname, cmdObj, &result); } } cmdCreateRole; @@ -817,8 +817,8 @@ public: int options, string& errmsg, BSONObjBuilder& result) { - return grid.catalogManager(txn) - ->runUserManagementWriteCommand(txn, getName(), dbname, cmdObj, &result); + return grid.catalogManager(txn)->runUserManagementWriteCommand( + txn, getName(), dbname, cmdObj, &result); } } cmdMergeAuthzCollections; @@ -916,8 +916,8 @@ public: string& errmsg, BSONObjBuilder& result) { // Run the authSchemaUpgrade command on the config servers - if (!grid.catalogManager(txn) - ->runUserManagementWriteCommand(txn, getName(), dbname, cmdObj, &result)) { + if (!grid.catalogManager(txn)->runUserManagementWriteCommand( + txn, getName(), dbname, cmdObj, &result)) { return false; } diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 8c7918cc49f..a2215e527a4 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -995,7 +995,9 @@ public: if (!status.isOK()) { return Status(status.getStatus().code(), str::stream() << "Passthrough command failed: " << command.toString() - << " on ns " << nss.ns() << ". Caused by " + << " on ns " + << nss.ns() + << ". Caused by " << causedBy(status.getStatus())); } @@ -1003,7 +1005,8 @@ public: if (conf->isSharded(nss.ns())) { return Status(ErrorCodes::IllegalOperation, str::stream() << "Passthrough command failed: " << command.toString() - << " on ns " << nss.ns() + << " on ns " + << nss.ns() << ". Cannot run on sharded namespace."); } @@ -1018,8 +1021,10 @@ public: conn.done(); return Status(ErrorCodes::OperationFailed, str::stream() << "Passthrough command failed: " << command - << " on ns " << nss.ns() - << "; result: " << shardResult); + << " on ns " + << nss.ns() + << "; result: " + << shardResult); } conn.done(); } catch (const DBException& ex) { @@ -1175,8 +1180,10 @@ public: } else if (queryElt.type() != BSONType::jstNULL) { return Status(ErrorCodes::TypeMismatch, str::stream() << "\"query\" had the wrong type. Expected " - << typeName(BSONType::Object) << " or " - << typeName(BSONType::jstNULL) << ", found " + << typeName(BSONType::Object) + << " or " + << typeName(BSONType::jstNULL) + << ", found " << typeName(queryElt.type())); } } @@ -1612,8 +1619,8 @@ public: } return Status(ErrorCodes::Unauthorized, - str::stream() - << "Not authorized to list indexes on collection: " << ns.coll()); + str::stream() << "Not authorized to list indexes on collection: " + << ns.coll()); } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { diff --git a/src/mongo/s/commands/request.cpp b/src/mongo/s/commands/request.cpp index dff8a8472b6..050483d2969 100644 --- a/src/mongo/s/commands/request.cpp +++ b/src/mongo/s/commands/request.cpp @@ -40,8 +40,8 @@ #include "mongo/db/lasterror.h" #include "mongo/db/stats/counters.h" #include "mongo/s/cluster_last_error_info.h" -#include "mongo/s/grid.h" #include "mongo/s/commands/strategy.h" +#include "mongo/s/grid.h" #include "mongo/util/log.h" #include "mongo/util/timer.h" diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp index f2a670ab4ce..214b0568849 100644 --- a/src/mongo/s/commands/strategy.cpp +++ b/src/mongo/s/commands/strategy.cpp @@ -35,8 +35,8 @@ #include "mongo/base/data_cursor.h" #include "mongo/base/owned_pointer_vector.h" #include "mongo/base/status.h" -#include "mongo/bson/util/builder.h" #include "mongo/bson/util/bson_extract.h" +#include "mongo/bson/util/builder.h" #include "mongo/client/connpool.h" #include "mongo/client/dbclientcursor.h" #include "mongo/client/parallel.h" @@ -44,22 +44,22 @@ #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" -#include "mongo/db/max_time.h" -#include "mongo/db/server_parameters.h" #include "mongo/db/matcher/extensions_callback_noop.h" +#include "mongo/db/max_time.h" #include "mongo/db/namespace_string.h" #include "mongo/db/query/find_common.h" -#include "mongo/db/query/lite_parsed_query.h" #include "mongo/db/query/getmore_request.h" +#include "mongo/db/query/lite_parsed_query.h" +#include "mongo/db/server_parameters.h" #include "mongo/db/stats/counters.h" #include "mongo/rpc/metadata/server_selection_metadata.h" #include "mongo/s/bson_serializable.h" #include "mongo/s/catalog/catalog_cache.h" +#include "mongo/s/chunk_manager.h" +#include "mongo/s/chunk_version.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/version_manager.h" -#include "mongo/s/chunk_manager.h" -#include "mongo/s/chunk_version.h" #include "mongo/s/commands/cluster_explain.h" #include "mongo/s/commands/request.h" #include "mongo/s/config.h" @@ -67,8 +67,8 @@ #include "mongo/s/query/cluster_cursor_manager.h" #include "mongo/s/query/cluster_find.h" #include "mongo/s/stale_exception.h" -#include "mongo/s/write_ops/batched_command_request.h" #include "mongo/s/write_ops/batch_upconvert.h" +#include "mongo/s/write_ops/batched_command_request.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" #include "mongo/util/timer.h" @@ -413,7 +413,9 @@ void Strategy::killCursors(OperationContext* txn, Request& request) { const int numCursors = dbMessage.pullInt(); massert(34425, str::stream() << "Invalid killCursors message. numCursors: " << numCursors - << ", message size: " << dbMessage.msg().dataSize() << ".", + << ", message size: " + << dbMessage.msg().dataSize() + << ".", dbMessage.msg().dataSize() == 8 + (8 * numCursors)); uassert(28794, str::stream() << "numCursors must be between 1 and 29999. numCursors: " << numCursors diff --git a/src/mongo/s/commands/strategy.h b/src/mongo/s/commands/strategy.h index 630373b71a1..ebd9e36c520 100644 --- a/src/mongo/s/commands/strategy.h +++ b/src/mongo/s/commands/strategy.h @@ -30,8 +30,8 @@ #include <atomic> -#include "mongo/db/query/explain_common.h" #include "mongo/client/connection_string.h" +#include "mongo/db/query/explain_common.h" #include "mongo/s/client/shard.h" namespace mongo { |