Skip to content

Commit 861a2c3

Browse files
committed
SERVER-42005 Don't refer to deleted memory in transaction router unit test
1 parent c1db1e0 commit 861a2c3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/mongo/s/transaction_router_test.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,14 +2667,16 @@ TEST_F(
26672667
// First response says readOnly: true.
26682668
txnRouter.processParticipantResponse(operationContext(), shard1, kOkReadOnlyTrueResponse);
26692669

2670-
const auto participant = txnRouter.getParticipant(shard1);
2670+
const auto oldParticipant = txnRouter.getParticipant(shard1);
26712671

2672-
ASSERT(TransactionRouter::Participant::ReadOnly::kReadOnly == participant->readOnly);
2672+
ASSERT(TransactionRouter::Participant::ReadOnly::kReadOnly == oldParticipant->readOnly);
26732673

26742674
// Later response says readOnly: false.
26752675
txnRouter.processParticipantResponse(operationContext(), shard1, kOkReadOnlyFalseResponse);
26762676

2677-
ASSERT(TransactionRouter::Participant::ReadOnly::kNotReadOnly == participant->readOnly);
2677+
const auto updatedParticipant = txnRouter.getParticipant(shard1);
2678+
2679+
ASSERT(TransactionRouter::Participant::ReadOnly::kNotReadOnly == updatedParticipant->readOnly);
26782680
}
26792681

26802682
TEST_F(TransactionRouterTestWithDefaultSession,

0 commit comments

Comments
 (0)