diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2018-08-14 19:45:36 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2018-08-15 10:49:56 -0400 |
commit | 84a3be32998111b4944f09431f6b46c5a63f6a67 (patch) | |
tree | a78b9ecff2f96c509e07e1771d23370b6356d35e | |
parent | a9f8debe5026fa19c2ddf550746e0682730334f9 (diff) | |
download | mongo-84a3be32998111b4944f09431f6b46c5a63f6a67.tar.gz |
SERVER-35916 TransactionCoordinator should not manually attach dollar db field when sending commitTransaction and abortTransaction
-rw-r--r-- | src/mongo/db/transaction_coordinator_commands_impl.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/transaction_coordinator_commands_impl_test.cpp | 7 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/mongo/db/transaction_coordinator_commands_impl.cpp b/src/mongo/db/transaction_coordinator_commands_impl.cpp index 7fb462b1490..f1d7847f6dd 100644 --- a/src/mongo/db/transaction_coordinator_commands_impl.cpp +++ b/src/mongo/db/transaction_coordinator_commands_impl.cpp @@ -47,9 +47,7 @@ std::vector<ShardId> sendCommit(OperationContext* opCtx, std::set<ShardId>& nonA std::vector<AsyncRequestsSender::Request> requests; for (const auto& shardId : nonAckedParticipants) { // TODO (SERVER-36584): Use the commitTransaction IDL to create the command BSON. - requests.emplace_back(shardId, - BSON("commitTransaction" << 1 << "$db" - << "admin")); + requests.emplace_back(shardId, BSON("commitTransaction" << 1)); } // TODO (SERVER-36638): Change to arbitrary task executor? Unit test only supports fixed @@ -76,10 +74,8 @@ std::vector<ShardId> sendCommit(OperationContext* opCtx, std::set<ShardId>& nonA std::vector<ShardId> sendAbort(OperationContext* opCtx, std::set<ShardId>& nonAckedParticipants) { std::vector<AsyncRequestsSender::Request> requests; for (const auto& shardId : nonAckedParticipants) { - // TODO Use IDL to create command BSON. - requests.emplace_back(shardId, - BSON("abortTransaction" << 1 << "$db" - << "admin")); + // TODO (SERVER-36584) Use IDL to create command BSON. + requests.emplace_back(shardId, BSON("abortTransaction" << 1)); } // TODO (SERVER-36638): Change to arbitrary task executor? Unit test only supports fixed diff --git a/src/mongo/db/transaction_coordinator_commands_impl_test.cpp b/src/mongo/db/transaction_coordinator_commands_impl_test.cpp index 4b050c303ca..810ebdd5234 100644 --- a/src/mongo/db/transaction_coordinator_commands_impl_test.cpp +++ b/src/mongo/db/transaction_coordinator_commands_impl_test.cpp @@ -154,8 +154,8 @@ protected: void expectSendCommitAndReturnRetryableError() { for (int i = 0; i <= kMaxNumFailedHostRetryAttempts; i++) { onCommand([](const executor::RemoteCommandRequest& request) -> Status { - IDLParserErrorContext ctx("expectSendCommitAndReturnRetryableError"); - const auto cmd = CommitTransaction::parse(ctx, request.cmdObj); + ASSERT_EQUALS("commitTransaction", + request.cmdObj.firstElement().fieldNameStringData()); return {ErrorCodes::HostUnreachable, ""}; }); } @@ -163,8 +163,7 @@ protected: void expectSendCommitAndReturnSuccess() { onCommand([](const executor::RemoteCommandRequest& request) { - const IDLParserErrorContext ctx("expectSendCommitAndReturnSuccess"); - const auto cmd = CommitTransaction::parse(ctx, request.cmdObj); + ASSERT_EQUALS("commitTransaction", request.cmdObj.firstElement().fieldNameStringData()); return BSON("ok" << 1); }); } |