diff options
Diffstat (limited to 'src/mongo/s/write_ops')
-rw-r--r-- | src/mongo/s/write_ops/batch_downconvert_test.cpp | 9 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batch_write_exec_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batch_write_op.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batch_write_op_test.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_command_request.h | 2 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_command_request_test.cpp | 21 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_command_response.h | 2 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_command_response_test.cpp | 17 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_delete_request_test.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_insert_request.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_insert_request_test.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/write_ops/batched_update_request_test.cpp | 24 | ||||
-rw-r--r-- | src/mongo/s/write_ops/write_op.h | 2 |
13 files changed, 64 insertions, 42 deletions
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 { |