summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction/transaction_participant.cpp
diff options
context:
space:
mode:
authorJiawei Yang <jiawei.yang@mongodb.com>2023-04-17 21:46:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-25 04:55:00 +0000
commitc35bad3b048e8d885bf0b7517aacd2349ea81d14 (patch)
tree936b34ac089f00a94f407bfab0fe3d64ecc2deb9 /src/mongo/db/transaction/transaction_participant.cpp
parent70d26d65a1e55e4da104f4f150bdc8b6d2ae5b65 (diff)
downloadmongo-c35bad3b048e8d885bf0b7517aacd2349ea81d14.tar.gz
SERVER-70127 change system operations to be killable by default
Diffstat (limited to 'src/mongo/db/transaction/transaction_participant.cpp')
-rw-r--r--src/mongo/db/transaction/transaction_participant.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/mongo/db/transaction/transaction_participant.cpp b/src/mongo/db/transaction/transaction_participant.cpp
index fe92bc1e306..ecdf64fce81 100644
--- a/src/mongo/db/transaction/transaction_participant.cpp
+++ b/src/mongo/db/transaction/transaction_participant.cpp
@@ -572,6 +572,13 @@ TransactionParticipant::getOldestActiveTimestamp(Timestamp stableTimestamp) {
// the server, and it both blocks this thread from querying config.transactions and waits for
// this thread to terminate.
auto client = getGlobalServiceContext()->makeClient("OldestActiveTxnTimestamp");
+
+ // TODO(SERVER-74656): Please revisit if this thread could be made killable.
+ {
+ stdx::lock_guard<Client> lk(*client.get());
+ client.get()->setSystemOperationUnkillableByStepdown(lk);
+ }
+
AlternativeClientRegion acr(client);
try {
@@ -2013,8 +2020,14 @@ void TransactionParticipant::Participant::_commitSplitPreparedTxnOnPrimary(
auto splitClientOwned = userOpCtx->getServiceContext()->makeClient("tempSplitClient");
auto splitOpCtx = splitClientOwned->makeOperationContext();
- AlternativeClientRegion acr(splitClientOwned);
+ // TODO(SERVER-74656): Please revisit if this thread could be made killable.
+ {
+ stdx::lock_guard<Client> lk(*splitClientOwned.get());
+ splitClientOwned.get()->setSystemOperationUnkillableByStepdown(lk);
+ }
+
+ AlternativeClientRegion acr(splitClientOwned);
std::unique_ptr<MongoDSessionCatalog::Session> checkedOutSession;
repl::UnreplicatedWritesBlock notReplicated(splitOpCtx.get());
@@ -2236,8 +2249,14 @@ void TransactionParticipant::Participant::_abortSplitPreparedTxnOnPrimary(
auto splitClientOwned = opCtx->getServiceContext()->makeClient("tempSplitClient");
auto splitOpCtx = splitClientOwned->makeOperationContext();
- AlternativeClientRegion acr(splitClientOwned);
+ // TODO(SERVER-74656): Please revisit if this thread could be made killable.
+ {
+ stdx::lock_guard<Client> lk(*splitClientOwned.get());
+ splitClientOwned.get()->setSystemOperationUnkillableByStepdown(lk);
+ }
+
+ AlternativeClientRegion acr(splitClientOwned);
std::unique_ptr<MongoDSessionCatalog::Session> checkedOutSession;
repl::UnreplicatedWritesBlock notReplicated(splitOpCtx.get());