summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replica_set_config.cpp
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/db/repl/replica_set_config.cpp
parentd4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff)
downloadmongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz
SERVER-23971 Clang-Format code
Diffstat (limited to 'src/mongo/db/repl/replica_set_config.cpp')
-rw-r--r--src/mongo/db/repl/replica_set_config.cpp86
1 files changed, 60 insertions, 26 deletions
diff --git a/src/mongo/db/repl/replica_set_config.cpp b/src/mongo/db/repl/replica_set_config.cpp
index 8f619f6a5d9..b3d0d8f4fc8 100644
--- a/src/mongo/db/repl/replica_set_config.cpp
+++ b/src/mongo/db/repl/replica_set_config.cpp
@@ -128,7 +128,8 @@ Status ReplicaSetConfig::_initialize(const BSONObj& cfg,
if (memberElement.type() != Object) {
return Status(ErrorCodes::TypeMismatch,
str::stream() << "Expected type of " << kMembersFieldName << "."
- << memberElement.fieldName() << " to be Object, but found "
+ << memberElement.fieldName()
+ << " to be Object, but found "
<< typeName(memberElement.type()));
}
_members.resize(_members.size() + 1);
@@ -200,7 +201,8 @@ Status ReplicaSetConfig::_initialize(const BSONObj& cfg,
str::stream() << "replica set configuration cannot contain '"
<< kReplicaSetIdFieldName
<< "' "
- "field when called from replSetInitiate: " << cfg);
+ "field when called from replSetInitiate: "
+ << cfg);
}
_replicaSetId = OID::gen();
} else if (!_replicaSetId.isSet()) {
@@ -312,8 +314,10 @@ Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
if (modeElement.type() != Object) {
return Status(ErrorCodes::TypeMismatch,
str::stream() << "Expected " << kSettingsFieldName << '.'
- << kGetLastErrorModesFieldName << '.'
- << modeElement.fieldName() << " to be an Object, not "
+ << kGetLastErrorModesFieldName
+ << '.'
+ << modeElement.fieldName()
+ << " to be an Object, not "
<< typeName(modeElement.type()));
}
ReplicaSetTagPattern pattern = _tagConfig.makePattern();
@@ -321,20 +325,26 @@ Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
const BSONElement constraintElement = constraintIter.next();
if (!constraintElement.isNumber()) {
return Status(ErrorCodes::TypeMismatch,
- str::stream()
- << "Expected " << kSettingsFieldName << '.'
- << kGetLastErrorModesFieldName << '.' << modeElement.fieldName()
- << '.' << constraintElement.fieldName() << " to be a number, not "
- << typeName(constraintElement.type()));
+ str::stream() << "Expected " << kSettingsFieldName << '.'
+ << kGetLastErrorModesFieldName
+ << '.'
+ << modeElement.fieldName()
+ << '.'
+ << constraintElement.fieldName()
+ << " to be a number, not "
+ << typeName(constraintElement.type()));
}
const int minCount = constraintElement.numberInt();
if (minCount <= 0) {
return Status(ErrorCodes::BadValue,
str::stream() << "Value of " << kSettingsFieldName << '.'
- << kGetLastErrorModesFieldName << '.'
- << modeElement.fieldName() << '.'
+ << kGetLastErrorModesFieldName
+ << '.'
+ << modeElement.fieldName()
+ << '.'
<< constraintElement.fieldName()
- << " must be positive, but found " << minCount);
+ << " must be positive, but found "
+ << minCount);
}
status = _tagConfig.addTagCountConstraintToPattern(
&pattern, constraintElement.fieldNameStringData(), minCount);
@@ -370,7 +380,8 @@ Status ReplicaSetConfig::validate() const {
if (_replSetName.empty()) {
return Status(ErrorCodes::BadValue,
str::stream() << "Replica set configuration must have non-empty "
- << kIdFieldName << " field");
+ << kIdFieldName
+ << " field");
}
if (_heartbeatInterval < Milliseconds(0)) {
return Status(ErrorCodes::BadValue,
@@ -413,22 +424,41 @@ Status ReplicaSetConfig::validate() const {
const MemberConfig& memberJ = _members[j];
if (memberI.getId() == memberJ.getId()) {
return Status(ErrorCodes::BadValue,
- str::stream()
- << "Found two member configurations with same "
- << MemberConfig::kIdFieldName << " field, " << kMembersFieldName
- << "." << i << "." << MemberConfig::kIdFieldName
- << " == " << kMembersFieldName << "." << j << "."
- << MemberConfig::kIdFieldName << " == " << memberI.getId());
+ str::stream() << "Found two member configurations with same "
+ << MemberConfig::kIdFieldName
+ << " field, "
+ << kMembersFieldName
+ << "."
+ << i
+ << "."
+ << MemberConfig::kIdFieldName
+ << " == "
+ << kMembersFieldName
+ << "."
+ << j
+ << "."
+ << MemberConfig::kIdFieldName
+ << " == "
+ << memberI.getId());
}
if (memberI.getHostAndPort() == memberJ.getHostAndPort()) {
return Status(ErrorCodes::BadValue,
str::stream() << "Found two member configurations with same "
- << MemberConfig::kHostFieldName << " field, "
- << kMembersFieldName << "." << i << "."
<< MemberConfig::kHostFieldName
- << " == " << kMembersFieldName << "." << j << "."
+ << " field, "
+ << kMembersFieldName
+ << "."
+ << i
+ << "."
+ << MemberConfig::kHostFieldName
+ << " == "
+ << kMembersFieldName
+ << "."
+ << j
+ << "."
<< MemberConfig::kHostFieldName
- << " == " << memberI.getHostAndPort().toString());
+ << " == "
+ << memberI.getHostAndPort().toString());
}
}
}
@@ -438,7 +468,9 @@ Status ReplicaSetConfig::validate() const {
ErrorCodes::BadValue,
str::stream()
<< "Either all host names in a replica set configuration must be localhost "
- "references, or none must be; found " << localhostCount << " out of "
+ "references, or none must be; found "
+ << localhostCount
+ << " out of "
<< _members.size());
}
@@ -474,7 +506,8 @@ Status ReplicaSetConfig::validate() const {
if (_protocolVersion != 0 && _protocolVersion != 1) {
return Status(ErrorCodes::BadValue,
str::stream() << kProtocolVersionFieldName << " field value of "
- << _protocolVersion << " is not 1 or 0");
+ << _protocolVersion
+ << " is not 1 or 0");
}
if (_configServer) {
@@ -546,7 +579,8 @@ Status ReplicaSetConfig::checkIfWriteConcernCanBeSatisfied(
// write concern mode.
return Status(ErrorCodes::CannotSatisfyWriteConcern,
str::stream() << "Not enough nodes match write concern mode \""
- << writeConcern.wMode << "\"");
+ << writeConcern.wMode
+ << "\"");
} else {
int nodesRemaining = writeConcern.wNumNodes;
for (size_t j = 0; j < _members.size(); ++j) {