From 606e34054ef33e59b78715263b125ff7ebea1394 Mon Sep 17 00:00:00 2001 From: Jiawei Yang Date: Tue, 25 Apr 2023 22:43:17 +0000 Subject: SERVER-70127 change system operations to be killable by default --- .../db/transaction/transaction_participant.cpp | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/transaction/transaction_participant.cpp') diff --git a/src/mongo/db/transaction/transaction_participant.cpp b/src/mongo/db/transaction/transaction_participant.cpp index 25589761451..beb399820e8 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 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 lk(*splitClientOwned.get()); + splitClientOwned.get()->setSystemOperationUnkillableByStepdown(lk); + } + + AlternativeClientRegion acr(splitClientOwned); std::unique_ptr 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 lk(*splitClientOwned.get()); + splitClientOwned.get()->setSystemOperationUnkillableByStepdown(lk); + } + + AlternativeClientRegion acr(splitClientOwned); std::unique_ptr checkedOutSession; repl::UnreplicatedWritesBlock notReplicated(splitOpCtx.get()); -- cgit v1.2.1