summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2019-06-28 11:28:58 -0400
committerBlake Oler <blake.oler@mongodb.com>2019-07-01 15:07:13 -0400
commit861a2c38ad8bb6bbd7b5cc80b38af0db523d1d54 (patch)
tree8079f68a9cc0839382ca7a40177d0afcaac2b67e /src/mongo/s
parentc1db1e046c420049a8df7d1621c8d991ee517ba4 (diff)
downloadmongo-861a2c38ad8bb6bbd7b5cc80b38af0db523d1d54.tar.gz
SERVER-42005 Don't refer to deleted memory in transaction router unit test
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/transaction_router_test.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/s/transaction_router_test.cpp b/src/mongo/s/transaction_router_test.cpp
index 3fa8bb08416..519b78091b8 100644
--- a/src/mongo/s/transaction_router_test.cpp
+++ b/src/mongo/s/transaction_router_test.cpp
@@ -2667,14 +2667,16 @@ TEST_F(
// First response says readOnly: true.
txnRouter.processParticipantResponse(operationContext(), shard1, kOkReadOnlyTrueResponse);
- const auto participant = txnRouter.getParticipant(shard1);
+ const auto oldParticipant = txnRouter.getParticipant(shard1);
- ASSERT(TransactionRouter::Participant::ReadOnly::kReadOnly == participant->readOnly);
+ ASSERT(TransactionRouter::Participant::ReadOnly::kReadOnly == oldParticipant->readOnly);
// Later response says readOnly: false.
txnRouter.processParticipantResponse(operationContext(), shard1, kOkReadOnlyFalseResponse);
- ASSERT(TransactionRouter::Participant::ReadOnly::kNotReadOnly == participant->readOnly);
+ const auto updatedParticipant = txnRouter.getParticipant(shard1);
+
+ ASSERT(TransactionRouter::Participant::ReadOnly::kNotReadOnly == updatedParticipant->readOnly);
}
TEST_F(TransactionRouterTestWithDefaultSession,