summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
commit6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch)
treec8cfb5acb62c80f375bc37e7d4350382deea6a37 /src/mongo/s
parentd4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff)
downloadmongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz
SERVER-23971 Clang-Format code
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/balancer/balancer.cpp21
-rw-r--r--src/mongo/s/balancer/balancer_chunk_selection_policy_impl.cpp3
-rw-r--r--src/mongo/s/balancer/balancer_configuration.h2
-rw-r--r--src/mongo/s/balancer/balancer_configuration_test.cpp52
-rw-r--r--src/mongo/s/catalog/dist_lock_catalog_mock.cpp37
-rw-r--r--src/mongo/s/catalog/dist_lock_manager_mock.cpp24
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp82
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set_add_shard_test.cpp42
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp20
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp116
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set_upgrade_test.cpp7
-rw-r--r--src/mongo/s/catalog/replset/dist_lock_catalog_impl.cpp30
-rw-r--r--src/mongo/s/catalog/replset/dist_lock_catalog_impl_test.cpp79
-rw-r--r--src/mongo/s/catalog/replset/replset_dist_lock_manager.cpp4
-rw-r--r--src/mongo/s/catalog/replset/replset_dist_lock_manager_test.cpp115
-rw-r--r--src/mongo/s/catalog/type_changelog_test.cpp82
-rw-r--r--src/mongo/s/catalog/type_chunk_test.cpp100
-rw-r--r--src/mongo/s/catalog/type_collection_test.cpp37
-rw-r--r--src/mongo/s/catalog/type_config_version_test.cpp8
-rw-r--r--src/mongo/s/catalog/type_locks_test.cpp94
-rw-r--r--src/mongo/s/catalog/type_mongos_test.cpp57
-rw-r--r--src/mongo/s/catalog/type_shard_test.cpp3
-rw-r--r--src/mongo/s/chunk.cpp9
-rw-r--r--src/mongo/s/chunk_diff.h4
-rw-r--r--src/mongo/s/chunk_diff_test.cpp2
-rw-r--r--src/mongo/s/chunk_manager.cpp27
-rw-r--r--src/mongo/s/chunk_manager_targeter.cpp5
-rw-r--r--src/mongo/s/chunk_manager_targeter_test.cpp3
-rw-r--r--src/mongo/s/chunk_version.cpp2
-rw-r--r--src/mongo/s/client/shard_factory.cpp2
-rw-r--r--src/mongo/s/client/shard_factory.h4
-rw-r--r--src/mongo/s/client/shard_local_test.cpp2
-rw-r--r--src/mongo/s/client/shard_registry.cpp2
-rw-r--r--src/mongo/s/client/shard_registry.h2
-rw-r--r--src/mongo/s/client/shard_remote.cpp2
-rw-r--r--src/mongo/s/client/sharding_network_connection_hook.cpp2
-rw-r--r--src/mongo/s/client/version_manager.cpp30
-rw-r--r--src/mongo/s/cluster_write.cpp3
-rw-r--r--src/mongo/s/commands/cluster_count_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_current_op.cpp8
-rw-r--r--src/mongo/s/commands/cluster_explain.cpp6
-rw-r--r--src/mongo/s/commands/cluster_find_and_modify_cmd.cpp8
-rw-r--r--src/mongo/s/commands/cluster_find_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_last_error_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_getmore_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_kill_op.cpp4
-rw-r--r--src/mongo/s/commands/cluster_map_reduce_cmd.cpp20
-rw-r--r--src/mongo/s/commands/cluster_move_chunk_cmd.cpp3
-rw-r--r--src/mongo/s/commands/cluster_move_primary_cmd.cpp17
-rw-r--r--src/mongo/s/commands/cluster_pipeline_cmd.cpp18
-rw-r--r--src/mongo/s/commands/cluster_plan_cache_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_remove_shard_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_split_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_user_management_commands.cpp20
-rw-r--r--src/mongo/s/commands/commands_public.cpp23
-rw-r--r--src/mongo/s/commands/request.cpp2
-rw-r--r--src/mongo/s/commands/strategy.cpp18
-rw-r--r--src/mongo/s/commands/strategy.h2
-rw-r--r--src/mongo/s/config.cpp6
-rw-r--r--src/mongo/s/grid.cpp2
-rw-r--r--src/mongo/s/mongos_options.cpp24
-rw-r--r--src/mongo/s/mongos_options_init.cpp2
-rw-r--r--src/mongo/s/ns_targeter.h4
-rw-r--r--src/mongo/s/query/async_results_merger.cpp17
-rw-r--r--src/mongo/s/query/async_results_merger_test.cpp9
-rw-r--r--src/mongo/s/query/cluster_cursor_manager.cpp5
-rw-r--r--src/mongo/s/query/cluster_cursor_manager_test.cpp2
-rw-r--r--src/mongo/s/query/cluster_find.cpp19
-rw-r--r--src/mongo/s/query/router_stage_merge.h4
-rw-r--r--src/mongo/s/request_types/add_shard_request_test.cpp51
-rw-r--r--src/mongo/s/server.cpp18
-rw-r--r--src/mongo/s/set_shard_version_request_test.cpp255
-rw-r--r--src/mongo/s/shard_key_pattern.cpp5
-rw-r--r--src/mongo/s/shard_key_pattern_test.cpp24
-rw-r--r--src/mongo/s/shard_util.cpp2
-rw-r--r--src/mongo/s/sharding_initialization.cpp8
-rw-r--r--src/mongo/s/sharding_test_fixture.cpp5
-rw-r--r--src/mongo/s/sharding_test_fixture.h2
-rw-r--r--src/mongo/s/stale_exception.h29
-rw-r--r--src/mongo/s/write_ops/batch_downconvert_test.cpp9
-rw-r--r--src/mongo/s/write_ops/batch_write_exec_test.cpp2
-rw-r--r--src/mongo/s/write_ops/batch_write_op.cpp2
-rw-r--r--src/mongo/s/write_ops/batch_write_op_test.cpp5
-rw-r--r--src/mongo/s/write_ops/batched_command_request.h2
-rw-r--r--src/mongo/s/write_ops/batched_command_request_test.cpp21
-rw-r--r--src/mongo/s/write_ops/batched_command_response.h2
-rw-r--r--src/mongo/s/write_ops/batched_command_response_test.cpp17
-rw-r--r--src/mongo/s/write_ops/batched_delete_request_test.cpp8
-rw-r--r--src/mongo/s/write_ops/batched_insert_request.cpp4
-rw-r--r--src/mongo/s/write_ops/batched_insert_request_test.cpp8
-rw-r--r--src/mongo/s/write_ops/batched_update_request_test.cpp24
-rw-r--r--src/mongo/s/write_ops/write_op.h2
92 files changed, 1129 insertions, 753 deletions
diff --git a/src/mongo/s/balancer/balancer.cpp b/src/mongo/s/balancer/balancer.cpp
index c08ab24b900..0b8a93f8fe9 100644
--- a/src/mongo/s/balancer/balancer.cpp
+++ b/src/mongo/s/balancer/balancer.cpp
@@ -366,11 +366,11 @@ void Balancer::_mainThread() {
uassert(13258, "oids broken after resetting!", _checkOIDs(txn.get()));
{
- auto scopedDistLock = shardingContext->catalogManager(txn.get())
- ->distLock(txn.get(),
- "balancer",
- "doing balance round",
- DistLockManager::kSingleLockAttemptTimeout);
+ auto scopedDistLock = shardingContext->catalogManager(txn.get())->distLock(
+ txn.get(),
+ "balancer",
+ "doing balance round",
+ DistLockManager::kSingleLockAttemptTimeout);
if (!scopedDistLock.isOK()) {
LOG(1) << "skipping balancing round" << causedBy(scopedDistLock.getStatus());
@@ -412,8 +412,8 @@ void Balancer::_mainThread() {
roundDetails.setSucceeded(static_cast<int>(candidateChunks.size()),
_balancedLastTime);
- shardingContext->catalogManager(txn.get())
- ->logAction(txn.get(), "balancer.round", "", roundDetails.toBSON());
+ shardingContext->catalogManager(txn.get())->logAction(
+ txn.get(), "balancer.round", "", roundDetails.toBSON());
}
LOG(1) << "*** End of balancing round";
@@ -432,8 +432,8 @@ void Balancer::_mainThread() {
// This round failed, tell the world!
roundDetails.setFailed(e.what());
- shardingContext->catalogManager(txn.get())
- ->logAction(txn.get(), "balancer.round", "", roundDetails.toBSON());
+ shardingContext->catalogManager(txn.get())->logAction(
+ txn.get(), "balancer.round", "", roundDetails.toBSON());
// Sleep a fair amount before retrying because of the error
sleepFor(balanceRoundInterval);
@@ -464,7 +464,8 @@ bool Balancer::_init(OperationContext* txn) {
return true;
} catch (const std::exception& e) {
warning() << "could not initialize balancer, please check that all shards and config "
- "servers are up: " << e.what();
+ "servers are up: "
+ << e.what();
return false;
}
}
diff --git a/src/mongo/s/balancer/balancer_chunk_selection_policy_impl.cpp b/src/mongo/s/balancer/balancer_chunk_selection_policy_impl.cpp
index a685dee7317..48e596a871d 100644
--- a/src/mongo/s/balancer/balancer_chunk_selection_policy_impl.cpp
+++ b/src/mongo/s/balancer/balancer_chunk_selection_policy_impl.cpp
@@ -329,7 +329,8 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::_getMigrateCandi
// some progress balancing.
return {ErrorCodes::IllegalOperation,
str::stream()
- << "Tag boundaries " << tagInfo.toString()
+ << "Tag boundaries "
+ << tagInfo.toString()
<< " fall in the middle of an existing chunk. Balancing for collection "
<< nss.ns()
<< " will be postponed until the chunk is split appropriately."};
diff --git a/src/mongo/s/balancer/balancer_configuration.h b/src/mongo/s/balancer/balancer_configuration.h
index 0cc2cb48cd4..62ac468fbdd 100644
--- a/src/mongo/s/balancer/balancer_configuration.h
+++ b/src/mongo/s/balancer/balancer_configuration.h
@@ -33,9 +33,9 @@
#include <cstdint>
#include "mongo/base/disallow_copying.h"
+#include "mongo/platform/atomic_word.h"
#include "mongo/s/migration_secondary_throttle_options.h"
#include "mongo/stdx/mutex.h"
-#include "mongo/platform/atomic_word.h"
namespace mongo {
diff --git a/src/mongo/s/balancer/balancer_configuration_test.cpp b/src/mongo/s/balancer/balancer_configuration_test.cpp
index ffe95dde645..e31e76499c8 100644
--- a/src/mongo/s/balancer/balancer_configuration_test.cpp
+++ b/src/mongo/s/balancer/balancer_configuration_test.cpp
@@ -194,41 +194,44 @@ TEST(BalancerSettingsType, BalancingWindowStopLessThanStart) {
}
TEST(BalancerSettingsType, InvalidBalancingWindowStartEqualsStop) {
- ASSERT_NOT_OK(
- BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
- << "00:00"
- << "stop"
- << "00:00"))).getStatus());
+ ASSERT_NOT_OK(BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
+ << "00:00"
+ << "stop"
+ << "00:00")))
+ .getStatus());
}
TEST(BalancerSettingsType, InvalidBalancingWindowTimeFormat) {
ASSERT_NOT_OK(BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
<< "23"
<< "stop"
- << "6"))).getStatus());
-
- ASSERT_NOT_OK(BalancerSettingsType::fromBSON(
- BSON("activeWindow" << BSON("start" << 23LL << "stop"
- << "6:00"))).getStatus());
+ << "6")))
+ .getStatus());
ASSERT_NOT_OK(
- BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
- << "23:00"
- << "stop" << 6LL))).getStatus());
+ BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start" << 23LL << "stop"
+ << "6:00")))
+ .getStatus());
+
+ ASSERT_NOT_OK(BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
+ << "23:00"
+ << "stop"
+ << 6LL)))
+ .getStatus());
}
TEST(BalancerSettingsType, InvalidBalancingWindowFormat) {
- ASSERT_NOT_OK(
- BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("begin"
- << "23:00"
- << "stop"
- << "6:00"))).getStatus());
+ ASSERT_NOT_OK(BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("begin"
+ << "23:00"
+ << "stop"
+ << "6:00")))
+ .getStatus());
- ASSERT_NOT_OK(
- BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
- << "23:00"
- << "end"
- << "6:00"))).getStatus());
+ ASSERT_NOT_OK(BalancerSettingsType::fromBSON(BSON("activeWindow" << BSON("start"
+ << "23:00"
+ << "end"
+ << "6:00")))
+ .getStatus());
}
TEST(ChunkSizeSettingsType, NormalValues) {
@@ -255,7 +258,8 @@ TEST(ChunkSizeSettingsType, IllegalValues) {
ASSERT_NOT_OK(ChunkSizeSettingsType::fromBSON(BSON("value" << -1)).getStatus());
ASSERT_NOT_OK(ChunkSizeSettingsType::fromBSON(BSON("value" << 1025)).getStatus());
ASSERT_NOT_OK(ChunkSizeSettingsType::fromBSON(BSON("value"
- << "WrongType")).getStatus());
+ << "WrongType"))
+ .getStatus());
ASSERT_NOT_OK(ChunkSizeSettingsType::fromBSON(BSON("IllegalKey" << 1)).getStatus());
}
diff --git a/src/mongo/s/catalog/dist_lock_catalog_mock.cpp b/src/mongo/s/catalog/dist_lock_catalog_mock.cpp
index 4f19df96a47..db7d3151d6e 100644
--- a/src/mongo/s/catalog/dist_lock_catalog_mock.cpp
+++ b/src/mongo/s/catalog/dist_lock_catalog_mock.cpp
@@ -52,8 +52,14 @@ void noGrabLockFuncSet(StringData lockID,
Date_t time,
StringData why) {
FAIL(str::stream() << "grabLock not expected to be called. "
- << "lockID: " << lockID << ", who: " << who << ", processId: " << processId
- << ", why: " << why);
+ << "lockID: "
+ << lockID
+ << ", who: "
+ << who
+ << ", processId: "
+ << processId
+ << ", why: "
+ << why);
}
void noOvertakeLockFuncSet(StringData lockID,
@@ -64,13 +70,22 @@ void noOvertakeLockFuncSet(StringData lockID,
Date_t time,
StringData why) {
FAIL(str::stream() << "overtakeLock not expected to be called. "
- << "lockID: " << lockID << ", currentHolderTS: " << currentHolderTS
- << ", who: " << who << ", processId: " << processId << ", why: " << why);
+ << "lockID: "
+ << lockID
+ << ", currentHolderTS: "
+ << currentHolderTS
+ << ", who: "
+ << who
+ << ", processId: "
+ << processId
+ << ", why: "
+ << why);
}
void noUnLockFuncSet(const OID& lockSessionID) {
FAIL(str::stream() << "unlock not expected to be called. "
- << "lockSessionID: " << lockSessionID);
+ << "lockSessionID: "
+ << lockSessionID);
}
void noPingFuncSet(StringData processID, Date_t ping) {
@@ -79,22 +94,26 @@ void noPingFuncSet(StringData processID, Date_t ping) {
void noStopPingFuncSet(StringData processID) {
FAIL(str::stream() << "stopPing not expected to be called. "
- << "processID: " << processID);
+ << "processID: "
+ << processID);
}
void noGetLockByTSSet(const OID& lockSessionID) {
FAIL(str::stream() << "getLockByTS not expected to be called. "
- << "lockSessionID: " << lockSessionID);
+ << "lockSessionID: "
+ << lockSessionID);
}
void noGetLockByNameSet(StringData name) {
FAIL(str::stream() << "getLockByName not expected to be called. "
- << "lockName: " << name);
+ << "lockName: "
+ << name);
}
void noGetPingSet(StringData processId) {
FAIL(str::stream() << "getPing not expected to be called. "
- << "lockName: " << processId);
+ << "lockName: "
+ << processId);
}
void noGetServerInfoSet() {
diff --git a/src/mongo/s/catalog/dist_lock_manager_mock.cpp b/src/mongo/s/catalog/dist_lock_manager_mock.cpp
index 7c2c58e83ed..9325caf29d7 100644
--- a/src/mongo/s/catalog/dist_lock_manager_mock.cpp
+++ b/src/mongo/s/catalog/dist_lock_manager_mock.cpp
@@ -34,9 +34,9 @@
#include <algorithm>
+#include "mongo/unittest/unittest.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/time_support.h"
-#include "mongo/unittest/unittest.h"
namespace mongo {
@@ -47,8 +47,14 @@ void NoLockFuncSet(StringData name,
Milliseconds waitFor,
Milliseconds lockTryInterval) {
FAIL(str::stream() << "Lock not expected to be called. "
- << "Name: " << name << ", whyMessage: " << whyMessage
- << ", waitFor: " << waitFor << ", lockTryInterval: " << lockTryInterval);
+ << "Name: "
+ << name
+ << ", whyMessage: "
+ << whyMessage
+ << ", waitFor: "
+ << waitFor
+ << ", lockTryInterval: "
+ << lockTryInterval);
}
} // namespace
@@ -90,9 +96,9 @@ StatusWith<DistLockManager::ScopedDistLock> DistLockManagerMock::lockWithSession
return _lockReturnStatus;
}
- if (_locks.end() != std::find_if(_locks.begin(),
- _locks.end(),
- [name](LockInfo info) -> bool { return info.name == name; })) {
+ if (_locks.end() != std::find_if(_locks.begin(), _locks.end(), [name](LockInfo info) -> bool {
+ return info.name == name;
+ })) {
return Status(ErrorCodes::LockBusy,
str::stream() << "Lock \"" << name << "\" is already taken");
}
@@ -111,9 +117,9 @@ void DistLockManagerMock::unlockAll(OperationContext* txn, const std::string& pr
void DistLockManagerMock::unlock(OperationContext* txn, const DistLockHandle& lockHandle) {
std::vector<LockInfo>::iterator it =
- std::find_if(_locks.begin(),
- _locks.end(),
- [&lockHandle](LockInfo info) -> bool { return info.lockID == lockHandle; });
+ std::find_if(_locks.begin(), _locks.end(), [&lockHandle](LockInfo info) -> bool {
+ return info.lockID == lockHandle;
+ });
if (it == _locks.end()) {
return;
}
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp
index f5e1522eed6..2db57413984 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp
@@ -56,16 +56,16 @@
#include "mongo/s/catalog/config_server_version.h"
#include "mongo/s/catalog/dist_lock_manager.h"
#include "mongo/s/catalog/type_changelog.h"
+#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/catalog/type_config_version.h"
-#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/catalog/type_tags.h"
+#include "mongo/s/chunk_manager.h"
#include "mongo/s/client/shard.h"
#include "mongo/s/client/shard_connection.h"
#include "mongo/s/client/shard_registry.h"
-#include "mongo/s/chunk_manager.h"
#include "mongo/s/config.h"
#include "mongo/s/grid.h"
#include "mongo/s/set_shard_version_request.h"
@@ -188,7 +188,9 @@ StatusWith<ShardType> CatalogManagerReplicaSet::_validateHostAsShard(
return {ErrorCodes::OperationFailed,
str::stream() << "'" << hostAndPort.toString() << "' "
<< "is already a member of the existing shard '"
- << shard->getConnString().toString() << "' (" << shard->getId()
+ << shard->getConnString().toString()
+ << "' ("
+ << shard->getId()
<< ")."};
}
}
@@ -231,7 +233,8 @@ StatusWith<ShardType> CatalogManagerReplicaSet::_validateHostAsShard(
str::stream() << "isMaster returned invalid 'ismaster' "
<< "field when attempting to add "
<< connectionString.toString()
- << " as a shard: " << status.reason());
+ << " as a shard: "
+ << status.reason());
}
if (!isMaster) {
return {ErrorCodes::NotMaster,
@@ -255,7 +258,8 @@ StatusWith<ShardType> CatalogManagerReplicaSet::_validateHostAsShard(
if (!providedSetName.empty() && foundSetName.empty()) {
return {ErrorCodes::OperationFailed,
str::stream() << "host did not return a set name; "
- << "is the replica set still initializing? " << resIsMaster};
+ << "is the replica set still initializing? "
+ << resIsMaster};
}
// Make sure the set name specified in the connection string matches the one where its hosts
@@ -263,7 +267,8 @@ StatusWith<ShardType> CatalogManagerReplicaSet::_validateHostAsShard(
if (!providedSetName.empty() && (providedSetName != foundSetName)) {
return {ErrorCodes::OperationFailed,
str::stream() << "the provided connection string (" << connectionString.toString()
- << ") does not match the actual set name " << foundSetName};
+ << ") does not match the actual set name "
+ << foundSetName};
}
// Is it a config server?
@@ -304,8 +309,11 @@ StatusWith<ShardType> CatalogManagerReplicaSet::_validateHostAsShard(
if (hostSet.find(host) == hostSet.end()) {
return {ErrorCodes::OperationFailed,
str::stream() << "in seed list " << connectionString.toString() << ", host "
- << host << " does not belong to replica set " << foundSetName
- << "; found " << resIsMaster.toString()};
+ << host
+ << " does not belong to replica set "
+ << foundSetName
+ << "; found "
+ << resIsMaster.toString()};
}
}
}
@@ -417,8 +425,7 @@ StatusWith<BSONObj> CatalogManagerReplicaSet::_runCommandForAddShard(
Status(ErrorCodes::InternalError, "Internal error running command");
auto callStatus = _executorForAddShard->scheduleRemoteCommand(
- request,
- [&responseStatus](const executor::TaskExecutor::RemoteCommandCallbackArgs& args) {
+ request, [&responseStatus](const executor::TaskExecutor::RemoteCommandCallbackArgs& args) {
responseStatus = args.response;
});
if (!callStatus.isOK()) {
@@ -465,9 +472,13 @@ StatusWith<string> CatalogManagerReplicaSet::addShard(OperationContext* txn,
const auto& dbDoc = dbt.getValue().value;
return Status(ErrorCodes::OperationFailed,
str::stream() << "can't add shard "
- << "'" << shardConnectionString.toString() << "'"
- << " because a local database '" << dbName
- << "' exists in another " << dbDoc.getPrimary());
+ << "'"
+ << shardConnectionString.toString()
+ << "'"
+ << " because a local database '"
+ << dbName
+ << "' exists in another "
+ << dbDoc.getPrimary());
} else if (dbt != ErrorCodes::NamespaceNotFound) {
return dbt.getStatus();
}
@@ -807,7 +818,8 @@ Status CatalogManagerReplicaSet::shardCollection(OperationContext* txn,
if (countStatus.getValue() > 0) {
return Status(ErrorCodes::AlreadyInitialized,
str::stream() << "collection " << ns << " already sharded with "
- << countStatus.getValue() << " chunks.");
+ << countStatus.getValue()
+ << " chunks.");
}
}
@@ -1094,7 +1106,9 @@ Status CatalogManagerReplicaSet::getCollections(OperationContext* txn,
collections->clear();
return {ErrorCodes::FailedToParse,
str::stream() << "error while parsing " << CollectionType::ConfigNS
- << " document: " << obj << " : "
+ << " document: "
+ << obj
+ << " : "
<< collectionResult.getStatus().toString()};
}
@@ -1334,7 +1348,8 @@ Status CatalogManagerReplicaSet::getChunks(OperationContext* txn,
return {ErrorCodes::FailedToParse,
stream() << "Failed to parse chunk with id ("
<< obj[ChunkType::name()].toString()
- << "): " << chunkRes.getStatus().toString()};
+ << "): "
+ << chunkRes.getStatus().toString()};
}
chunks->push_back(chunkRes.getValue());
@@ -1366,8 +1381,8 @@ Status CatalogManagerReplicaSet::getTagsForCollection(OperationContext* txn,
if (!tagRes.isOK()) {
tags->clear();
return Status(ErrorCodes::FailedToParse,
- str::stream()
- << "Failed to parse tag: " << tagRes.getStatus().toString());
+ str::stream() << "Failed to parse tag: "
+ << tagRes.getStatus().toString());
}
tags->push_back(tagRes.getValue());
@@ -1381,7 +1396,8 @@ StatusWith<string> CatalogManagerReplicaSet::getTagForChunk(OperationContext* tx
const ChunkType& chunk) {
BSONObj query =
BSON(TagsType::ns(collectionNs) << TagsType::min() << BSON("$lte" << chunk.getMin())
- << TagsType::max() << BSON("$gte" << chunk.getMax()));
+ << TagsType::max()
+ << BSON("$gte" << chunk.getMax()));
auto findStatus = _exhaustiveFindOnConfig(
txn, kConfigReadSelector, NamespaceString(TagsType::ConfigNS), query, BSONObj(), 1);
if (!findStatus.isOK()) {
@@ -1400,7 +1416,8 @@ StatusWith<string> CatalogManagerReplicaSet::getTagForChunk(OperationContext* tx
if (!tagsResult.isOK()) {
return {ErrorCodes::FailedToParse,
stream() << "error while parsing " << TagsType::ConfigNS << " document: " << tagsDoc
- << " : " << tagsResult.getStatus().toString()};
+ << " : "
+ << tagsResult.getStatus().toString()};
}
return tagsResult.getValue().getTag();
}
@@ -1424,7 +1441,8 @@ StatusWith<repl::OpTimeWith<std::vector<ShardType>>> CatalogManagerReplicaSet::g
shards.clear();
return {ErrorCodes::FailedToParse,
stream() << "Failed to parse shard with id ("
- << doc[ShardType::name()].toString() << ")"
+ << doc[ShardType::name()].toString()
+ << ")"
<< causedBy(shardRes.getStatus())};
}
@@ -1432,7 +1450,8 @@ StatusWith<repl::OpTimeWith<std::vector<ShardType>>> CatalogManagerReplicaSet::g
if (!validateStatus.isOK()) {
return {validateStatus.code(),
stream() << "Failed to validate shard with id ("
- << doc[ShardType::name()].toString() << ")"
+ << doc[ShardType::name()].toString()
+ << ")"
<< causedBy(validateStatus)};
}
@@ -1550,8 +1569,9 @@ Status CatalogManagerReplicaSet::applyChunkOpsDeprecated(OperationContext* txn,
const BSONArray& preCondition,
const std::string& nss,
const ChunkVersion& lastChunkVersion) {
- BSONObj cmd = BSON("applyOps" << updateOps << "preCondition" << preCondition
- << kWriteConcernField << kMajorityWriteConcern.toBSON());
+ BSONObj cmd =
+ BSON("applyOps" << updateOps << "preCondition" << preCondition << kWriteConcernField
+ << kMajorityWriteConcern.toBSON());
auto response = Grid::get(txn)->shardRegistry()->getConfigShard()->runCommand(
txn,
@@ -1631,7 +1651,8 @@ void CatalogManagerReplicaSet::writeConfigServerDirect(OperationContext* txn,
if (batchRequest.sizeWriteOps() != 1) {
toBatchError(Status(ErrorCodes::InvalidOptions,
str::stream() << "Writes to config servers must have batch size of 1, "
- << "found " << batchRequest.sizeWriteOps()),
+ << "found "
+ << batchRequest.sizeWriteOps()),
batchResponse);
return;
}
@@ -1846,7 +1867,10 @@ Status CatalogManagerReplicaSet::_checkDbDoesNotExist(OperationContext* txn,
return Status(ErrorCodes::DatabaseDifferCase,
str::stream() << "can't have 2 databases that just differ on case "
- << " have: " << actualDbName << " want to add: " << dbName);
+ << " have: "
+ << actualDbName
+ << " want to add: "
+ << dbName);
}
StatusWith<std::string> CatalogManagerReplicaSet::_generateNewShardName(OperationContext* txn) {
@@ -1997,7 +2021,8 @@ Status CatalogManagerReplicaSet::initConfigVersion(OperationContext* txn) {
if (versionInfo.getCurrentVersion() < CURRENT_CONFIG_VERSION) {
return {ErrorCodes::IncompatibleShardingConfigVersion,
str::stream() << "need to upgrade current cluster version to v"
- << CURRENT_CONFIG_VERSION << "; currently at v"
+ << CURRENT_CONFIG_VERSION
+ << "; currently at v"
<< versionInfo.getCurrentVersion()};
}
@@ -2006,7 +2031,8 @@ Status CatalogManagerReplicaSet::initConfigVersion(OperationContext* txn) {
return {ErrorCodes::IncompatibleShardingConfigVersion,
str::stream() << "unable to create new config version document after "
- << kMaxConfigVersionInitRetry << " retries"};
+ << kMaxConfigVersionInitRetry
+ << " retries"};
}
StatusWith<VersionType> CatalogManagerReplicaSet::_getConfigVersion(OperationContext* txn) {
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_add_shard_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_add_shard_test.cpp
index 5b877f60f74..4bbdb9bcebd 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_add_shard_test.cpp
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_add_shard_test.cpp
@@ -234,13 +234,16 @@ TEST_F(AddShardTest, Standalone) {
expectListDatabases(shardTarget,
std::vector<BSONObj>{BSON("name"
<< "local"
- << "sizeOnDisk" << 1000),
+ << "sizeOnDisk"
+ << 1000),
BSON("name"
<< "TestDB1"
- << "sizeOnDisk" << 2000),
+ << "sizeOnDisk"
+ << 2000),
BSON("name"
<< "TestDB2"
- << "sizeOnDisk" << 5000)});
+ << "sizeOnDisk"
+ << 5000)});
// Make sure the shard add code checks for the presence of each of the two databases we returned
// in the previous call, in the config server metadata
@@ -309,13 +312,16 @@ TEST_F(AddShardTest, StandaloneGenerateName) {
expectListDatabases(shardTarget,
std::vector<BSONObj>{BSON("name"
<< "local"
- << "sizeOnDisk" << 1000),
+ << "sizeOnDisk"
+ << 1000),
BSON("name"
<< "TestDB1"
- << "sizeOnDisk" << 2000),
+ << "sizeOnDisk"
+ << 2000),
BSON("name"
<< "TestDB2"
- << "sizeOnDisk" << 5000)});
+ << "sizeOnDisk"
+ << 5000)});
// Make sure the shard add code checks for the presence of each of the two databases we returned
// in the previous call, in the config server metadata
@@ -629,7 +635,8 @@ TEST_F(AddShardTest, ShardIsCSRSConfigServer) {
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "config"
- << "configsvr" << true);
+ << "configsvr"
+ << true);
expectValidationCheck(shardTarget, commandResponse);
future.timed_get(kFutureTimeout);
@@ -660,7 +667,8 @@ TEST_F(AddShardTest, ReplicaSetMissingHostsProvidedInSeedList) {
hosts.append("host1:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
future.timed_get(kFutureTimeout);
@@ -692,7 +700,8 @@ TEST_F(AddShardTest, ShardNameIsConfig) {
hosts.append("host2:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
future.timed_get(kFutureTimeout);
@@ -724,7 +733,8 @@ TEST_F(AddShardTest, ShardContainsExistingDatabase) {
hosts.append("host2:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
expectListDatabases(shardTarget,
@@ -764,7 +774,8 @@ TEST_F(AddShardTest, ReAddExistingShard) {
hosts.append("host2:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
expectListDatabases(shardTarget,
@@ -828,7 +839,8 @@ TEST_F(AddShardTest, SuccessfullyAddReplicaSet) {
hosts.append("host2:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
expectListDatabases(shardTarget,
@@ -884,7 +896,8 @@ TEST_F(AddShardTest, AddShardSucceedsEvenIfAddingDBsFromNewShardFails) {
hosts.append("host2:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
expectListDatabases(shardTarget,
@@ -964,7 +977,8 @@ TEST_F(AddShardTest, ReplicaSetExtraHostsDiscovered) {
hosts.append("host2:12345");
BSONObj commandResponse = BSON("ok" << 1 << "ismaster" << true << "setName"
<< "mySet"
- << "hosts" << hosts.arr());
+ << "hosts"
+ << hosts.arr());
expectValidationCheck(shardTarget, commandResponse);
expectListDatabases(shardTarget, {});
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp
index 7e4fdb8330c..901f12798ea 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_shard_collection_test.cpp
@@ -340,8 +340,11 @@ TEST_F(ShardCollectionTest, noInitialChunksOrData) {
{
BSONObj logChangeDetail =
BSON("shardKey" << keyPattern.toBSON() << "collection" << ns << "primary"
- << shard.getName() + ":" + shard.getHost() << "initShards"
- << BSONArray() << "numChunks" << 1);
+ << shard.getName() + ":" + shard.getHost()
+ << "initShards"
+ << BSONArray()
+ << "numChunks"
+ << 1);
expectChangeLogCreate(configHost, BSON("ok" << 1));
expectChangeLogInsert(
configHost, network()->now(), "shardCollection.start", ns, logChangeDetail);
@@ -511,9 +514,11 @@ TEST_F(ShardCollectionTest, withInitialChunks) {
{
BSONObj logChangeDetail =
BSON("shardKey" << keyPattern.toBSON() << "collection" << ns << "primary"
- << shard0.getName() + ":" + shard0.getHost() << "initShards"
+ << shard0.getName() + ":" + shard0.getHost()
+ << "initShards"
<< BSON_ARRAY(shard0.getName() << shard1.getName() << shard2.getName())
- << "numChunks" << (int)expectedChunks.size());
+ << "numChunks"
+ << (int)expectedChunks.size());
expectChangeLogCreate(configHost, BSON("ok" << 1));
expectChangeLogInsert(
configHost, network()->now(), "shardCollection.start", ns, logChangeDetail);
@@ -655,8 +660,11 @@ TEST_F(ShardCollectionTest, withInitialData) {
{
BSONObj logChangeDetail =
BSON("shardKey" << keyPattern.toBSON() << "collection" << ns << "primary"
- << shard.getName() + ":" + shard.getHost() << "initShards"
- << BSONArray() << "numChunks" << 1);
+ << shard.getName() + ":" + shard.getHost()
+ << "initShards"
+ << BSONArray()
+ << "numChunks"
+ << 1);
expectChangeLogCreate(configHost, BSON("ok" << 1));
expectChangeLogInsert(
configHost, network()->now(), "shardCollection.start", ns, logChangeDetail);
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp
index c539ee6ad5d..574a309c63b 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp
@@ -32,8 +32,8 @@
#include <pcrecpp.h>
-#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/bson/json.h"
+#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/db/commands.h"
#include "mongo/db/query/lite_parsed_query.h"
#include "mongo/db/repl/read_concern_args.h"
@@ -658,9 +658,13 @@ TEST_F(CatalogManagerReplSetTest, RunUserManagementWriteCommandSuccess) {
// Since no write concern was sent we will add w:majority
ASSERT_EQUALS(BSON("dropUser"
<< "test"
- << "writeConcern" << BSON("w"
- << "majority"
- << "wtimeout" << 0) << "maxTimeMS" << 30000),
+ << "writeConcern"
+ << BSON("w"
+ << "majority"
+ << "wtimeout"
+ << 0)
+ << "maxTimeMS"
+ << 30000),
request.cmdObj);
ASSERT_EQUALS(BSON(rpc::kReplSetMetadataFieldName << 1), request.metadata);
@@ -679,14 +683,14 @@ TEST_F(CatalogManagerReplSetTest, RunUserManagementWriteCommandInvalidWriteConce
configTargeter()->setFindHostReturnValue(HostAndPort("TestHost1"));
BSONObjBuilder responseBuilder;
- bool ok =
- catalogManager()->runUserManagementWriteCommand(operationContext(),
- "dropUser",
- "test",
- BSON("dropUser"
- << "test"
- << "writeConcern" << BSON("w" << 2)),
- &responseBuilder);
+ bool ok = catalogManager()->runUserManagementWriteCommand(operationContext(),
+ "dropUser",
+ "test",
+ BSON("dropUser"
+ << "test"
+ << "writeConcern"
+ << BSON("w" << 2)),
+ &responseBuilder);
ASSERT_FALSE(ok);
Status commandStatus = getStatusFromCommandResult(responseBuilder.obj());
@@ -708,31 +712,35 @@ TEST_F(CatalogManagerReplSetTest, RunUserManagementWriteCommandRewriteWriteConce
},
Status::OK());
- auto future =
- launchAsync([this] {
- BSONObjBuilder responseBuilder;
- bool ok =
- catalogManager()->runUserManagementWriteCommand(
- operationContext(),
- "dropUser",
- "test",
- BSON("dropUser"
- << "test"
- << "writeConcern" << BSON("w" << 1 << "wtimeout" << 30)),
- &responseBuilder);
- ASSERT_FALSE(ok);
-
- Status commandStatus = getStatusFromCommandResult(responseBuilder.obj());
- ASSERT_EQUALS(ErrorCodes::UserNotFound, commandStatus);
- });
+ auto future = launchAsync([this] {
+ BSONObjBuilder responseBuilder;
+ bool ok =
+ catalogManager()->runUserManagementWriteCommand(operationContext(),
+ "dropUser",
+ "test",
+ BSON("dropUser"
+ << "test"
+ << "writeConcern"
+ << BSON("w" << 1 << "wtimeout"
+ << 30)),
+ &responseBuilder);
+ ASSERT_FALSE(ok);
+
+ Status commandStatus = getStatusFromCommandResult(responseBuilder.obj());
+ ASSERT_EQUALS(ErrorCodes::UserNotFound, commandStatus);
+ });
onCommand([](const RemoteCommandRequest& request) {
ASSERT_EQUALS("test", request.dbname);
ASSERT_EQUALS(BSON("dropUser"
<< "test"
- << "writeConcern" << BSON("w"
- << "majority"
- << "wtimeout" << 30) << "maxTimeMS" << 30000),
+ << "writeConcern"
+ << BSON("w"
+ << "majority"
+ << "wtimeout"
+ << 30)
+ << "maxTimeMS"
+ << 30000),
request.cmdObj);
ASSERT_EQUALS(BSON(rpc::kReplSetMetadataFieldName << 1), request.metadata);
@@ -815,9 +823,13 @@ TEST_F(CatalogManagerReplSetTest, RunUserManagementWriteCommandNotMasterRetrySuc
// Since no write concern was sent we will add w:majority
ASSERT_EQUALS(BSON("dropUser"
<< "test"
- << "writeConcern" << BSON("w"
- << "majority"
- << "wtimeout" << 0) << "maxTimeMS" << 30000),
+ << "writeConcern"
+ << BSON("w"
+ << "majority"
+ << "wtimeout"
+ << 0)
+ << "maxTimeMS"
+ << 30000),
request.cmdObj);
ASSERT_EQUALS(BSON(rpc::kReplSetMetadataFieldName << 1), request.metadata);
@@ -1193,9 +1205,10 @@ TEST_F(CatalogManagerReplSetTest, GetTagForChunkOneTagFound) {
ASSERT_EQ(query->ns(), TagsType::ConfigNS);
ASSERT_EQ(query->getFilter(),
- BSON(TagsType::ns(chunk.getNS())
- << TagsType::min() << BSON("$lte" << chunk.getMin()) << TagsType::max()
- << BSON("$gte" << chunk.getMax())));
+ BSON(TagsType::ns(chunk.getNS()) << TagsType::min()
+ << BSON("$lte" << chunk.getMin())
+ << TagsType::max()
+ << BSON("$gte" << chunk.getMax())));
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
@@ -1237,9 +1250,10 @@ TEST_F(CatalogManagerReplSetTest, GetTagForChunkNoTagFound) {
ASSERT_EQ(query->ns(), TagsType::ConfigNS);
ASSERT_EQ(query->getFilter(),
- BSON(TagsType::ns(chunk.getNS())
- << TagsType::min() << BSON("$lte" << chunk.getMin()) << TagsType::max()
- << BSON("$gte" << chunk.getMax())));
+ BSON(TagsType::ns(chunk.getNS()) << TagsType::min()
+ << BSON("$lte" << chunk.getMin())
+ << TagsType::max()
+ << BSON("$gte" << chunk.getMax())));
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
@@ -1278,9 +1292,10 @@ TEST_F(CatalogManagerReplSetTest, GetTagForChunkInvalidTagDoc) {
ASSERT_EQ(query->ns(), TagsType::ConfigNS);
ASSERT_EQ(query->getFilter(),
- BSON(TagsType::ns(chunk.getNS())
- << TagsType::min() << BSON("$lte" << chunk.getMin()) << TagsType::max()
- << BSON("$gte" << chunk.getMax())));
+ BSON(TagsType::ns(chunk.getNS()) << TagsType::min()
+ << BSON("$lte" << chunk.getMin())
+ << TagsType::max()
+ << BSON("$gte" << chunk.getMax())));
checkReadConcern(request.cmdObj, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
@@ -1388,7 +1403,8 @@ TEST_F(CatalogManagerReplSetTest, ApplyChunkOpsDeprecatedSuccessful) {
ASSERT_EQUALS("config", request.dbname);
ASSERT_EQUALS(BSON("w"
<< "majority"
- << "wtimeout" << 15000),
+ << "wtimeout"
+ << 15000),
request.cmdObj["writeConcern"].Obj());
ASSERT_EQUALS(BSON(rpc::kReplSetMetadataFieldName << 1), request.metadata);
ASSERT_EQUALS(updateOps, request.cmdObj["applyOps"].Obj());
@@ -1925,10 +1941,12 @@ TEST_F(CatalogManagerReplSetTest, EnableShardingNoDBExists) {
shardRegistry()->getShard(operationContext(), "shard0")->getTargeter());
shardTargeter->setFindHostReturnValue(HostAndPort("shard0:12"));
- distLock()->expectLock([](StringData name, StringData whyMessage, Milliseconds, Milliseconds) {
- ASSERT_EQ("test", name);
- ASSERT_FALSE(whyMessage.empty());
- }, Status::OK());
+ distLock()->expectLock(
+ [](StringData name, StringData whyMessage, Milliseconds, Milliseconds) {
+ ASSERT_EQ("test", name);
+ ASSERT_FALSE(whyMessage.empty());
+ },
+ Status::OK());
auto future = launchAsync([this] {
auto status = catalogManager()->enableSharding(operationContext(), "test");
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_upgrade_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_upgrade_test.cpp
index c8e2a975a58..43946d897c2 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_upgrade_test.cpp
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_upgrade_test.cpp
@@ -76,8 +76,11 @@ TEST_F(CatalogManagerReplSetTestFixture, UpgradeNotNeeded) {
checkReadConcern(findCmd, Timestamp(0, 0), repl::OpTime::kUninitializedTerm);
BSONObj versionDoc(BSON("_id" << 1 << "minCompatibleVersion"
- << MIN_COMPATIBLE_CONFIG_VERSION << "currentVersion"
- << CURRENT_CONFIG_VERSION << "clusterId" << OID::gen()));
+ << MIN_COMPATIBLE_CONFIG_VERSION
+ << "currentVersion"
+ << CURRENT_CONFIG_VERSION
+ << "clusterId"
+ << OID::gen()));
return vector<BSONObj>{versionDoc};
});
diff --git a/src/mongo/s/catalog/replset/dist_lock_catalog_impl.cpp b/src/mongo/s/catalog/replset/dist_lock_catalog_impl.cpp
index cbdef7a2761..dd9a51c34bc 100644
--- a/src/mongo/s/catalog/replset/dist_lock_catalog_impl.cpp
+++ b/src/mongo/s/catalog/replset/dist_lock_catalog_impl.cpp
@@ -98,7 +98,8 @@ StatusWith<BSONObj> extractFindAndModifyNewObj(StatusWith<Shard::CommandResponse
return {ErrorCodes::UnsupportedFormat,
str::stream() << "expected an object from the findAndModify response '"
<< kFindAndModifyResponseResultDocField
- << "'field, got: " << newDocElem};
+ << "'field, got: "
+ << newDocElem};
}
return newDocElem.Obj().getOwned();
@@ -191,10 +192,14 @@ StatusWith<LocksType> DistLockCatalogImpl::grabLock(OperationContext* txn,
StringData processId,
Date_t time,
StringData why) {
- BSONObj newLockDetails(BSON(LocksType::lockID(lockSessionID)
- << LocksType::state(LocksType::LOCKED) << LocksType::who() << who
- << LocksType::process() << processId << LocksType::when(time)
- << LocksType::why() << why));
+ BSONObj newLockDetails(BSON(
+ LocksType::lockID(lockSessionID) << LocksType::state(LocksType::LOCKED) << LocksType::who()
+ << who
+ << LocksType::process()
+ << processId
+ << LocksType::when(time)
+ << LocksType::why()
+ << why));
auto request = FindAndModifyRequest::makeUpdate(
_locksNS,
@@ -246,10 +251,14 @@ StatusWith<LocksType> DistLockCatalogImpl::overtakeLock(OperationContext* txn,
BSON(LocksType::name() << lockID << LocksType::state(LocksType::UNLOCKED)));
orQueryBuilder.append(BSON(LocksType::name() << lockID << LocksType::lockID(currentHolderTS)));
- BSONObj newLockDetails(BSON(LocksType::lockID(lockSessionID)
- << LocksType::state(LocksType::LOCKED) << LocksType::who() << who
- << LocksType::process() << processId << LocksType::when(time)
- << LocksType::why() << why));
+ BSONObj newLockDetails(BSON(
+ LocksType::lockID(lockSessionID) << LocksType::state(LocksType::LOCKED) << LocksType::who()
+ << who
+ << LocksType::process()
+ << processId
+ << LocksType::when(time)
+ << LocksType::why()
+ << why));
auto request = FindAndModifyRequest::makeUpdate(
_locksNS, BSON("$or" << orQueryBuilder.arr()), BSON("$set" << newLockDetails));
@@ -343,7 +352,8 @@ Status DistLockCatalogImpl::unlockAll(OperationContext* txn, const std::string&
return Status(ErrorCodes::FailedToParse,
str::stream()
<< "Failed to parse config server response to batch request for "
- "unlocking existing distributed locks" << causedBy(errmsg));
+ "unlocking existing distributed locks"
+ << causedBy(errmsg));
}
return batchResponse.toStatus();
}
diff --git a/src/mongo/s/catalog/replset/dist_lock_catalog_impl_test.cpp b/src/mongo/s/catalog/replset/dist_lock_catalog_impl_test.cpp
index 35c9be42c9b..5d538ea3407 100644
--- a/src/mongo/s/catalog/replset/dist_lock_catalog_impl_test.cpp
+++ b/src/mongo/s/catalog/replset/dist_lock_catalog_impl_test.cpp
@@ -1036,14 +1036,17 @@ TEST_F(DistLockCatalogFixture, UnlockWriteConcernError) {
// The dist lock catalog calls into the ShardRegistry, which will retry 3 times for
// WriteConcernFailed errors
- onCommand([&](const RemoteCommandRequest& request)
- -> StatusWith<BSONObj> { return writeConcernFailedResponse; });
+ onCommand([&](const RemoteCommandRequest& request) -> StatusWith<BSONObj> {
+ return writeConcernFailedResponse;
+ });
- onCommand([&](const RemoteCommandRequest& request)
- -> StatusWith<BSONObj> { return writeConcernFailedResponse; });
+ onCommand([&](const RemoteCommandRequest& request) -> StatusWith<BSONObj> {
+ return writeConcernFailedResponse;
+ });
- onCommand([&](const RemoteCommandRequest& request)
- -> StatusWith<BSONObj> { return writeConcernFailedResponse; });
+ onCommand([&](const RemoteCommandRequest& request) -> StatusWith<BSONObj> {
+ return writeConcernFailedResponse;
+ });
future.timed_get(kFutureTimeout);
}
@@ -1090,30 +1093,31 @@ TEST_F(DistLockCatalogFixture, BasicUnlockAll) {
ASSERT_OK(status);
});
- onCommand([](const RemoteCommandRequest& request)
- -> StatusWith<BSONObj> {
- ASSERT_EQUALS(dummyHost, request.target);
- ASSERT_EQUALS("config", request.dbname);
-
- std::string errmsg;
- BatchedUpdateRequest batchRequest;
- ASSERT(batchRequest.parseBSON("config", request.cmdObj, &errmsg));
- ASSERT_EQUALS(LocksType::ConfigNS, batchRequest.getNS().toString());
- ASSERT_EQUALS(BSON("w"
- << "majority"
- << "wtimeout" << 15000),
- batchRequest.getWriteConcern());
- auto updates = batchRequest.getUpdates();
- ASSERT_EQUALS(1U, updates.size());
- auto update = updates.front();
- ASSERT_FALSE(update->getUpsert());
- ASSERT_TRUE(update->getMulti());
- ASSERT_EQUALS(BSON(LocksType::process("processID")), update->getQuery());
- ASSERT_EQUALS(BSON("$set" << BSON(LocksType::state(LocksType::UNLOCKED))),
- update->getUpdateExpr());
-
- return BSON("ok" << 1);
- });
+ onCommand(
+ [](const RemoteCommandRequest& request) -> StatusWith<BSONObj> {
+ ASSERT_EQUALS(dummyHost, request.target);
+ ASSERT_EQUALS("config", request.dbname);
+
+ std::string errmsg;
+ BatchedUpdateRequest batchRequest;
+ ASSERT(batchRequest.parseBSON("config", request.cmdObj, &errmsg));
+ ASSERT_EQUALS(LocksType::ConfigNS, batchRequest.getNS().toString());
+ ASSERT_EQUALS(BSON("w"
+ << "majority"
+ << "wtimeout"
+ << 15000),
+ batchRequest.getWriteConcern());
+ auto updates = batchRequest.getUpdates();
+ ASSERT_EQUALS(1U, updates.size());
+ auto update = updates.front();
+ ASSERT_FALSE(update->getUpsert());
+ ASSERT_TRUE(update->getMulti());
+ ASSERT_EQUALS(BSON(LocksType::process("processID")), update->getQuery());
+ ASSERT_EQUALS(BSON("$set" << BSON(LocksType::state(LocksType::UNLOCKED))),
+ update->getUpdateExpr());
+
+ return BSON("ok" << 1);
+ });
future.timed_get(kFutureTimeout);
}
@@ -1488,8 +1492,9 @@ TEST_F(DistLockCatalogFixture, GetPingNotFound) {
ASSERT_FALSE(status.reason().empty());
});
- onFindCommand([](const RemoteCommandRequest& request)
- -> StatusWith<vector<BSONObj>> { return std::vector<BSONObj>(); });
+ onFindCommand([](const RemoteCommandRequest& request) -> StatusWith<vector<BSONObj>> {
+ return std::vector<BSONObj>();
+ });
future.timed_get(kFutureTimeout);
}
@@ -1572,8 +1577,9 @@ TEST_F(DistLockCatalogFixture, GetLockByTSNotFound) {
ASSERT_FALSE(status.reason().empty());
});
- onFindCommand([](const RemoteCommandRequest& request)
- -> StatusWith<vector<BSONObj>> { return std::vector<BSONObj>(); });
+ onFindCommand([](const RemoteCommandRequest& request) -> StatusWith<vector<BSONObj>> {
+ return std::vector<BSONObj>();
+ });
future.timed_get(kFutureTimeout);
}
@@ -1660,8 +1666,9 @@ TEST_F(DistLockCatalogFixture, GetLockByNameNotFound) {
ASSERT_FALSE(status.reason().empty());
});
- onFindCommand([](const RemoteCommandRequest& request)
- -> StatusWith<vector<BSONObj>> { return std::vector<BSONObj>(); });
+ onFindCommand([](const RemoteCommandRequest& request) -> StatusWith<vector<BSONObj>> {
+ return std::vector<BSONObj>();
+ });
future.timed_get(kFutureTimeout);
}
diff --git a/src/mongo/s/catalog/replset/replset_dist_lock_manager.cpp b/src/mongo/s/catalog/replset/replset_dist_lock_manager.cpp
index 8fcd79fc6cd..8b387f30506 100644
--- a/src/mongo/s/catalog/replset/replset_dist_lock_manager.cpp
+++ b/src/mongo/s/catalog/replset/replset_dist_lock_manager.cpp
@@ -34,8 +34,8 @@
#include "mongo/base/status.h"
#include "mongo/base/status_with.h"
-#include "mongo/db/service_context.h"
#include "mongo/db/operation_context_noop.h"
+#include "mongo/db/service_context.h"
#include "mongo/s/catalog/dist_lock_catalog.h"
#include "mongo/s/catalog/type_lockpings.h"
#include "mongo/s/catalog/type_locks.h"
@@ -47,8 +47,8 @@
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
-#include "mongo/util/timer.h"
#include "mongo/util/time_support.h"
+#include "mongo/util/timer.h"
namespace mongo {
diff --git a/src/mongo/s/catalog/replset/replset_dist_lock_manager_test.cpp b/src/mongo/s/catalog/replset/replset_dist_lock_manager_test.cpp
index 792bb3ca9d8..1b16e1f35da 100644
--- a/src/mongo/s/catalog/replset/replset_dist_lock_manager_test.cpp
+++ b/src/mongo/s/catalog/replset/replset_dist_lock_manager_test.cpp
@@ -30,19 +30,19 @@
#include "mongo/s/catalog/replset/replset_dist_lock_manager.h"
+#include <boost/optional.hpp>
+#include <boost/optional/optional_io.hpp>
#include <map>
#include <string>
#include <type_traits>
#include <vector>
-#include <boost/optional.hpp>
-#include <boost/optional/optional_io.hpp>
#include "mongo/base/status.h"
#include "mongo/base/status_with.h"
#include "mongo/bson/json.h"
#include "mongo/bson/util/builder.h"
-#include "mongo/client/remote_command_targeter_factory_mock.h"
#include "mongo/client/remote_command_targeter.h"
+#include "mongo/client/remote_command_targeter_factory_mock.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/service_context_noop.h"
@@ -364,9 +364,11 @@ TEST_F(RSDistLockMgrWithMockTickSource, LockSuccessAfterRetry) {
getMockCatalog()->expectNoGrabLock();
- getMockCatalog()->expectGetLockByName([](StringData name) {
- FAIL("should not attempt to overtake lock after successful lock");
- }, LocksType());
+ getMockCatalog()->expectGetLockByName(
+ [](StringData name) {
+ FAIL("should not attempt to overtake lock after successful lock");
+ },
+ LocksType());
},
goodLockDoc);
}
@@ -828,10 +830,12 @@ TEST_F(ReplSetDistLockManagerFixture, MultipleQueuedUnlock) {
* Returns true if all values in the map are greater than 2.
*/
auto mapEntriesGreaterThanTwo = [](const decltype(unlockIDMap)& map) -> bool {
- auto iter = find_if(map.begin(),
- map.end(),
- [](const std::remove_reference<decltype(map)>::type::value_type& entry)
- -> bool { return entry.second < 3; });
+ auto iter = find_if(
+ map.begin(),
+ map.end(),
+ [](const std::remove_reference<decltype(map)>::type::value_type& entry) -> bool {
+ return entry.second < 3;
+ });
return iter == map.end();
};
@@ -844,10 +848,12 @@ TEST_F(ReplSetDistLockManagerFixture, MultipleQueuedUnlock) {
// Wait until we see at least 2 unique lockSessionID more than twice.
if (unlockIDMap.size() >= 2 && mapEntriesGreaterThanTwo(unlockIDMap)) {
- getMockCatalog()->expectUnLock([&testMutex, &unlockCV](const OID& lockSessionID) {
- stdx::unique_lock<stdx::mutex> lk(testMutex);
- unlockCV.notify_all();
- }, Status::OK());
+ getMockCatalog()->expectUnLock(
+ [&testMutex, &unlockCV](const OID& lockSessionID) {
+ stdx::unique_lock<stdx::mutex> lk(testMutex);
+ unlockCV.notify_all();
+ },
+ Status::OK());
}
},
{ErrorCodes::NetworkTimeout, "bad test network"});
@@ -910,10 +916,12 @@ TEST_F(ReplSetDistLockManagerFixture, MultipleQueuedUnlock) {
TEST_F(ReplSetDistLockManagerFixture, CleanupPingOnShutdown) {
bool stopPingCalled = false;
- getMockCatalog()->expectStopPing([this, &stopPingCalled](StringData processID) {
- ASSERT_EQUALS(getProcessID(), processID);
- stopPingCalled = true;
- }, Status::OK());
+ getMockCatalog()->expectStopPing(
+ [this, &stopPingCalled](StringData processID) {
+ ASSERT_EQUALS(getProcessID(), processID);
+ stopPingCalled = true;
+ },
+ Status::OK());
getMgr()->shutDown(txn());
ASSERT_TRUE(stopPingCalled);
@@ -989,9 +997,9 @@ TEST_F(ReplSetDistLockManagerFixture, CheckLockStatusNoLongerOwn) {
auto& scopedLock = lockStatus.getValue();
getMockCatalog()->expectNoGrabLock();
- getMockCatalog()->expectGetLockByTS([&lockSessionID](const OID& ts) {
- ASSERT_EQUALS(lockSessionID, ts);
- }, {ErrorCodes::LockNotFound, "no lock"});
+ getMockCatalog()->expectGetLockByTS(
+ [&lockSessionID](const OID& ts) { ASSERT_EQUALS(lockSessionID, ts); },
+ {ErrorCodes::LockNotFound, "no lock"});
ASSERT_NOT_OK(scopedLock.checkStatus());
}
@@ -1028,9 +1036,9 @@ TEST_F(ReplSetDistLockManagerFixture, CheckLockStatusError) {
auto& scopedLock = lockStatus.getValue();
getMockCatalog()->expectNoGrabLock();
- getMockCatalog()->expectGetLockByTS([&lockSessionID](const OID& ts) {
- ASSERT_EQUALS(lockSessionID, ts);
- }, {ErrorCodes::NetworkTimeout, "bad test network"});
+ getMockCatalog()->expectGetLockByTS(
+ [&lockSessionID](const OID& ts) { ASSERT_EQUALS(lockSessionID, ts); },
+ {ErrorCodes::NetworkTimeout, "bad test network"});
ASSERT_NOT_OK(scopedLock.checkStatus());
}
@@ -1264,9 +1272,9 @@ TEST_F(ReplSetDistLockManagerFixture, GetPingErrorWhileOvertaking) {
getMockCatalog()->expectGetLockByName([](StringData name) { ASSERT_EQUALS("bar", name); },
currentLockDoc);
- getMockCatalog()->expectGetPing([](StringData process) {
- ASSERT_EQUALS("otherProcess", process);
- }, {ErrorCodes::NetworkTimeout, "bad test network"});
+ getMockCatalog()->expectGetPing(
+ [](StringData process) { ASSERT_EQUALS("otherProcess", process); },
+ {ErrorCodes::NetworkTimeout, "bad test network"});
auto status = getMgr()->lock(txn(), "bar", "", Milliseconds(0), Milliseconds(0)).getStatus();
ASSERT_NOT_OK(status);
@@ -1406,9 +1414,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfPingIsActive) {
getMockCatalog()->expectGetPing(
[](StringData process) { ASSERT_EQUALS("otherProcess", process); }, pingDoc);
- getMockCatalog()->expectGetServerInfo([&getServerInfoCallCount]() {
- getServerInfoCallCount++;
- }, DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
+ getMockCatalog()->expectGetServerInfo(
+ [&getServerInfoCallCount]() { getServerInfoCallCount++; },
+ DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
auto status =
getMgr()->lock(txn(), "bar", "", Milliseconds(0), Milliseconds(0)).getStatus();
@@ -1419,9 +1427,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfPingIsActive) {
ASSERT_EQUALS(kLoopCount, getServerInfoCallCount);
configServerLocalTime += kLockExpiration;
- getMockCatalog()->expectGetServerInfo([&getServerInfoCallCount]() {
- getServerInfoCallCount++;
- }, DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
+ getMockCatalog()->expectGetServerInfo(
+ [&getServerInfoCallCount]() { getServerInfoCallCount++; },
+ DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
OID lockTS;
// Make sure that overtake is now ok since ping is no longer updated.
@@ -1505,9 +1513,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfOwnerJustChanged) {
getMockCatalog()->expectGetLockByName([](StringData name) { ASSERT_EQUALS("bar", name); },
currentLockDoc);
- getMockCatalog()->expectGetServerInfo([&getServerInfoCallCount]() {
- getServerInfoCallCount++;
- }, DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
+ getMockCatalog()->expectGetServerInfo(
+ [&getServerInfoCallCount]() { getServerInfoCallCount++; },
+ DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
auto status =
getMgr()->lock(txn(), "bar", "", Milliseconds(0), Milliseconds(0)).getStatus();
@@ -1518,9 +1526,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfOwnerJustChanged) {
ASSERT_EQUALS(kLoopCount, getServerInfoCallCount);
configServerLocalTime += kLockExpiration;
- getMockCatalog()->expectGetServerInfo([&getServerInfoCallCount]() {
- getServerInfoCallCount++;
- }, DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
+ getMockCatalog()->expectGetServerInfo(
+ [&getServerInfoCallCount]() { getServerInfoCallCount++; },
+ DistLockCatalog::ServerInfo(configServerLocalTime, OID()));
OID lockTS;
// Make sure that overtake is now ok since lock owner didn't change.
@@ -1607,9 +1615,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfElectionIdChanged) {
[](StringData process) { ASSERT_EQUALS("otherProcess", process); }, fixedPingDoc);
lastElectionId = OID::gen();
- getMockCatalog()->expectGetServerInfo([&getServerInfoCallCount]() {
- getServerInfoCallCount++;
- }, DistLockCatalog::ServerInfo(configServerLocalTime, lastElectionId));
+ getMockCatalog()->expectGetServerInfo(
+ [&getServerInfoCallCount]() { getServerInfoCallCount++; },
+ DistLockCatalog::ServerInfo(configServerLocalTime, lastElectionId));
auto status =
getMgr()->lock(txn(), "bar", "", Milliseconds(0), Milliseconds(0)).getStatus();
@@ -1620,9 +1628,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfElectionIdChanged) {
ASSERT_EQUALS(kLoopCount, getServerInfoCallCount);
configServerLocalTime += kLockExpiration;
- getMockCatalog()->expectGetServerInfo([&getServerInfoCallCount]() {
- getServerInfoCallCount++;
- }, DistLockCatalog::ServerInfo(configServerLocalTime, lastElectionId));
+ getMockCatalog()->expectGetServerInfo(
+ [&getServerInfoCallCount]() { getServerInfoCallCount++; },
+ DistLockCatalog::ServerInfo(configServerLocalTime, lastElectionId));
OID lockTS;
// Make sure that overtake is now ok since electionId didn't change.
@@ -1893,8 +1901,9 @@ TEST_F(ReplSetDistLockManagerFixture, CannotOvertakeIfConfigServerClockGoesBackw
}
// Make config server time go backwards by lock expiration duration.
- getMockCatalog()->expectGetServerInfo([]() {
- }, DistLockCatalog::ServerInfo(configClock - kLockExpiration - Milliseconds(1), OID()));
+ getMockCatalog()->expectGetServerInfo(
+ []() {},
+ DistLockCatalog::ServerInfo(configClock - kLockExpiration - Milliseconds(1), OID()));
// Second attempt should not overtake lock.
{
@@ -1970,9 +1979,9 @@ TEST_F(RSDistLockMgrWithMockTickSource, CanOvertakeIfNoPingDocument) {
getMockCatalog()->expectGetLockByName([](StringData name) { ASSERT_EQUALS("bar", name); },
currentLockDoc);
- getMockCatalog()->expectGetPing([](StringData process) {
- ASSERT_EQUALS("otherProcess", process);
- }, {ErrorCodes::NoMatchingDocument, "no ping"});
+ getMockCatalog()->expectGetPing(
+ [](StringData process) { ASSERT_EQUALS("otherProcess", process); },
+ {ErrorCodes::NoMatchingDocument, "no ping"});
getMockCatalog()->expectGetServerInfo([]() {}, DistLockCatalog::ServerInfo(Date_t(), OID()));
@@ -1994,9 +2003,9 @@ TEST_F(RSDistLockMgrWithMockTickSource, CanOvertakeIfNoPingDocument) {
getMockCatalog()->expectGetLockByName([](StringData name) { ASSERT_EQUALS("bar", name); },
currentLockDoc);
- getMockCatalog()->expectGetPing([](StringData process) {
- ASSERT_EQUALS("otherProcess", process);
- }, {ErrorCodes::NoMatchingDocument, "no ping"});
+ getMockCatalog()->expectGetPing(
+ [](StringData process) { ASSERT_EQUALS("otherProcess", process); },
+ {ErrorCodes::NoMatchingDocument, "no ping"});
getMockCatalog()->expectGetServerInfo(
[]() {}, DistLockCatalog::ServerInfo(Date_t() + kLockExpiration + Milliseconds(1), OID()));
diff --git a/src/mongo/s/catalog/type_changelog_test.cpp b/src/mongo/s/catalog/type_changelog_test.cpp
index 1090b7be0e7..904c9fdfa46 100644
--- a/src/mongo/s/catalog/type_changelog_test.cpp
+++ b/src/mongo/s/catalog/type_changelog_test.cpp
@@ -44,12 +44,14 @@ TEST(ChangeLogType, Empty) {
}
TEST(ChangeLogType, Valid) {
- BSONObj obj = BSON(
- ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
- << ChangeLogType::server("host.local") << ChangeLogType::clientAddr("192.168.0.189:51128")
- << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1)) << ChangeLogType::what("split")
- << ChangeLogType::ns("test.test") << ChangeLogType::details(BSON("dummy"
- << "info")));
+ BSONObj obj = BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
+ << ChangeLogType::server("host.local")
+ << ChangeLogType::clientAddr("192.168.0.189:51128")
+ << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1))
+ << ChangeLogType::what("split")
+ << ChangeLogType::ns("test.test")
+ << ChangeLogType::details(BSON("dummy"
+ << "info")));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_OK(changeLogResult.getStatus());
@@ -68,60 +70,65 @@ TEST(ChangeLogType, Valid) {
}
TEST(ChangeLogType, MissingChangeId) {
- BSONObj obj =
- BSON(ChangeLogType::server("host.local")
- << ChangeLogType::clientAddr("192.168.0.189:51128")
- << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1)) << ChangeLogType::what("split")
- << ChangeLogType::ns("test.test") << ChangeLogType::details(BSON("dummy"
- << "info")));
+ BSONObj obj = BSON(ChangeLogType::server("host.local")
+ << ChangeLogType::clientAddr("192.168.0.189:51128")
+ << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1))
+ << ChangeLogType::what("split")
+ << ChangeLogType::ns("test.test")
+ << ChangeLogType::details(BSON("dummy"
+ << "info")));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, changeLogResult.getStatus());
}
TEST(ChangeLogType, MissingServer) {
- BSONObj obj =
- BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
- << ChangeLogType::clientAddr("192.168.0.189:51128")
- << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1)) << ChangeLogType::what("split")
- << ChangeLogType::ns("test.test") << ChangeLogType::details(BSON("dummy"
- << "info")));
+ BSONObj obj = BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
+ << ChangeLogType::clientAddr("192.168.0.189:51128")
+ << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1))
+ << ChangeLogType::what("split")
+ << ChangeLogType::ns("test.test")
+ << ChangeLogType::details(BSON("dummy"
+ << "info")));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, changeLogResult.getStatus());
}
TEST(ChangeLogType, MissingClientAddr) {
- BSONObj obj =
- BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
- << ChangeLogType::server("host.local")
- << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1)) << ChangeLogType::what("split")
- << ChangeLogType::ns("test.test") << ChangeLogType::details(BSON("dummy"
- << "info")));
+ BSONObj obj = BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
+ << ChangeLogType::server("host.local")
+ << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1))
+ << ChangeLogType::what("split")
+ << ChangeLogType::ns("test.test")
+ << ChangeLogType::details(BSON("dummy"
+ << "info")));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, changeLogResult.getStatus());
}
TEST(ChangeLogType, MissingTime) {
- BSONObj obj =
- BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
- << ChangeLogType::server("host.local")
- << ChangeLogType::clientAddr("192.168.0.189:51128") << ChangeLogType::what("split")
- << ChangeLogType::ns("test.test") << ChangeLogType::details(BSON("dummy"
- << "info")));
+ BSONObj obj = BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
+ << ChangeLogType::server("host.local")
+ << ChangeLogType::clientAddr("192.168.0.189:51128")
+ << ChangeLogType::what("split")
+ << ChangeLogType::ns("test.test")
+ << ChangeLogType::details(BSON("dummy"
+ << "info")));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, changeLogResult.getStatus());
}
TEST(ChangeLogType, MissingWhat) {
- BSONObj obj = BSON(
- ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
- << ChangeLogType::server("host.local") << ChangeLogType::clientAddr("192.168.0.189:51128")
- << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1)) << ChangeLogType::ns("test.test")
- << ChangeLogType::details(BSON("dummy"
- << "info")));
+ BSONObj obj = BSON(ChangeLogType::changeId("host.local-2012-11-21T19:14:10-8")
+ << ChangeLogType::server("host.local")
+ << ChangeLogType::clientAddr("192.168.0.189:51128")
+ << ChangeLogType::time(Date_t::fromMillisSinceEpoch(1))
+ << ChangeLogType::ns("test.test")
+ << ChangeLogType::details(BSON("dummy"
+ << "info")));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, changeLogResult.getStatus());
@@ -132,7 +139,8 @@ TEST(ChangeLogType, MissingDetails) {
<< ChangeLogType::server("host.local")
<< ChangeLogType::clientAddr("192.168.0.189:51128")
<< ChangeLogType::time(Date_t::fromMillisSinceEpoch(1))
- << ChangeLogType::what("split") << ChangeLogType::ns("test.test"));
+ << ChangeLogType::what("split")
+ << ChangeLogType::ns("test.test"));
auto changeLogResult = ChangeLogType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, changeLogResult.getStatus());
diff --git a/src/mongo/s/catalog/type_chunk_test.cpp b/src/mongo/s/catalog/type_chunk_test.cpp
index cd4bbb4b1d4..a246df00c54 100644
--- a/src/mongo/s/catalog/type_chunk_test.cpp
+++ b/src/mongo/s/catalog/type_chunk_test.cpp
@@ -46,25 +46,33 @@ TEST(ChunkType, MissingRequiredFields) {
ChunkVersion chunkVersion(1, 2, OID::gen());
BSONObj objModNS =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::min(BSON("a" << 10 << "b" << 10)) << ChunkType::max(BSON("a" << 20))
- << "lastmod" << Timestamp(chunkVersion.toLong()) << "lastmodEpoch"
- << chunkVersion.epoch() << ChunkType::shard("shard0001"));
+ BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::min(BSON("a" << 10 << "b" << 10))
+ << ChunkType::max(BSON("a" << 20))
+ << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch()
+ << ChunkType::shard("shard0001"));
StatusWith<ChunkType> chunkRes = ChunkType::fromBSON(objModNS);
ASSERT_FALSE(chunkRes.isOK());
BSONObj objModKeys =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::ns("test.mycol") << "lastmod" << Timestamp(chunkVersion.toLong())
- << "lastmodEpoch" << chunkVersion.epoch() << ChunkType::shard("shard0001"));
+ BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::ns("test.mycol") << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch()
+ << ChunkType::shard("shard0001"));
chunkRes = ChunkType::fromBSON(objModKeys);
ASSERT_FALSE(chunkRes.isOK());
BSONObj objModShard =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::ns("test.mycol") << ChunkType::min(BSON("a" << 10 << "b" << 10))
- << ChunkType::max(BSON("a" << 20)) << "lastmod" << Timestamp(chunkVersion.toLong())
- << "lastmodEpoch" << chunkVersion.epoch());
+ BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::ns("test.mycol")
+ << ChunkType::min(BSON("a" << 10 << "b" << 10))
+ << ChunkType::max(BSON("a" << 20))
+ << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch());
chunkRes = ChunkType::fromBSON(objModShard);
ASSERT_FALSE(chunkRes.isOK());
}
@@ -72,10 +80,14 @@ TEST(ChunkType, MissingRequiredFields) {
TEST(ChunkType, MinAndMaxShardKeysDifferInNumberOfKeys) {
ChunkVersion chunkVersion(1, 2, OID::gen());
BSONObj obj =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::ns("test.mycol") << ChunkType::min(BSON("a" << 10 << "b" << 10))
- << ChunkType::max(BSON("a" << 20)) << "lastmod" << Timestamp(chunkVersion.toLong())
- << "lastmodEpoch" << chunkVersion.epoch() << ChunkType::shard("shard0001"));
+ BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::ns("test.mycol")
+ << ChunkType::min(BSON("a" << 10 << "b" << 10))
+ << ChunkType::max(BSON("a" << 20))
+ << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch()
+ << ChunkType::shard("shard0001"));
StatusWith<ChunkType> chunkRes = ChunkType::fromBSON(obj);
ASSERT_OK(chunkRes.getStatus());
ASSERT_FALSE(chunkRes.getValue().validate().isOK());
@@ -83,11 +95,14 @@ TEST(ChunkType, MinAndMaxShardKeysDifferInNumberOfKeys) {
TEST(ChunkType, MinAndMaxShardKeysDifferInKeyNames) {
ChunkVersion chunkVersion(1, 2, OID::gen());
- BSONObj obj =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::ns("test.mycol") << ChunkType::min(BSON("a" << 10))
- << ChunkType::max(BSON("b" << 20)) << "lastmod" << Timestamp(chunkVersion.toLong())
- << "lastmodEpoch" << chunkVersion.epoch() << ChunkType::shard("shard0001"));
+ BSONObj obj = BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::ns("test.mycol")
+ << ChunkType::min(BSON("a" << 10))
+ << ChunkType::max(BSON("b" << 20))
+ << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch()
+ << ChunkType::shard("shard0001"));
StatusWith<ChunkType> chunkRes = ChunkType::fromBSON(obj);
ASSERT_OK(chunkRes.getStatus());
ASSERT_FALSE(chunkRes.getValue().validate().isOK());
@@ -95,11 +110,14 @@ TEST(ChunkType, MinAndMaxShardKeysDifferInKeyNames) {
TEST(ChunkType, NotAscending) {
ChunkVersion chunkVersion(1, 2, OID::gen());
- BSONObj obj =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::ns("test.mycol") << ChunkType::min(BSON("a" << 20))
- << ChunkType::max(BSON("a" << 10)) << "lastmod" << Timestamp(chunkVersion.toLong())
- << "lastmodEpoch" << chunkVersion.epoch() << ChunkType::shard("shard0001"));
+ BSONObj obj = BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::ns("test.mycol")
+ << ChunkType::min(BSON("a" << 20))
+ << ChunkType::max(BSON("a" << 10))
+ << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch()
+ << ChunkType::shard("shard0001"));
StatusWith<ChunkType> chunkRes = ChunkType::fromBSON(obj);
ASSERT_OK(chunkRes.getStatus());
ASSERT_FALSE(chunkRes.getValue().validate().isOK());
@@ -107,11 +125,14 @@ TEST(ChunkType, NotAscending) {
TEST(ChunkType, CorrectContents) {
ChunkVersion chunkVersion(1, 2, OID::gen());
- BSONObj obj =
- BSON(ChunkType::name("test.mycol-a_MinKey")
- << ChunkType::ns("test.mycol") << ChunkType::min(BSON("a" << 10))
- << ChunkType::max(BSON("a" << 20)) << "lastmod" << Timestamp(chunkVersion.toLong())
- << "lastmodEpoch" << chunkVersion.epoch() << ChunkType::shard("shard0001"));
+ BSONObj obj = BSON(ChunkType::name("test.mycol-a_MinKey") << ChunkType::ns("test.mycol")
+ << ChunkType::min(BSON("a" << 10))
+ << ChunkType::max(BSON("a" << 20))
+ << "lastmod"
+ << Timestamp(chunkVersion.toLong())
+ << "lastmodEpoch"
+ << chunkVersion.epoch()
+ << ChunkType::shard("shard0001"));
StatusWith<ChunkType> chunkRes = ChunkType::fromBSON(obj);
ASSERT_OK(chunkRes.getStatus());
ChunkType chunk = chunkRes.getValue();
@@ -126,13 +147,18 @@ TEST(ChunkType, CorrectContents) {
}
TEST(ChunkType, Pre22Format) {
- ChunkType chunk = assertGet(
- ChunkType::fromBSON(BSON("_id"
- << "test.mycol-a_MinKey"
- << "lastmod" << Date_t::fromMillisSinceEpoch(1) << "ns"
- << "test.mycol"
- << "min" << BSON("a" << 10) << "max" << BSON("a" << 20) << "shard"
- << "shard0001")));
+ ChunkType chunk = assertGet(ChunkType::fromBSON(BSON("_id"
+ << "test.mycol-a_MinKey"
+ << "lastmod"
+ << Date_t::fromMillisSinceEpoch(1)
+ << "ns"
+ << "test.mycol"
+ << "min"
+ << BSON("a" << 10)
+ << "max"
+ << BSON("a" << 20)
+ << "shard"
+ << "shard0001")));
ASSERT_OK(chunk.validate());
ASSERT_EQUALS(chunk.getNS(), "test.mycol");
diff --git a/src/mongo/s/catalog/type_collection_test.cpp b/src/mongo/s/catalog/type_collection_test.cpp
index 893f3e6cb56..ead96ca0850 100644
--- a/src/mongo/s/catalog/type_collection_test.cpp
+++ b/src/mongo/s/catalog/type_collection_test.cpp
@@ -28,8 +28,8 @@
#include "mongo/platform/basic.h"
-#include "mongo/bson/oid.h"
#include "mongo/base/status_with.h"
+#include "mongo/bson/oid.h"
#include "mongo/s/catalog/type_collection.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/time_support.h"
@@ -47,10 +47,12 @@ TEST(CollectionType, Empty) {
TEST(CollectionType, Basic) {
const OID oid = OID::gen();
- StatusWith<CollectionType> status = CollectionType::fromBSON(BSON(
- CollectionType::fullNs("db.coll")
- << CollectionType::epoch(oid) << CollectionType::updatedAt(Date_t::fromMillisSinceEpoch(1))
- << CollectionType::keyPattern(BSON("a" << 1)) << CollectionType::unique(true)));
+ StatusWith<CollectionType> status =
+ CollectionType::fromBSON(BSON(CollectionType::fullNs("db.coll")
+ << CollectionType::epoch(oid)
+ << CollectionType::updatedAt(Date_t::fromMillisSinceEpoch(1))
+ << CollectionType::keyPattern(BSON("a" << 1))
+ << CollectionType::unique(true)));
ASSERT_TRUE(status.isOK());
CollectionType coll = status.getValue();
@@ -88,11 +90,16 @@ TEST(CollectionType, EpochCorrectness) {
}
TEST(CollectionType, Pre22Format) {
- CollectionType coll = assertGet(
- CollectionType::fromBSON(BSON("_id"
- << "db.coll"
- << "lastmod" << Date_t::fromMillisSinceEpoch(1) << "dropped"
- << false << "key" << BSON("a" << 1) << "unique" << false)));
+ CollectionType coll = assertGet(CollectionType::fromBSON(BSON("_id"
+ << "db.coll"
+ << "lastmod"
+ << Date_t::fromMillisSinceEpoch(1)
+ << "dropped"
+ << false
+ << "key"
+ << BSON("a" << 1)
+ << "unique"
+ << false)));
ASSERT(coll.getNs() == NamespaceString{"db.coll"});
ASSERT(!coll.getEpoch().isSet());
@@ -105,10 +112,12 @@ TEST(CollectionType, Pre22Format) {
TEST(CollectionType, InvalidCollectionNamespace) {
const OID oid = OID::gen();
- StatusWith<CollectionType> result = CollectionType::fromBSON(BSON(
- CollectionType::fullNs("foo\\bar.coll")
- << CollectionType::epoch(oid) << CollectionType::updatedAt(Date_t::fromMillisSinceEpoch(1))
- << CollectionType::keyPattern(BSON("a" << 1)) << CollectionType::unique(true)));
+ StatusWith<CollectionType> result =
+ CollectionType::fromBSON(BSON(CollectionType::fullNs("foo\\bar.coll")
+ << CollectionType::epoch(oid)
+ << CollectionType::updatedAt(Date_t::fromMillisSinceEpoch(1))
+ << CollectionType::keyPattern(BSON("a" << 1))
+ << CollectionType::unique(true)));
ASSERT_TRUE(result.isOK());
CollectionType collType = result.getValue();
ASSERT_FALSE(collType.validate().isOK());
diff --git a/src/mongo/s/catalog/type_config_version_test.cpp b/src/mongo/s/catalog/type_config_version_test.cpp
index dabe32c7782..db3ff5373f0 100644
--- a/src/mongo/s/catalog/type_config_version_test.cpp
+++ b/src/mongo/s/catalog/type_config_version_test.cpp
@@ -253,10 +253,10 @@ TEST(Excludes, BadRangeArray) {
<< "1.2.3"); // empty bound
BSONArray includeArr = bab.arr();
- auto versionInfoResult = VersionType::fromBSON(
- BSON(VersionType::minCompatibleVersion(3)
- << VersionType::currentVersion(4) << VersionType::clusterId(OID::gen())
- << VersionType::excludingMongoVersions(includeArr)));
+ auto versionInfoResult = VersionType::fromBSON(BSON(
+ VersionType::minCompatibleVersion(3) << VersionType::currentVersion(4)
+ << VersionType::clusterId(OID::gen())
+ << VersionType::excludingMongoVersions(includeArr)));
ASSERT_EQ(ErrorCodes::FailedToParse, versionInfoResult.getStatus());
}
diff --git a/src/mongo/s/catalog/type_locks_test.cpp b/src/mongo/s/catalog/type_locks_test.cpp
index aa169872c8a..5425b24b19b 100644
--- a/src/mongo/s/catalog/type_locks_test.cpp
+++ b/src/mongo/s/catalog/type_locks_test.cpp
@@ -45,12 +45,12 @@ TEST(Validity, Empty) {
TEST(Validity, UnlockedWithOptional) {
OID testLockID = OID::gen();
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::UNLOCKED) << LocksType::lockID(testLockID)
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
- << LocksType::why("doing balance round"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::UNLOCKED)
+ << LocksType::lockID(testLockID)
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -77,12 +77,12 @@ TEST(Validity, UnlockedWithoutOptional) {
TEST(Validity, LockedValid) {
OID testLockID = OID::gen();
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::LOCKED) << LocksType::lockID(testLockID)
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
- << LocksType::why("doing balance round"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::LOCKED)
+ << LocksType::lockID(testLockID)
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -97,11 +97,11 @@ TEST(Validity, LockedValid) {
}
TEST(Validity, LockedMissingProcess) {
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::state(LocksType::State::LOCKED) << LocksType::lockID(OID::gen())
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
- << LocksType::why("doing balance round"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::state(LocksType::State::LOCKED)
+ << LocksType::lockID(OID::gen())
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -123,10 +123,11 @@ TEST(Validity, LockedMissingLockID) {
}
TEST(Validity, LockedMissingWho) {
- BSONObj obj = BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::LOCKED)
- << LocksType::lockID(OID::gen()) << LocksType::why("doing balance round"));
+ BSONObj obj =
+ BSON(LocksType::name("balancer") << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::LOCKED)
+ << LocksType::lockID(OID::gen())
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -135,11 +136,11 @@ TEST(Validity, LockedMissingWho) {
}
TEST(Validity, LockedMissingWhy) {
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::LOCKED) << LocksType::lockID(OID::gen())
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::LOCKED)
+ << LocksType::lockID(OID::gen())
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -148,12 +149,12 @@ TEST(Validity, LockedMissingWhy) {
}
TEST(Validity, ContestedValid) {
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::LOCK_PREP) << LocksType::lockID(OID::gen())
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
- << LocksType::why("doing balance round"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::LOCK_PREP)
+ << LocksType::lockID(OID::gen())
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -162,11 +163,11 @@ TEST(Validity, ContestedValid) {
}
TEST(Validity, ContestedMissingProcess) {
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::state(LocksType::State::LOCK_PREP) << LocksType::lockID(OID::gen())
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
- << LocksType::why("doing balance round"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::state(LocksType::State::LOCK_PREP)
+ << LocksType::lockID(OID::gen())
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249")
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -188,10 +189,11 @@ TEST(Validity, ContestedMissingLockID) {
}
TEST(Validity, ContestedMissingWho) {
- BSONObj obj = BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::LOCK_PREP)
- << LocksType::lockID(OID::gen()) << LocksType::why("doing balance round"));
+ BSONObj obj =
+ BSON(LocksType::name("balancer") << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::LOCK_PREP)
+ << LocksType::lockID(OID::gen())
+ << LocksType::why("doing balance round"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
@@ -200,11 +202,11 @@ TEST(Validity, ContestedMissingWho) {
}
TEST(Validity, ContestedMissingWhy) {
- BSONObj obj =
- BSON(LocksType::name("balancer")
- << LocksType::process("host.local:27017:1352918870:16807")
- << LocksType::state(LocksType::State::LOCK_PREP) << LocksType::lockID(OID::gen())
- << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249"));
+ BSONObj obj = BSON(LocksType::name("balancer")
+ << LocksType::process("host.local:27017:1352918870:16807")
+ << LocksType::state(LocksType::State::LOCK_PREP)
+ << LocksType::lockID(OID::gen())
+ << LocksType::who("host.local:27017:1352918870:16807:Balancer:282475249"));
auto locksResult = LocksType::fromBSON(obj);
ASSERT_OK(locksResult.getStatus());
diff --git a/src/mongo/s/catalog/type_mongos_test.cpp b/src/mongo/s/catalog/type_mongos_test.cpp
index 291019e0886..8fc449ab6f7 100644
--- a/src/mongo/s/catalog/type_mongos_test.cpp
+++ b/src/mongo/s/catalog/type_mongos_test.cpp
@@ -39,48 +39,54 @@ namespace {
using namespace mongo;
TEST(Validity, MissingName) {
- BSONObj obj = BSON(MongosType::ping(Date_t::fromMillisSinceEpoch(1))
- << MongosType::uptime(100) << MongosType::waiting(false)
- << MongosType::mongoVersion("x.x.x") << MongosType::configVersion(0));
+ BSONObj obj =
+ BSON(MongosType::ping(Date_t::fromMillisSinceEpoch(1)) << MongosType::uptime(100)
+ << MongosType::waiting(false)
+ << MongosType::mongoVersion("x.x.x")
+ << MongosType::configVersion(0));
auto mongosTypeResult = MongosType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, mongosTypeResult.getStatus());
}
TEST(Validity, MissingPing) {
- BSONObj obj = BSON(MongosType::name("localhost:27017")
- << MongosType::uptime(100) << MongosType::waiting(false)
- << MongosType::mongoVersion("x.x.x") << MongosType::configVersion(0));
+ BSONObj obj = BSON(MongosType::name("localhost:27017") << MongosType::uptime(100)
+ << MongosType::waiting(false)
+ << MongosType::mongoVersion("x.x.x")
+ << MongosType::configVersion(0));
auto mongosTypeResult = MongosType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, mongosTypeResult.getStatus());
}
TEST(Validity, MissingUp) {
- BSONObj obj =
- BSON(MongosType::name("localhost:27017")
- << MongosType::ping(Date_t::fromMillisSinceEpoch(1)) << MongosType::waiting(false)
- << MongosType::mongoVersion("x.x.x") << MongosType::configVersion(0));
+ BSONObj obj = BSON(MongosType::name("localhost:27017")
+ << MongosType::ping(Date_t::fromMillisSinceEpoch(1))
+ << MongosType::waiting(false)
+ << MongosType::mongoVersion("x.x.x")
+ << MongosType::configVersion(0));
auto mongosTypeResult = MongosType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, mongosTypeResult.getStatus());
}
TEST(Validity, MissingWaiting) {
- BSONObj obj =
- BSON(MongosType::name("localhost:27017")
- << MongosType::ping(Date_t::fromMillisSinceEpoch(1)) << MongosType::uptime(100)
- << MongosType::mongoVersion("x.x.x") << MongosType::configVersion(0));
+ BSONObj obj = BSON(MongosType::name("localhost:27017")
+ << MongosType::ping(Date_t::fromMillisSinceEpoch(1))
+ << MongosType::uptime(100)
+ << MongosType::mongoVersion("x.x.x")
+ << MongosType::configVersion(0));
auto mongosTypeResult = MongosType::fromBSON(obj);
ASSERT_EQ(ErrorCodes::NoSuchKey, mongosTypeResult.getStatus());
}
TEST(Validity, MissingMongoVersion) {
- BSONObj obj =
- BSON(MongosType::name("localhost:27017")
- << MongosType::ping(Date_t::fromMillisSinceEpoch(1)) << MongosType::uptime(100)
- << MongosType::waiting(false) << MongosType::configVersion(0));
+ BSONObj obj = BSON(MongosType::name("localhost:27017")
+ << MongosType::ping(Date_t::fromMillisSinceEpoch(1))
+ << MongosType::uptime(100)
+ << MongosType::waiting(false)
+ << MongosType::configVersion(0));
auto mongosTypeResult = MongosType::fromBSON(obj);
ASSERT_OK(mongosTypeResult.getStatus());
@@ -94,10 +100,11 @@ TEST(Validity, MissingMongoVersion) {
}
TEST(Validity, MissingConfigVersion) {
- BSONObj obj =
- BSON(MongosType::name("localhost:27017")
- << MongosType::ping(Date_t::fromMillisSinceEpoch(1)) << MongosType::uptime(100)
- << MongosType::waiting(false) << MongosType::mongoVersion("x.x.x"));
+ BSONObj obj = BSON(MongosType::name("localhost:27017")
+ << MongosType::ping(Date_t::fromMillisSinceEpoch(1))
+ << MongosType::uptime(100)
+ << MongosType::waiting(false)
+ << MongosType::mongoVersion("x.x.x"));
auto mongosTypeResult = MongosType::fromBSON(obj);
ASSERT_OK(mongosTypeResult.getStatus());
@@ -113,8 +120,10 @@ TEST(Validity, MissingConfigVersion) {
TEST(Validity, Valid) {
BSONObj obj = BSON(MongosType::name("localhost:27017")
<< MongosType::ping(Date_t::fromMillisSinceEpoch(1))
- << MongosType::uptime(100) << MongosType::waiting(false)
- << MongosType::mongoVersion("x.x.x") << MongosType::configVersion(0));
+ << MongosType::uptime(100)
+ << MongosType::waiting(false)
+ << MongosType::mongoVersion("x.x.x")
+ << MongosType::configVersion(0));
auto mongosTypeResult = MongosType::fromBSON(obj);
MongosType& mType = mongosTypeResult.getValue();
diff --git a/src/mongo/s/catalog/type_shard_test.cpp b/src/mongo/s/catalog/type_shard_test.cpp
index f89a54d5a3f..9461ee47dcb 100644
--- a/src/mongo/s/catalog/type_shard_test.cpp
+++ b/src/mongo/s/catalog/type_shard_test.cpp
@@ -72,7 +72,8 @@ TEST(ShardType, AllOptionalsPresent) {
TEST(ShardType, MaxSizeAsFloat) {
BSONObj obj = BSON(ShardType::name("shard0000") << ShardType::host("localhost:27017")
- << ShardType::maxSizeMB() << 100.0);
+ << ShardType::maxSizeMB()
+ << 100.0);
StatusWith<ShardType> shardRes = ShardType::fromBSON(obj);
ASSERT(shardRes.isOK());
ShardType shard = shardRes.getValue();
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp
index 5e81999afe7..09addfc588c 100644
--- a/src/mongo/s/chunk.cpp
+++ b/src/mongo/s/chunk.cpp
@@ -151,7 +151,8 @@ BSONObj Chunk::_getExtremeKey(OperationContext* txn, bool doSplitAtLower) const
uassert(28736,
str::stream() << "failed to initialize cursor during auto split due to "
- << "connection problem with " << conn->getServerAddress(),
+ << "connection problem with "
+ << conn->getServerAddress(),
cursor.get() != nullptr);
if (cursor->more()) {
@@ -265,14 +266,16 @@ StatusWith<boost::optional<ChunkRange>> Chunk::split(OperationContext* txn,
// It's also a good place to sanity check.
if (_min == splitPoints.front()) {
string msg(str::stream() << "not splitting chunk " << toString() << ", split point "
- << splitPoints.front() << " is exactly on chunk bounds");
+ << splitPoints.front()
+ << " is exactly on chunk bounds");
log() << msg;
return Status(ErrorCodes::CannotSplit, msg);
}
if (_max == splitPoints.back()) {
string msg(str::stream() << "not splitting chunk " << toString() << ", split point "
- << splitPoints.back() << " is exactly on chunk bounds");
+ << splitPoints.back()
+ << " is exactly on chunk bounds");
log() << msg;
return Status(ErrorCodes::CannotSplit, msg);
}
diff --git a/src/mongo/s/chunk_diff.h b/src/mongo/s/chunk_diff.h
index 294fae769a2..384f95e7df9 100644
--- a/src/mongo/s/chunk_diff.h
+++ b/src/mongo/s/chunk_diff.h
@@ -75,8 +75,8 @@ public:
typedef typename std::map<BSONObj, ValType, BSONObjCmp> RangeMap;
// Pair of iterators defining a subset of ranges
- typedef
- typename std::pair<typename RangeMap::iterator, typename RangeMap::iterator> RangeOverlap;
+ typedef typename std::pair<typename RangeMap::iterator, typename RangeMap::iterator>
+ RangeOverlap;
// Map of shard identifiers to the maximum chunk version on that shard
typedef typename std::map<ShardId, ChunkVersion> MaxChunkVersionMap;
diff --git a/src/mongo/s/chunk_diff_test.cpp b/src/mongo/s/chunk_diff_test.cpp
index 0e7674929fe..46cbce4dabc 100644
--- a/src/mongo/s/chunk_diff_test.cpp
+++ b/src/mongo/s/chunk_diff_test.cpp
@@ -28,8 +28,8 @@
#include "mongo/platform/basic.h"
-#include <string>
#include <map>
+#include <string>
#include <utility>
#include <vector>
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp
index de4785240df..5548ea4f642 100644
--- a/src/mongo/s/chunk_manager.cpp
+++ b/src/mongo/s/chunk_manager.cpp
@@ -427,11 +427,11 @@ Status ChunkManager::createFirstChunks(OperationContext* txn,
chunk.setShard(shardIds[i % shardIds.size()]);
chunk.setVersion(version);
- Status status = grid.catalogManager(txn)
- ->insertConfigDocument(txn, ChunkType::ConfigNS, chunk.toBSON());
+ Status status = grid.catalogManager(txn)->insertConfigDocument(
+ txn, ChunkType::ConfigNS, chunk.toBSON());
if (!status.isOK()) {
- const string errMsg = str::stream()
- << "Creating first chunks failed: " << status.reason();
+ const string errMsg = str::stream() << "Creating first chunks failed: "
+ << status.reason();
error() << errMsg;
return Status(status.code(), errMsg);
}
@@ -472,9 +472,12 @@ shared_ptr<Chunk> ChunkManager::findIntersectingChunk(OperationContext* txn,
}
msgasserted(8070,
- str::stream() << "couldn't find a chunk intersecting: " << shardKey
- << " for ns: " << _ns << " at version: " << _version.toString()
- << ", number of chunks: " << _chunkMap.size());
+ str::stream() << "couldn't find a chunk intersecting: " << shardKey << " for ns: "
+ << _ns
+ << " at version: "
+ << _version.toString()
+ << ", number of chunks: "
+ << _chunkMap.size());
}
void ChunkManager::getShardIdsForQuery(OperationContext* txn,
@@ -714,12 +717,10 @@ ChunkManager::ChunkRangeMap ChunkManager::_constructRanges(const ChunkMap& chunk
while (current != chunkMap.cend()) {
const auto rangeFirst = current;
- current = std::find_if(current,
- chunkMap.cend(),
- [&rangeFirst](const ChunkMap::value_type& chunkMapEntry) {
- return chunkMapEntry.second->getShardId() !=
- rangeFirst->second->getShardId();
- });
+ current = std::find_if(
+ current, chunkMap.cend(), [&rangeFirst](const ChunkMap::value_type& chunkMapEntry) {
+ return chunkMapEntry.second->getShardId() != rangeFirst->second->getShardId();
+ });
const auto rangeLast = std::prev(current);
const BSONObj rangeMin = rangeFirst->second->getMin();
diff --git a/src/mongo/s/chunk_manager_targeter.cpp b/src/mongo/s/chunk_manager_targeter.cpp
index 717692e324b..c9e9bcb76de 100644
--- a/src/mongo/s/chunk_manager_targeter.cpp
+++ b/src/mongo/s/chunk_manager_targeter.cpp
@@ -38,8 +38,8 @@
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/config.h"
#include "mongo/s/grid.h"
-#include "mongo/s/sharding_raii.h"
#include "mongo/s/shard_key_pattern.h"
+#include "mongo/s/sharding_raii.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
@@ -553,7 +553,8 @@ Status ChunkManagerTargeter::targetAllShards(vector<ShardEndpoint*>* endpoints)
if (!_primary && !_manager) {
return Status(ErrorCodes::NamespaceNotFound,
str::stream() << "could not target every shard with versions for "
- << getNS().ns() << "; metadata not found");
+ << getNS().ns()
+ << "; metadata not found");
}
vector<ShardId> shardIds;
diff --git a/src/mongo/s/chunk_manager_targeter_test.cpp b/src/mongo/s/chunk_manager_targeter_test.cpp
index 9c2e9327992..24d2398defa 100644
--- a/src/mongo/s/chunk_manager_targeter_test.cpp
+++ b/src/mongo/s/chunk_manager_targeter_test.cpp
@@ -319,7 +319,8 @@ TEST(CMCollapseTreeTest, Regex) {
OrderedIntervalList expected;
expected.intervals.push_back(Interval(BSON(""
<< ""
- << "" << BSONObj()),
+ << ""
+ << BSONObj()),
true,
false));
BSONObjBuilder builder;
diff --git a/src/mongo/s/chunk_version.cpp b/src/mongo/s/chunk_version.cpp
index 1ad883b603b..258d8512f93 100644
--- a/src/mongo/s/chunk_version.cpp
+++ b/src/mongo/s/chunk_version.cpp
@@ -30,9 +30,9 @@
#include "mongo/s/chunk_version.h"
+#include "mongo/base/status_with.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/base/status_with.h"
#include "mongo/bson/util/bson_extract.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/s/client/shard_factory.cpp b/src/mongo/s/client/shard_factory.cpp
index cc5ca205a0f..bf71e7c62aa 100644
--- a/src/mongo/s/client/shard_factory.cpp
+++ b/src/mongo/s/client/shard_factory.cpp
@@ -34,8 +34,8 @@
#include "mongo/s/client/shard_factory.h"
#include "mongo/base/status_with.h"
-#include "mongo/client/remote_command_targeter.h"
#include "mongo/client/connection_string.h"
+#include "mongo/client/remote_command_targeter.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/client/shard_factory.h b/src/mongo/s/client/shard_factory.h
index caa6743e75b..c3a6ff8d8de 100644
--- a/src/mongo/s/client/shard_factory.h
+++ b/src/mongo/s/client/shard_factory.h
@@ -28,10 +28,10 @@
#pragma once
+#include <functional>
+#include <map>
#include <memory>
#include <string>
-#include <map>
-#include <functional>
#include "mongo/base/disallow_copying.h"
diff --git a/src/mongo/s/client/shard_local_test.cpp b/src/mongo/s/client/shard_local_test.cpp
index 214202d4a7d..f6e3009f97e 100644
--- a/src/mongo/s/client/shard_local_test.cpp
+++ b/src/mongo/s/client/shard_local_test.cpp
@@ -31,8 +31,8 @@
#include "mongo/s/client/shard_local.h"
#include "mongo/client/read_preference.h"
-#include "mongo/db/client.h"
#include "mongo/db/catalog/database_holder.h"
+#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/query/find_and_modify_request.h"
#include "mongo/db/repl/replication_coordinator_global.h"
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp
index 271346d6e86..fb9339b660c 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -42,8 +42,8 @@
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard.h"
#include "mongo/s/client/shard_connection.h"
-#include "mongo/s/grid.h"
#include "mongo/s/client/shard_factory.h"
+#include "mongo/s/grid.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/client/shard_registry.h b/src/mongo/s/client/shard_registry.h
index 66dc5d225ee..89502ff507a 100644
--- a/src/mongo/s/client/shard_registry.h
+++ b/src/mongo/s/client/shard_registry.h
@@ -29,10 +29,10 @@
#pragma once
#include <memory>
+#include <set>
#include <string>
#include <unordered_map>
#include <vector>
-#include <set>
#include "mongo/base/disallow_copying.h"
#include "mongo/db/jsobj.h"
diff --git a/src/mongo/s/client/shard_remote.cpp b/src/mongo/s/client/shard_remote.cpp
index ef033ff718a..9a31ee60424 100644
--- a/src/mongo/s/client/shard_remote.cpp
+++ b/src/mongo/s/client/shard_remote.cpp
@@ -42,8 +42,8 @@
#include "mongo/client/replica_set_monitor.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
-#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/query/lite_parsed_query.h"
+#include "mongo/db/repl/read_concern_args.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
diff --git a/src/mongo/s/client/sharding_network_connection_hook.cpp b/src/mongo/s/client/sharding_network_connection_hook.cpp
index 80e5b73460d..a6b7a071250 100644
--- a/src/mongo/s/client/sharding_network_connection_hook.cpp
+++ b/src/mongo/s/client/sharding_network_connection_hook.cpp
@@ -36,8 +36,8 @@
#include "mongo/executor/remote_command_request.h"
#include "mongo/executor/remote_command_response.h"
#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/s/grid.h"
#include "mongo/s/client/shard_registry.h"
+#include "mongo/s/grid.h"
#include "mongo/s/set_shard_version_request.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/hostandport.h"
diff --git a/src/mongo/s/client/version_manager.cpp b/src/mongo/s/client/version_manager.cpp
index 5fcb8743740..c0df531ec9f 100644
--- a/src/mongo/s/client/version_manager.cpp
+++ b/src/mongo/s/client/version_manager.cpp
@@ -294,13 +294,19 @@ bool checkShardVersion(OperationContext* txn,
const ChunkVersion refVersion(refManager->getVersion(shard->getId()));
const ChunkVersion currentVersion(manager->getVersion(shard->getId()));
- string msg(str::stream()
- << "manager (" << currentVersion.toString() << " : "
- << manager->getSequenceNumber() << ") "
- << "not compatible with reference manager (" << refVersion.toString()
- << " : " << refManager->getSequenceNumber() << ") "
- << "on shard " << shard->getId() << " (" << shard->getConnString().toString()
- << ")");
+ string msg(str::stream() << "manager (" << currentVersion.toString() << " : "
+ << manager->getSequenceNumber()
+ << ") "
+ << "not compatible with reference manager ("
+ << refVersion.toString()
+ << " : "
+ << refManager->getSequenceNumber()
+ << ") "
+ << "on shard "
+ << shard->getId()
+ << " ("
+ << shard->getConnString().toString()
+ << ")");
throw SendStaleConfigException(ns, msg, refVersion, currentVersion);
}
@@ -309,9 +315,13 @@ bool checkShardVersion(OperationContext* txn,
<< ((manager.get() == 0) ? string("<none>") : str::stream()
<< manager->getSequenceNumber())
<< ") but has reference manager ("
- << refManager->getSequenceNumber() << ") "
- << "on conn " << conn->getServerAddress() << " ("
- << conn_in->getServerAddress() << ")");
+ << refManager->getSequenceNumber()
+ << ") "
+ << "on conn "
+ << conn->getServerAddress()
+ << " ("
+ << conn_in->getServerAddress()
+ << ")");
throw SendStaleConfigException(
ns, msg, refManager->getVersion(shard->getId()), ChunkVersion::UNSHARDED());
diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp
index 4299dbe807c..9f999279db0 100644
--- a/src/mongo/s/cluster_write.cpp
+++ b/src/mongo/s/cluster_write.cpp
@@ -266,7 +266,8 @@ void ClusterWriter::write(OperationContext* txn,
str::stream()
<< "unable to target"
<< (request->isInsertIndexRequest() ? " index" : "")
- << " write op for collection " << request->getTargetingNS()
+ << " write op for collection "
+ << request->getTargetingNS()
<< causedBy(targetInitStatus)),
response);
return;
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 {
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index 8952de421a9..14abfd14398 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -40,8 +40,8 @@
#include "mongo/s/balancer/balancer_configuration.h"
#include "mongo/s/catalog/catalog_cache.h"
#include "mongo/s/catalog/catalog_manager.h"
-#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/catalog/type_chunk.h"
+#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/catalog/type_database.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/chunk_manager.h"
@@ -462,8 +462,8 @@ bool DBConfig::_loadIfNeeded(OperationContext* txn, Counter reloadIteration) {
// Load all collections
vector<CollectionType> collections;
repl::OpTime configOpTimeWhenLoadingColl;
- uassertStatusOK(grid.catalogManager(txn)
- ->getCollections(txn, &_name, &collections, &configOpTimeWhenLoadingColl));
+ uassertStatusOK(grid.catalogManager(txn)->getCollections(
+ txn, &_name, &collections, &configOpTimeWhenLoadingColl));
int numCollsErased = 0;
int numCollsSharded = 0;
diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp
index 96f42340229..0f102def839 100644
--- a/src/mongo/s/grid.cpp
+++ b/src/mongo/s/grid.cpp
@@ -38,8 +38,8 @@
#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_registry.h"
#include "mongo/s/client/shard_factory.h"
+#include "mongo/s/client/shard_registry.h"
#include "mongo/s/query/cluster_cursor_manager.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp
index 34c8ea62029..e01b19e2d5e 100644
--- a/src/mongo/s/mongos_options.cpp
+++ b/src/mongo/s/mongos_options.cpp
@@ -99,14 +99,15 @@ Status addMongosOptions(moe::OptionSection* options) {
sharding_options.addOptionChaining(
"sharding.chunkSize", "chunkSize", moe::Int, "maximum amount of data per chunk");
- sharding_options.addOptionChaining("net.http.JSONPEnabled",
- "jsonp",
- moe::Switch,
- "allow JSONP access via http (has security implications)")
+ sharding_options
+ .addOptionChaining("net.http.JSONPEnabled",
+ "jsonp",
+ moe::Switch,
+ "allow JSONP access via http (has security implications)")
.setSources(moe::SourceAllLegacy);
- sharding_options.addOptionChaining(
- "noscripting", "noscripting", moe::Switch, "disable scripting engine")
+ sharding_options
+ .addOptionChaining("noscripting", "noscripting", moe::Switch, "disable scripting engine")
.setSources(moe::SourceAllLegacy);
@@ -122,15 +123,14 @@ Status addMongosOptions(moe::OptionSection* options) {
options->addSection(ssl_options);
#endif
- options->addOptionChaining("noAutoSplit",
- "noAutoSplit",
- moe::Switch,
- "do not send split commands with writes")
+ options
+ ->addOptionChaining(
+ "noAutoSplit", "noAutoSplit", moe::Switch, "do not send split commands with writes")
.hidden()
.setSources(moe::SourceAllLegacy);
- options->addOptionChaining(
- "sharding.autoSplit", "", moe::Bool, "send split commands with writes")
+ options
+ ->addOptionChaining("sharding.autoSplit", "", moe::Bool, "send split commands with writes")
.setSources(moe::SourceYAMLConfig);
diff --git a/src/mongo/s/mongos_options_init.cpp b/src/mongo/s/mongos_options_init.cpp
index d26bdb039f7..5a091d16c23 100644
--- a/src/mongo/s/mongos_options_init.cpp
+++ b/src/mongo/s/mongos_options_init.cpp
@@ -30,9 +30,9 @@
#include <iostream>
+#include "mongo/util/exit_code.h"
#include "mongo/util/options_parser/startup_option_init.h"
#include "mongo/util/options_parser/startup_options.h"
-#include "mongo/util/exit_code.h"
#include "mongo/util/quick_exit.h"
namespace mongo {
diff --git a/src/mongo/s/ns_targeter.h b/src/mongo/s/ns_targeter.h
index 56dfefc290b..23bb6656f52 100644
--- a/src/mongo/s/ns_targeter.h
+++ b/src/mongo/s/ns_targeter.h
@@ -30,13 +30,13 @@
#include <string>
-#include "mongo/bson/bsonobj.h"
#include "mongo/base/status.h"
+#include "mongo/bson/bsonobj.h"
#include "mongo/client/dbclientinterface.h"
#include "mongo/db/namespace_string.h"
#include "mongo/s/chunk_version.h"
-#include "mongo/s/write_ops/batched_update_document.h"
#include "mongo/s/write_ops/batched_delete_document.h"
+#include "mongo/s/write_ops/batched_update_document.h"
namespace mongo {
diff --git a/src/mongo/s/query/async_results_merger.cpp b/src/mongo/s/query/async_results_merger.cpp
index 40ab9d8e427..233631bd3e7 100644
--- a/src/mongo/s/query/async_results_merger.cpp
+++ b/src/mongo/s/query/async_results_merger.cpp
@@ -276,7 +276,8 @@ Status AsyncResultsMerger::askForNextBatch_inlock(size_t remoteIndex) {
adjustedBatchSize,
_awaitDataTimeout,
boost::none,
- boost::none).toBSON();
+ boost::none)
+ .toBSON();
} else {
// Do the first time shard host resolution.
invariant(_params.readPreference);
@@ -429,10 +430,10 @@ void AsyncResultsMerger::handleBatchResponse(
if (!cursorResponseStatus.isOK()) {
auto shard = remote.getShard();
if (!shard) {
- remote.status =
- Status(cursorResponseStatus.getStatus().code(),
- str::stream() << "Could not find shard " << *remote.shardId
- << " containing host " << remote.getTargetHost().toString());
+ remote.status = Status(cursorResponseStatus.getStatus().code(),
+ str::stream() << "Could not find shard " << *remote.shardId
+ << " containing host "
+ << remote.getTargetHost().toString());
} else {
shard->updateReplSetMonitor(remote.getTargetHost(), cursorResponseStatus.getStatus());
@@ -443,7 +444,8 @@ void AsyncResultsMerger::handleBatchResponse(
Shard::RetryPolicy::kIdempotent)) {
invariant(remote.shardId);
LOG(1) << "Initial cursor establishment failed with retriable error and will be "
- "retried" << causedBy(cursorResponseStatus.getStatus());
+ "retried"
+ << causedBy(cursorResponseStatus.getStatus());
++remote.retryCount;
@@ -489,7 +491,8 @@ void AsyncResultsMerger::handleBatchResponse(
remote.status = Status(ErrorCodes::InternalError,
str::stream() << "Missing field '"
<< ClusterClientCursorParams::kSortKeyField
- << "' in document: " << obj);
+ << "' in document: "
+ << obj);
return;
}
diff --git a/src/mongo/s/query/async_results_merger_test.cpp b/src/mongo/s/query/async_results_merger_test.cpp
index 01ebefe3a78..7159d6c0271 100644
--- a/src/mongo/s/query/async_results_merger_test.cpp
+++ b/src/mongo/s/query/async_results_merger_test.cpp
@@ -873,7 +873,8 @@ TEST_F(AsyncResultsMergerTest, KillTwoOutstandingBatches) {
// command against this id.
BSONObj expectedCmdObj = BSON("killCursors"
<< "testcoll"
- << "cursors" << BSON_ARRAY(CursorId(123)));
+ << "cursors"
+ << BSON_ARRAY(CursorId(123)));
ASSERT_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj);
// Ensure that we properly signal both those waiting for the kill, and those waiting for more
@@ -919,7 +920,8 @@ TEST_F(AsyncResultsMergerTest, KillOutstandingGetMore) {
// scheduled.
BSONObj expectedCmdObj = BSON("killCursors"
<< "testcoll"
- << "cursors" << BSON_ARRAY(CursorId(123)));
+ << "cursors"
+ << BSON_ARRAY(CursorId(123)));
ASSERT_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj);
// Ensure that we properly signal both those waiting for the kill, and those waiting for more
@@ -1331,7 +1333,8 @@ TEST_F(AsyncResultsMergerTest, GetMoreRequestIncludesMaxTimeMS) {
// Pending getMore request should include maxTimeMS.
BSONObj expectedCmdObj = BSON("getMore" << CursorId(123) << "collection"
<< "testcoll"
- << "maxTimeMS" << 789);
+ << "maxTimeMS"
+ << 789);
ASSERT_EQ(getFirstPendingRequest().cmdObj, expectedCmdObj);
responses.clear();
diff --git a/src/mongo/s/query/cluster_cursor_manager.cpp b/src/mongo/s/query/cluster_cursor_manager.cpp
index 22a3e3bd20e..3c84fa7fa54 100644
--- a/src/mongo/s/query/cluster_cursor_manager.cpp
+++ b/src/mongo/s/query/cluster_cursor_manager.cpp
@@ -54,8 +54,9 @@ Status cursorNotFoundStatus(const NamespaceString& nss, CursorId cursorId) {
Status cursorInUseStatus(const NamespaceString& nss, CursorId cursorId) {
return {ErrorCodes::CursorInUse,
- str::stream() << "Cursor already in use (namespace: '" << nss.ns()
- << "', id: " << cursorId << ")."};
+ str::stream() << "Cursor already in use (namespace: '" << nss.ns() << "', id: "
+ << cursorId
+ << ")."};
}
//
diff --git a/src/mongo/s/query/cluster_cursor_manager_test.cpp b/src/mongo/s/query/cluster_cursor_manager_test.cpp
index 1c32aa33ec2..0edda882977 100644
--- a/src/mongo/s/query/cluster_cursor_manager_test.cpp
+++ b/src/mongo/s/query/cluster_cursor_manager_test.cpp
@@ -34,8 +34,8 @@
#include "mongo/s/query/cluster_client_cursor_mock.h"
#include "mongo/stdx/memory.h"
-#include "mongo/util/clock_source_mock.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/clock_source_mock.h"
namespace mongo {
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index 99398e9ce1b..18f44d9e510 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -87,7 +87,9 @@ StatusWith<std::unique_ptr<LiteParsedQuery>> transformQueryForShards(const LiteP
ErrorCodes::Overflow,
str::stream()
<< "sum of limit and skip cannot be represented as a 64-bit integer, limit: "
- << *lpq.getLimit() << ", skip: " << lpq.getSkip().value_or(0));
+ << *lpq.getLimit()
+ << ", skip: "
+ << lpq.getSkip().value_or(0));
}
newLimit = newLimitValue;
}
@@ -103,8 +105,10 @@ StatusWith<std::unique_ptr<LiteParsedQuery>> transformQueryForShards(const LiteP
return Status(ErrorCodes::Overflow,
str::stream()
<< "sum of ntoreturn and skip cannot be represented as a 64-bit "
- "integer, ntoreturn: " << *lpq.getNToReturn()
- << ", skip: " << lpq.getSkip().value_or(0));
+ "integer, ntoreturn: "
+ << *lpq.getNToReturn()
+ << ", skip: "
+ << lpq.getSkip().value_or(0));
}
newLimit = newLimitValue;
} else {
@@ -114,8 +118,10 @@ StatusWith<std::unique_ptr<LiteParsedQuery>> transformQueryForShards(const LiteP
return Status(ErrorCodes::Overflow,
str::stream()
<< "sum of ntoreturn and skip cannot be represented as a 64-bit "
- "integer, ntoreturn: " << *lpq.getNToReturn()
- << ", skip: " << lpq.getSkip().value_or(0));
+ "integer, ntoreturn: "
+ << *lpq.getNToReturn()
+ << ", skip: "
+ << lpq.getSkip().value_or(0));
}
newNToReturn = newNToReturnValue;
}
@@ -288,7 +294,8 @@ StatusWith<CursorId> ClusterFind::runQuery(OperationContext* txn,
return {ErrorCodes::BadValue,
str::stream() << "Projection contains illegal field '"
<< ClusterClientCursorParams::kSortKeyField
- << "': " << query.getParsed().getProj()};
+ << "': "
+ << query.getParsed().getProj()};
}
auto dbConfig = grid.catalogCache()->getDatabase(txn, query.nss().db().toString());
diff --git a/src/mongo/s/query/router_stage_merge.h b/src/mongo/s/query/router_stage_merge.h
index a146c66f346..d74870f8a94 100644
--- a/src/mongo/s/query/router_stage_merge.h
+++ b/src/mongo/s/query/router_stage_merge.h
@@ -29,9 +29,9 @@
#pragma once
#include "mongo/executor/task_executor.h"
-#include "mongo/s/query/router_exec_stage.h"
-#include "mongo/s/query/cluster_client_cursor_params.h"
#include "mongo/s/query/async_results_merger.h"
+#include "mongo/s/query/cluster_client_cursor_params.h"
+#include "mongo/s/query/router_exec_stage.h"
#include "mongo/util/net/hostandport.h"
namespace mongo {
diff --git a/src/mongo/s/request_types/add_shard_request_test.cpp b/src/mongo/s/request_types/add_shard_request_test.cpp
index c0fbca0f9ee..fee8461ba81 100644
--- a/src/mongo/s/request_types/add_shard_request_test.cpp
+++ b/src/mongo/s/request_types/add_shard_request_test.cpp
@@ -65,8 +65,9 @@ TEST(AddShardRequest, ParseInternalFieldsInvalidConnectionString) {
TEST(AddShardRequest, ParseInternalFieldsMissingMaxSize) {
{
- BSONObj obj = BSON(AddShardRequest::mongosAddShard
- << kConnString << AddShardRequest::shardName << kShardName);
+ BSONObj obj =
+ BSON(AddShardRequest::mongosAddShard << kConnString << AddShardRequest::shardName
+ << kShardName);
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(obj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -79,8 +80,9 @@ TEST(AddShardRequest, ParseInternalFieldsMissingMaxSize) {
}
{
- BSONObj obj = BSON(AddShardRequest::configsvrAddShard
- << kConnString << AddShardRequest::shardName << kShardName);
+ BSONObj obj =
+ BSON(AddShardRequest::configsvrAddShard << kConnString << AddShardRequest::shardName
+ << kShardName);
auto swAddShardRequest = AddShardRequest::parseFromConfigCommand(obj);
@@ -96,8 +98,9 @@ TEST(AddShardRequest, ParseInternalFieldsMissingMaxSize) {
TEST(AddShardRequest, ParseInternalFieldsMissingName) {
{
- BSONObj obj = BSON(AddShardRequest::mongosAddShard
- << kConnString << AddShardRequest::maxSizeMB << kMaxSizeMB);
+ BSONObj obj =
+ BSON(AddShardRequest::mongosAddShard << kConnString << AddShardRequest::maxSizeMB
+ << kMaxSizeMB);
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(obj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -110,8 +113,9 @@ TEST(AddShardRequest, ParseInternalFieldsMissingName) {
}
{
- BSONObj obj = BSON(AddShardRequest::configsvrAddShard
- << kConnString << AddShardRequest::maxSizeMB << kMaxSizeMB);
+ BSONObj obj =
+ BSON(AddShardRequest::configsvrAddShard << kConnString << AddShardRequest::maxSizeMB
+ << kMaxSizeMB);
auto swAddShardRequest = AddShardRequest::parseFromConfigCommand(obj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -126,9 +130,11 @@ TEST(AddShardRequest, ParseInternalFieldsMissingName) {
TEST(AddShardRequest, ParseInternalFieldsAllFieldsPresent) {
{
- BSONObj obj = BSON(AddShardRequest::mongosAddShard
- << kConnString << AddShardRequest::shardName << kShardName
- << AddShardRequest::maxSizeMB << kMaxSizeMB);
+ BSONObj obj =
+ BSON(AddShardRequest::mongosAddShard << kConnString << AddShardRequest::shardName
+ << kShardName
+ << AddShardRequest::maxSizeMB
+ << kMaxSizeMB);
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(obj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -142,9 +148,11 @@ TEST(AddShardRequest, ParseInternalFieldsAllFieldsPresent) {
}
{
- BSONObj obj = BSON(AddShardRequest::configsvrAddShard
- << kConnString << AddShardRequest::shardName << kShardName
- << AddShardRequest::maxSizeMB << kMaxSizeMB);
+ BSONObj obj =
+ BSON(AddShardRequest::configsvrAddShard << kConnString << AddShardRequest::shardName
+ << kShardName
+ << AddShardRequest::maxSizeMB
+ << kMaxSizeMB);
auto swAddShardRequest = AddShardRequest::parseFromConfigCommand(obj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -161,9 +169,10 @@ TEST(AddShardRequest, ParseInternalFieldsAllFieldsPresent) {
// Test converting a valid AddShardRequest to the internal config version of the command.
TEST(AddShardRequest, ToCommandForConfig) {
- BSONObj mongosCmdObj = BSON(AddShardRequest::mongosAddShard
- << kConnString << AddShardRequest::shardName << kShardName
- << AddShardRequest::maxSizeMB << kMaxSizeMB);
+ BSONObj mongosCmdObj = BSON(
+ AddShardRequest::mongosAddShard << kConnString << AddShardRequest::shardName << kShardName
+ << AddShardRequest::maxSizeMB
+ << kMaxSizeMB);
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(mongosCmdObj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -176,8 +185,8 @@ TEST(AddShardRequest, ToCommandForConfig) {
}
TEST(AddShardRequest, ToCommandForConfigMissingName) {
- BSONObj mongosCmdObj = BSON(AddShardRequest::mongosAddShard
- << kConnString << AddShardRequest::maxSizeMB << kMaxSizeMB);
+ BSONObj mongosCmdObj = BSON(
+ AddShardRequest::mongosAddShard << kConnString << AddShardRequest::maxSizeMB << kMaxSizeMB);
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(mongosCmdObj);
ASSERT_OK(swAddShardRequest.getStatus());
@@ -190,8 +199,8 @@ TEST(AddShardRequest, ToCommandForConfigMissingName) {
}
TEST(AddShardRequest, ToCommandForConfigMissingMaxSize) {
- BSONObj mongosCmdObj = BSON(AddShardRequest::mongosAddShard
- << kConnString << AddShardRequest::shardName << kShardName);
+ BSONObj mongosCmdObj = BSON(
+ AddShardRequest::mongosAddShard << kConnString << AddShardRequest::shardName << kShardName);
auto swAddShardRequest = AddShardRequest::parseFromMongosCommand(mongosCmdObj);
ASSERT_OK(swAddShardRequest.getStatus());
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index a6755a82082..8dbacbdc624 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -38,8 +38,8 @@
#include "mongo/client/connpool.h"
#include "mongo/client/dbclient_rs.h"
#include "mongo/client/global_conn_pool.h"
-#include "mongo/client/remote_command_targeter_factory_impl.h"
#include "mongo/client/remote_command_targeter.h"
+#include "mongo/client/remote_command_targeter_factory_impl.h"
#include "mongo/client/replica_set_monitor.h"
#include "mongo/config.h"
#include "mongo/db/audit.h"
@@ -63,14 +63,14 @@
#include "mongo/s/balancer/balancer.h"
#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/s/catalog/type_chunk.h"
-#include "mongo/s/catalog/type_locks.h"
#include "mongo/s/catalog/type_lockpings.h"
+#include "mongo/s/catalog/type_locks.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/catalog/type_tags.h"
#include "mongo/s/client/shard_connection.h"
-#include "mongo/s/client/shard_remote.h"
#include "mongo/s/client/shard_factory.h"
#include "mongo/s/client/shard_registry.h"
+#include "mongo/s/client/shard_remote.h"
#include "mongo/s/client/sharding_connection_hook_for_mongos.h"
#include "mongo/s/cluster_write.h"
#include "mongo/s/commands/request.h"
@@ -78,10 +78,10 @@
#include "mongo/s/grid.h"
#include "mongo/s/mongos_options.h"
#include "mongo/s/query/cluster_cursor_cleanup_job.h"
+#include "mongo/s/query/cluster_cursor_manager.h"
#include "mongo/s/sharding_egress_metadata_hook_for_mongos.h"
#include "mongo/s/sharding_initialization.h"
#include "mongo/s/version_mongos.h"
-#include "mongo/s/query/cluster_cursor_manager.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/admin_access.h"
@@ -421,9 +421,8 @@ static ExitCode runMongosServer() {
return inShutdown() ? EXIT_CLEAN : EXIT_NET_ERROR;
}
-MONGO_INITIALIZER_GENERAL(ForkServer,
- ("EndStartupOptionHandling"),
- ("default"))(InitializerContext* context) {
+MONGO_INITIALIZER_GENERAL(ForkServer, ("EndStartupOptionHandling"), ("default"))
+(InitializerContext* context) {
mongo::forkServerOrDie();
return Status::OK();
}
@@ -508,9 +507,8 @@ MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) {
}
#ifdef MONGO_CONFIG_SSL
-MONGO_INITIALIZER_GENERAL(setSSLManagerType,
- MONGO_NO_PREREQUISITES,
- ("SSLManager"))(InitializerContext* context) {
+MONGO_INITIALIZER_GENERAL(setSSLManagerType, MONGO_NO_PREREQUISITES, ("SSLManager"))
+(InitializerContext* context) {
isSSLServer = true;
return Status::OK();
}
diff --git a/src/mongo/s/set_shard_version_request_test.cpp b/src/mongo/s/set_shard_version_request_test.cpp
index 960d412bb8a..794d8bb552c 100644
--- a/src/mongo/s/set_shard_version_request_test.cpp
+++ b/src/mongo/s/set_shard_version_request_test.cpp
@@ -47,12 +47,16 @@ const ConnectionString shardCS = ConnectionString::forReplicaSet(
TEST(SetShardVersionRequest, ParseInitMissingAuthoritative) {
SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << ""
- << "init" << true << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString())));
+ assertGet(SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << ""
+ << "init"
+ << true
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString())));
ASSERT(request.isInit());
ASSERT(!request.isAuthoritative());
@@ -63,13 +67,19 @@ TEST(SetShardVersionRequest, ParseInitMissingAuthoritative) {
}
TEST(SetShardVersionRequest, ParseInitWithAuthoritative) {
- SetShardVersionRequest request = assertGet(
- SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
- << ""
- << "init" << true << "authoritative" << true
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString())));
+ SetShardVersionRequest request =
+ assertGet(SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << ""
+ << "init"
+ << true
+ << "authoritative"
+ << true
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString())));
ASSERT(request.isInit());
ASSERT(request.isAuthoritative());
@@ -81,13 +91,20 @@ TEST(SetShardVersionRequest, ParseInitWithAuthoritative) {
TEST(SetShardVersionRequest, ParseInitNoConnectionVersioning) {
SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << ""
- << "init" << true << "authoritative" << true << "configdb" << configCS.toString()
- << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "noConnectionVersioning" << true)));
+ assertGet(SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << ""
+ << "init"
+ << true
+ << "authoritative"
+ << true
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()
+ << "noConnectionVersioning"
+ << true)));
ASSERT(request.isInit());
ASSERT(request.isAuthoritative());
@@ -101,13 +118,18 @@ TEST(SetShardVersionRequest, ParseFull) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << "db.coll"
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch())));
+ assertGet(SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << "db.coll"
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch())));
ASSERT(!request.isInit());
ASSERT(!request.isAuthoritative());
@@ -125,14 +147,20 @@ TEST(SetShardVersionRequest, ParseFullWithAuthoritative) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << "db.coll"
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()
- << "authoritative" << true)));
+ assertGet(SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << "db.coll"
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()
+ << "authoritative"
+ << true)));
ASSERT(!request.isInit());
ASSERT(request.isAuthoritative());
@@ -150,14 +178,20 @@ TEST(SetShardVersionRequest, ParseFullNoConnectionVersioning) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
SetShardVersionRequest request =
- assertGet(SetShardVersionRequest::parseFromBSON(
- BSON("setShardVersion"
- << "db.coll"
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()
- << "noConnectionVersioning" << true)));
+ assertGet(SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << "db.coll"
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()
+ << "noConnectionVersioning"
+ << true)));
ASSERT(!request.isInit());
ASSERT(!request.isAuthoritative());
@@ -172,12 +206,14 @@ TEST(SetShardVersionRequest, ParseFullNoConnectionVersioning) {
}
TEST(SetShardVersionRequest, ParseInitNoConfigServer) {
- auto ssvStatus =
- SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
- << ""
- << "init" << true << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString()));
+ auto ssvStatus = SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << ""
+ << "init"
+ << true
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()));
ASSERT_EQ(ErrorCodes::NoSuchKey, ssvStatus.getStatus().code());
}
@@ -185,14 +221,18 @@ TEST(SetShardVersionRequest, ParseInitNoConfigServer) {
TEST(SetShardVersionRequest, ParseFullNoNS) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
- auto ssvStatus =
- SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
- << ""
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong())
- << "versionEpoch" << chunkVersion.epoch()));
+ auto ssvStatus = SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << ""
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()));
ASSERT_EQ(ErrorCodes::InvalidNamespace, ssvStatus.getStatus().code());
}
@@ -200,14 +240,18 @@ TEST(SetShardVersionRequest, ParseFullNoNS) {
TEST(SetShardVersionRequest, ParseFullNSContainsDBOnly) {
const ChunkVersion chunkVersion(1, 2, OID::gen());
- auto ssvStatus =
- SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
- << "dbOnly"
- << "configdb" << configCS.toString() << "shard"
- << "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong())
- << "versionEpoch" << chunkVersion.epoch()));
+ auto ssvStatus = SetShardVersionRequest::parseFromBSON(BSON("setShardVersion"
+ << "dbOnly"
+ << "configdb"
+ << configCS.toString()
+ << "shard"
+ << "TestShard"
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()));
ASSERT_EQ(ErrorCodes::InvalidNamespace, ssvStatus.getStatus().code());
}
@@ -226,10 +270,18 @@ TEST(SetShardVersionRequest, ToSSVCommandInit) {
ASSERT_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< ""
- << "init" << true << "authoritative" << true << "configdb" << configCS.toString()
+ << "init"
+ << true
+ << "authoritative"
+ << true
+ << "configdb"
+ << configCS.toString()
<< "shard"
<< "TestShard"
- << "shardHost" << shardCS.toString() << "maxTimeMS" << 30000));
+ << "shardHost"
+ << shardCS.toString()
+ << "maxTimeMS"
+ << 30000));
}
TEST(SetShardVersionRequest, ToSSVCommandInitNoConnectionVersioning) {
@@ -246,11 +298,20 @@ TEST(SetShardVersionRequest, ToSSVCommandInitNoConnectionVersioning) {
ASSERT_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< ""
- << "init" << true << "authoritative" << true << "configdb" << configCS.toString()
+ << "init"
+ << true
+ << "authoritative"
+ << true
+ << "configdb"
+ << configCS.toString()
<< "shard"
<< "TestShard"
- << "shardHost" << shardCS.toString() << "maxTimeMS" << 30000
- << "noConnectionVersioning" << true));
+ << "shardHost"
+ << shardCS.toString()
+ << "maxTimeMS"
+ << 30000
+ << "noConnectionVersioning"
+ << true));
}
TEST(SetShardVersionRequest, ToSSVCommandFull) {
@@ -272,11 +333,20 @@ TEST(SetShardVersionRequest, ToSSVCommandFull) {
ASSERT_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< "db.coll"
- << "init" << false << "authoritative" << false << "configdb"
- << configCS.toString() << "shard"
+ << "init"
+ << false
+ << "authoritative"
+ << false
+ << "configdb"
+ << configCS.toString()
+ << "shard"
<< "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()));
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()));
}
TEST(SetShardVersionRequest, ToSSVCommandFullAuthoritative) {
@@ -298,11 +368,20 @@ TEST(SetShardVersionRequest, ToSSVCommandFullAuthoritative) {
ASSERT_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< "db.coll"
- << "init" << false << "authoritative" << true << "configdb"
- << configCS.toString() << "shard"
+ << "init"
+ << false
+ << "authoritative"
+ << true
+ << "configdb"
+ << configCS.toString()
+ << "shard"
<< "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()));
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()));
}
TEST(SetShardVersionRequest, ToSSVCommandFullNoConnectionVersioning) {
@@ -324,12 +403,22 @@ TEST(SetShardVersionRequest, ToSSVCommandFullNoConnectionVersioning) {
ASSERT_EQ(ssv.toBSON(),
BSON("setShardVersion"
<< "db.coll"
- << "init" << false << "authoritative" << true << "configdb"
- << configCS.toString() << "shard"
+ << "init"
+ << false
+ << "authoritative"
+ << true
+ << "configdb"
+ << configCS.toString()
+ << "shard"
<< "TestShard"
- << "shardHost" << shardCS.toString() << "version"
- << Timestamp(chunkVersion.toLong()) << "versionEpoch" << chunkVersion.epoch()
- << "noConnectionVersioning" << true));
+ << "shardHost"
+ << shardCS.toString()
+ << "version"
+ << Timestamp(chunkVersion.toLong())
+ << "versionEpoch"
+ << chunkVersion.epoch()
+ << "noConnectionVersioning"
+ << true));
}
} // namespace
diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp
index 8776830647a..607f2fc2a42 100644
--- a/src/mongo/s/shard_key_pattern.cpp
+++ b/src/mongo/s/shard_key_pattern.cpp
@@ -62,7 +62,10 @@ Status ShardKeyPattern::checkShardKeySize(const BSONObj& shardKey) {
return Status(ErrorCodes::ShardKeyTooBig,
stream() << "shard keys must be less than " << kMaxShardKeySizeBytes
- << " bytes, but key " << shardKey << " is " << shardKey.objsize()
+ << " bytes, but key "
+ << shardKey
+ << " is "
+ << shardKey.objsize()
<< " bytes");
}
diff --git a/src/mongo/s/shard_key_pattern_test.cpp b/src/mongo/s/shard_key_pattern_test.cpp
index bb54fc289b5..a00157179b9 100644
--- a/src/mongo/s/shard_key_pattern_test.cpp
+++ b/src/mongo/s/shard_key_pattern_test.cpp
@@ -54,12 +54,15 @@ TEST(ShardKeyPattern, ValidShardKeyPatternSingle) {
ASSERT(!ShardKeyPattern(BSON("a" << -1)).isValid());
ASSERT(!ShardKeyPattern(BSON("a" << -1.0)).isValid());
ASSERT(!ShardKeyPattern(BSON("a"
- << "1")).isValid());
+ << "1"))
+ .isValid());
ASSERT(ShardKeyPattern(BSON("a"
- << "hashed")).isValid());
+ << "hashed"))
+ .isValid());
ASSERT(!ShardKeyPattern(BSON("a"
- << "hash")).isValid());
+ << "hash"))
+ .isValid());
ASSERT(!ShardKeyPattern(BSON("" << 1)).isValid());
ASSERT(!ShardKeyPattern(BSON("." << 1)).isValid());
}
@@ -73,7 +76,8 @@ TEST(ShardKeyPattern, ValidShardKeyPatternComposite) {
ASSERT(ShardKeyPattern(BSON("a" << 1.0f << "b" << 1.0)).isValid());
ASSERT(!ShardKeyPattern(BSON("a" << 1 << "b" << -1)).isValid());
ASSERT(!ShardKeyPattern(BSON("a" << 1 << "b"
- << "1")).isValid());
+ << "1"))
+ .isValid());
ASSERT(ShardKeyPattern(BSON("a" << 1 << "b" << 1.0 << "c" << 1.0f)).isValid());
ASSERT(!ShardKeyPattern(BSON("a" << 1 << "b." << 1.0)).isValid());
@@ -148,7 +152,8 @@ TEST(ShardKeyPattern, ExtractDocShardKeySingle) {
BSON("a" << regex));
const BSONObj ref = BSON("$ref"
<< "coll"
- << "$id" << 1);
+ << "$id"
+ << 1);
ASSERT_EQUALS(docKey(pattern, BSON("a" << ref)), BSON("a" << ref));
ASSERT_EQUALS(docKey(pattern, BSONObj()), BSONObj());
@@ -172,7 +177,8 @@ TEST(ShardKeyPattern, ExtractDocShardKeyCompound) {
ASSERT_EQUALS(docKey(pattern,
BSON("c" << 30 << "b"
<< "20"
- << "a" << 10)),
+ << "a"
+ << 10)),
fromjson("{a:10, b:'20'}"));
ASSERT_EQUALS(docKey(pattern, fromjson("{a:10, b:[1, 2]}")), BSONObj());
@@ -199,7 +205,8 @@ TEST(ShardKeyPattern, ExtractDocShardKeyNested) {
fromjson("{'a.b':10, c:30}"));
const BSONObj ref = BSON("$ref"
<< "coll"
- << "$id" << 1);
+ << "$id"
+ << 1);
ASSERT_EQUALS(docKey(pattern, BSON("a" << BSON("b" << ref) << "c" << 30)),
BSON("a.b" << ref << "c" << 30));
@@ -306,7 +313,8 @@ TEST(ShardKeyPattern, ExtractQueryShardKeyCompound) {
ASSERT_EQUALS(queryKey(pattern,
BSON("c" << 30 << "b"
<< "20"
- << "a" << 10)),
+ << "a"
+ << 10)),
fromjson("{a:10, b:'20'}"));
ASSERT_EQUALS(queryKey(pattern, fromjson("{a:10, b:[1, 2]}")), BSONObj());
diff --git a/src/mongo/s/shard_util.cpp b/src/mongo/s/shard_util.cpp
index 7de40831818..7b96fb78239 100644
--- a/src/mongo/s/shard_util.cpp
+++ b/src/mongo/s/shard_util.cpp
@@ -40,8 +40,8 @@
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/s/shard_key_pattern.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/log.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
namespace shardutil {
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index fee8c72178d..1ed199e497b 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -47,14 +47,14 @@
#include "mongo/rpc/metadata/config_server_metadata.h"
#include "mongo/rpc/metadata/metadata_hook.h"
#include "mongo/s/balancer/balancer_configuration.h"
-#include "mongo/s/client/shard_factory.h"
-#include "mongo/s/client/shard_registry.h"
-#include "mongo/s/client/sharding_network_connection_hook.h"
-#include "mongo/s/grid.h"
#include "mongo/s/catalog/catalog_cache.h"
#include "mongo/s/catalog/replset/catalog_manager_replica_set.h"
#include "mongo/s/catalog/replset/dist_lock_catalog_impl.h"
#include "mongo/s/catalog/replset/replset_dist_lock_manager.h"
+#include "mongo/s/client/shard_factory.h"
+#include "mongo/s/client/shard_registry.h"
+#include "mongo/s/client/sharding_network_connection_hook.h"
+#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
#include "mongo/s/sharding_egress_metadata_hook.h"
#include "mongo/stdx/memory.h"
diff --git a/src/mongo/s/sharding_test_fixture.cpp b/src/mongo/s/sharding_test_fixture.cpp
index 76d1ff9322a..ef4916f0885 100644
--- a/src/mongo/s/sharding_test_fixture.cpp
+++ b/src/mongo/s/sharding_test_fixture.cpp
@@ -343,8 +343,9 @@ void ShardingTestFixture::expectConfigCollectionCreate(const HostAndPort& config
ASSERT_EQUALS(configHost, request.target);
ASSERT_EQUALS("config", request.dbname);
- BSONObj expectedCreateCmd = BSON("create" << collName << "capped" << true << "size"
- << cappedSize << "maxTimeMS" << 30000);
+ BSONObj expectedCreateCmd =
+ BSON("create" << collName << "capped" << true << "size" << cappedSize << "maxTimeMS"
+ << 30000);
ASSERT_EQUALS(expectedCreateCmd, request.cmdObj);
return response;
diff --git a/src/mongo/s/sharding_test_fixture.h b/src/mongo/s/sharding_test_fixture.h
index 6758cd345fe..0ed720de482 100644
--- a/src/mongo/s/sharding_test_fixture.h
+++ b/src/mongo/s/sharding_test_fixture.h
@@ -32,8 +32,8 @@
#include "mongo/db/service_context.h"
#include "mongo/executor/network_test_env.h"
-#include "mongo/util/net/message_port_mock.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/net/message_port_mock.h"
namespace mongo {
diff --git a/src/mongo/s/stale_exception.h b/src/mongo/s/stale_exception.h
index 90d6e0060e6..5268da4c5ef 100644
--- a/src/mongo/s/stale_exception.h
+++ b/src/mongo/s/stale_exception.h
@@ -47,8 +47,11 @@ public:
ChunkVersion wanted)
: AssertionException(
str::stream() << raw << " ( ns : " << ns << ", received : " << received.toString()
- << ", wanted : " << wanted.toString() << ", "
- << (code == ErrorCodes::SendStaleConfig ? "send" : "recv") << " )",
+ << ", wanted : "
+ << wanted.toString()
+ << ", "
+ << (code == ErrorCodes::SendStaleConfig ? "send" : "recv")
+ << " )",
code),
_ns(ns),
_received(received),
@@ -56,16 +59,18 @@ public:
/** Preferred if we're rebuilding this from a thrown exception */
StaleConfigException(const std::string& raw, int code, const BSONObj& error)
- : AssertionException(str::stream()
- << raw << " ( ns : " << (error["ns"].type() == String
- ? error["ns"].String()
- : std::string("<unknown>"))
- << ", received : "
- << ChunkVersion::fromBSON(error, "vReceived").toString()
- << ", wanted : "
- << ChunkVersion::fromBSON(error, "vWanted").toString() << ", "
- << (code == ErrorCodes::SendStaleConfig ? "send" : "recv") << " )",
- code),
+ : AssertionException(
+ str::stream() << raw << " ( ns : " << (error["ns"].type() == String
+ ? error["ns"].String()
+ : std::string("<unknown>"))
+ << ", received : "
+ << ChunkVersion::fromBSON(error, "vReceived").toString()
+ << ", wanted : "
+ << ChunkVersion::fromBSON(error, "vWanted").toString()
+ << ", "
+ << (code == ErrorCodes::SendStaleConfig ? "send" : "recv")
+ << " )",
+ code),
// For legacy reasons, we may not always get a namespace here
_ns(error["ns"].type() == String ? error["ns"].String() : ""),
_received(ChunkVersion::fromBSON(error, "vReceived")),
diff --git a/src/mongo/s/write_ops/batch_downconvert_test.cpp b/src/mongo/s/write_ops/batch_downconvert_test.cpp
index 548bfb6f732..526f9096b8d 100644
--- a/src/mongo/s/write_ops/batch_downconvert_test.cpp
+++ b/src/mongo/s/write_ops/batch_downconvert_test.cpp
@@ -202,9 +202,14 @@ TEST(LegacyGLESuppress, StripCode) {
TEST(LegacyGLESuppress, TimeoutDupError24) {
const BSONObj gleResponse = BSON("ok" << 0.0 << "err"
<< "message"
- << "code" << 12345 << "err"
+ << "code"
+ << 12345
+ << "err"
<< "timeout"
- << "code" << 56789 << "wtimeout" << true);
+ << "code"
+ << 56789
+ << "wtimeout"
+ << true);
BSONObj stripped = stripNonWCInfo(gleResponse);
ASSERT_EQUALS(stripped.nFields(), 4);
diff --git a/src/mongo/s/write_ops/batch_write_exec_test.cpp b/src/mongo/s/write_ops/batch_write_exec_test.cpp
index 74b84e4503c..dea991b80ef 100644
--- a/src/mongo/s/write_ops/batch_write_exec_test.cpp
+++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp
@@ -31,8 +31,8 @@
#include "mongo/s/write_ops/batch_write_exec.h"
#include "mongo/base/owned_pointer_vector.h"
-#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/client/remote_command_targeter_factory_mock.h"
+#include "mongo/client/remote_command_targeter_mock.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/mock_multi_write_command.h"
#include "mongo/s/client/shard_registry.h"
diff --git a/src/mongo/s/write_ops/batch_write_op.cpp b/src/mongo/s/write_ops/batch_write_op.cpp
index 38adfd8aaad..fbd0b945b23 100644
--- a/src/mongo/s/write_ops/batch_write_op.cpp
+++ b/src/mongo/s/write_ops/batch_write_op.cpp
@@ -572,7 +572,7 @@ void BatchWriteOp::noteBatchResponse(const TargetedWriteBatch& targetedBatch,
vector<WriteErrorDetail*>::iterator itemErrorIt = itemErrors.begin();
int index = 0;
WriteErrorDetail* lastError = NULL;
- for (vector<TargetedWrite*>::const_iterator it = targetedBatch.getWrites().begin();
+ for (vector<TargetedWrite *>::const_iterator it = targetedBatch.getWrites().begin();
it != targetedBatch.getWrites().end();
++it, ++index) {
const TargetedWrite* write = *it;
diff --git a/src/mongo/s/write_ops/batch_write_op_test.cpp b/src/mongo/s/write_ops/batch_write_op_test.cpp
index 62dbde7093b..a20f5c98f47 100644
--- a/src/mongo/s/write_ops/batch_write_op_test.cpp
+++ b/src/mongo/s/write_ops/batch_write_op_test.cpp
@@ -31,9 +31,9 @@
#include "mongo/base/owned_pointer_vector.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/s/mock_ns_targeter.h"
+#include "mongo/s/write_ops/batch_write_op.h"
#include "mongo/s/write_ops/batched_command_request.h"
#include "mongo/s/write_ops/batched_delete_document.h"
-#include "mongo/s/write_ops/batch_write_op.h"
#include "mongo/s/write_ops/write_error_detail.h"
#include "mongo/unittest/unittest.h"
@@ -1754,7 +1754,8 @@ TEST(WriteOpLimitTests, UpdateOverheadIncluded) {
string dataString(updateDataBytes -
BSON("x" << 1 << "data"
- << "").objsize(),
+ << "")
+ .objsize(),
'x');
BatchedCommandRequest request(BatchedCommandRequest::BatchType_Update);
diff --git a/src/mongo/s/write_ops/batched_command_request.h b/src/mongo/s/write_ops/batched_command_request.h
index 1d4d51d8405..a86c28f120d 100644
--- a/src/mongo/s/write_ops/batched_command_request.h
+++ b/src/mongo/s/write_ops/batched_command_request.h
@@ -32,9 +32,9 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/s/chunk_version.h"
+#include "mongo/s/write_ops/batched_delete_request.h"
#include "mongo/s/write_ops/batched_insert_request.h"
#include "mongo/s/write_ops/batched_update_request.h"
-#include "mongo/s/write_ops/batched_delete_request.h"
namespace mongo {
diff --git a/src/mongo/s/write_ops/batched_command_request_test.cpp b/src/mongo/s/write_ops/batched_command_request_test.cpp
index 6b9cda96a5a..7a09e8ec3b6 100644
--- a/src/mongo/s/write_ops/batched_command_request_test.cpp
+++ b/src/mongo/s/write_ops/batched_command_request_test.cpp
@@ -41,8 +41,12 @@ TEST(BatchedCommandRequest, BasicInsert) {
BSONObj origInsertRequestObj = BSON("insert"
<< "test"
- << "documents" << insertArray << "writeConcern"
- << BSON("w" << 1) << "ordered" << true);
+ << "documents"
+ << insertArray
+ << "writeConcern"
+ << BSON("w" << 1)
+ << "ordered"
+ << true);
std::string errMsg;
BatchedCommandRequest insertRequest(BatchedCommandRequest::BatchType_Insert);
@@ -59,8 +63,13 @@ TEST(BatchedCommandRequest, InsertWithShardVersion) {
BSONObj origInsertRequestObj = BSON("insert"
<< "test"
- << "documents" << insertArray << "writeConcern"
- << BSON("w" << 1) << "ordered" << true << "shardVersion"
+ << "documents"
+ << insertArray
+ << "writeConcern"
+ << BSON("w" << 1)
+ << "ordered"
+ << true
+ << "shardVersion"
<< BSON_ARRAY(Timestamp(1, 2) << epoch));
std::string errMsg;
@@ -98,7 +107,9 @@ TEST(BatchedCommandRequest, InsertClone) {
TEST(BatchedCommandRequest, InsertIndexClone) {
BSONObj indexSpec(BSON("ns"
<< "xyz.user"
- << "key" << BSON("x" << 1) << "name"
+ << "key"
+ << BSON("x" << 1)
+ << "name"
<< "y"));
auto insertRequest = stdx::make_unique<BatchedInsertRequest>();
diff --git a/src/mongo/s/write_ops/batched_command_response.h b/src/mongo/s/write_ops/batched_command_response.h
index 6e22ae63cfe..58f2631833f 100644
--- a/src/mongo/s/write_ops/batched_command_response.h
+++ b/src/mongo/s/write_ops/batched_command_response.h
@@ -36,8 +36,8 @@
#include "mongo/db/repl/optime.h"
#include "mongo/rpc/write_concern_error_detail.h"
#include "mongo/s/bson_serializable.h"
-#include "mongo/s/write_ops/write_error_detail.h"
#include "mongo/s/write_ops/batched_upsert_detail.h"
+#include "mongo/s/write_ops/write_error_detail.h"
namespace mongo {
diff --git a/src/mongo/s/write_ops/batched_command_response_test.cpp b/src/mongo/s/write_ops/batched_command_response_test.cpp
index 33d35526d77..400962b3006 100644
--- a/src/mongo/s/write_ops/batched_command_response_test.cpp
+++ b/src/mongo/s/write_ops/batched_command_response_test.cpp
@@ -53,13 +53,16 @@ TEST(BatchedCommandResponse, Basic) {
BSONObj writeConcernError(BSON("code" << 8 << "errInfo" << BSON("a" << 1) << "errmsg"
<< "norepl"));
- BSONObj origResponseObj =
- BSON(BatchedCommandResponse::ok(false)
- << BatchedCommandResponse::errCode(-1)
- << BatchedCommandResponse::errMessage("this batch didn't work")
- << BatchedCommandResponse::n(0) << "opTime" << mongo::Timestamp(1ULL)
- << BatchedCommandResponse::writeErrors() << writeErrorsArray
- << BatchedCommandResponse::writeConcernError() << writeConcernError);
+ BSONObj origResponseObj = BSON(BatchedCommandResponse::ok(false)
+ << BatchedCommandResponse::errCode(-1)
+ << BatchedCommandResponse::errMessage("this batch didn't work")
+ << BatchedCommandResponse::n(0)
+ << "opTime"
+ << mongo::Timestamp(1ULL)
+ << BatchedCommandResponse::writeErrors()
+ << writeErrorsArray
+ << BatchedCommandResponse::writeConcernError()
+ << writeConcernError);
string errMsg;
BatchedCommandResponse response;
diff --git a/src/mongo/s/write_ops/batched_delete_request_test.cpp b/src/mongo/s/write_ops/batched_delete_request_test.cpp
index a9fe5ca0c5f..dc816003c13 100644
--- a/src/mongo/s/write_ops/batched_delete_request_test.cpp
+++ b/src/mongo/s/write_ops/batched_delete_request_test.cpp
@@ -46,10 +46,10 @@ TEST(BatchedDeleteRequest, Basic) {
BSON(BatchedDeleteDocument::query(BSON("a" << 1)) << BatchedDeleteDocument::limit(1))
<< BSON(BatchedDeleteDocument::query(BSON("b" << 1)) << BatchedDeleteDocument::limit(1)));
- BSONObj origDeleteRequestObj = BSON(BatchedDeleteRequest::collName("test")
- << BatchedDeleteRequest::deletes() << deleteArray
- << BatchedDeleteRequest::writeConcern(BSON("w" << 1))
- << BatchedDeleteRequest::ordered(true));
+ BSONObj origDeleteRequestObj = BSON(
+ BatchedDeleteRequest::collName("test") << BatchedDeleteRequest::deletes() << deleteArray
+ << BatchedDeleteRequest::writeConcern(BSON("w" << 1))
+ << BatchedDeleteRequest::ordered(true));
string errMsg;
BatchedDeleteRequest request;
diff --git a/src/mongo/s/write_ops/batched_insert_request.cpp b/src/mongo/s/write_ops/batched_insert_request.cpp
index c50816af23f..6d17bfd5b1e 100644
--- a/src/mongo/s/write_ops/batched_insert_request.cpp
+++ b/src/mongo/s/write_ops/batched_insert_request.cpp
@@ -147,8 +147,8 @@ bool BatchedInsertRequest::parseBSON(StringData dbName, const BSONObj& source, s
std::initializer_list<StringData> ignoredFields = {"maxTimeMS", "shardVersion"};
if (std::find(ignoredFields.begin(), ignoredFields.end(), sourceEl.fieldName()) ==
ignoredFields.end()) {
- *errMsg = str::stream()
- << "Unknown option to insert command: " << sourceEl.fieldName();
+ *errMsg = str::stream() << "Unknown option to insert command: "
+ << sourceEl.fieldName();
return false;
}
}
diff --git a/src/mongo/s/write_ops/batched_insert_request_test.cpp b/src/mongo/s/write_ops/batched_insert_request_test.cpp
index 8ec4f7621c1..ec9efb48aa5 100644
--- a/src/mongo/s/write_ops/batched_insert_request_test.cpp
+++ b/src/mongo/s/write_ops/batched_insert_request_test.cpp
@@ -45,10 +45,10 @@ namespace {
TEST(BatchedInsertRequest, Basic) {
BSONArray insertArray = BSON_ARRAY(BSON("a" << 1) << BSON("b" << 1));
- BSONObj origInsertRequestObj = BSON(BatchedInsertRequest::collName("test")
- << BatchedInsertRequest::documents() << insertArray
- << BatchedInsertRequest::writeConcern(BSON("w" << 1))
- << BatchedInsertRequest::ordered(true));
+ BSONObj origInsertRequestObj = BSON(
+ BatchedInsertRequest::collName("test") << BatchedInsertRequest::documents() << insertArray
+ << BatchedInsertRequest::writeConcern(BSON("w" << 1))
+ << BatchedInsertRequest::ordered(true));
string errMsg;
BatchedInsertRequest request;
diff --git a/src/mongo/s/write_ops/batched_update_request_test.cpp b/src/mongo/s/write_ops/batched_update_request_test.cpp
index a4ce7067e82..01da12a7719 100644
--- a/src/mongo/s/write_ops/batched_update_request_test.cpp
+++ b/src/mongo/s/write_ops/batched_update_request_test.cpp
@@ -42,18 +42,20 @@ using std::string;
namespace {
TEST(BatchedUpdateRequest, Basic) {
- BSONArray updateArray = BSON_ARRAY(
- BSON(BatchedUpdateDocument::query(BSON("a" << 1))
- << BatchedUpdateDocument::updateExpr(BSON("$set" << BSON("a" << 1)))
- << BatchedUpdateDocument::multi(false) << BatchedUpdateDocument::upsert(false))
- << BSON(BatchedUpdateDocument::query(BSON("b" << 1))
- << BatchedUpdateDocument::updateExpr(BSON("$set" << BSON("b" << 2)))
- << BatchedUpdateDocument::multi(false) << BatchedUpdateDocument::upsert(false)));
+ BSONArray updateArray =
+ BSON_ARRAY(BSON(BatchedUpdateDocument::query(BSON("a" << 1))
+ << BatchedUpdateDocument::updateExpr(BSON("$set" << BSON("a" << 1)))
+ << BatchedUpdateDocument::multi(false)
+ << BatchedUpdateDocument::upsert(false))
+ << BSON(BatchedUpdateDocument::query(BSON("b" << 1))
+ << BatchedUpdateDocument::updateExpr(BSON("$set" << BSON("b" << 2)))
+ << BatchedUpdateDocument::multi(false)
+ << BatchedUpdateDocument::upsert(false)));
- BSONObj origUpdateRequestObj = BSON(BatchedUpdateRequest::collName("test")
- << BatchedUpdateRequest::updates() << updateArray
- << BatchedUpdateRequest::writeConcern(BSON("w" << 1))
- << BatchedUpdateRequest::ordered(true));
+ BSONObj origUpdateRequestObj = BSON(
+ BatchedUpdateRequest::collName("test") << BatchedUpdateRequest::updates() << updateArray
+ << BatchedUpdateRequest::writeConcern(BSON("w" << 1))
+ << BatchedUpdateRequest::ordered(true));
string errMsg;
BatchedUpdateRequest request;
diff --git a/src/mongo/s/write_ops/write_op.h b/src/mongo/s/write_ops/write_op.h
index bd50896b04a..d56be517fe7 100644
--- a/src/mongo/s/write_ops/write_op.h
+++ b/src/mongo/s/write_ops/write_op.h
@@ -33,8 +33,8 @@
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/s/ns_targeter.h"
-#include "mongo/s/write_ops/write_error_detail.h"
#include "mongo/s/write_ops/batched_command_request.h"
+#include "mongo/s/write_ops/write_error_detail.h"
namespace mongo {