summaryrefslogtreecommitdiff
path: root/src/mongo/s/mongos_main.cpp
diff options
context:
space:
mode:
authorJiawei Yang <jiawei.yang@mongodb.com>2023-04-25 22:43:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-26 04:08:30 +0000
commit606e34054ef33e59b78715263b125ff7ebea1394 (patch)
tree85f8e6b1256096da4facc919bc6123db693a437f /src/mongo/s/mongos_main.cpp
parent5c1f588bfa4ed2edbeb3abbb26e952e08641da14 (diff)
downloadmongo-606e34054ef33e59b78715263b125ff7ebea1394.tar.gz
SERVER-70127 change system operations to be killable by default
Diffstat (limited to 'src/mongo/s/mongos_main.cpp')
-rw-r--r--src/mongo/s/mongos_main.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mongo/s/mongos_main.cpp b/src/mongo/s/mongos_main.cpp
index 9d3a1dd0870..c6d086c17ba 100644
--- a/src/mongo/s/mongos_main.cpp
+++ b/src/mongo/s/mongos_main.cpp
@@ -230,6 +230,11 @@ void implicitlyAbortAllTransactions(OperationContext* opCtx) {
});
auto newClient = opCtx->getServiceContext()->makeClient("ImplicitlyAbortTxnAtShutdown");
+ // TODO(SERVER-74658): Please revisit if this thread could be made killable.
+ {
+ stdx::lock_guard<mongo::Client> lk(*newClient.get());
+ newClient.get()->setSystemOperationUnkillableByStepdown(lk);
+ }
AlternativeClientRegion acr(newClient);
Status shutDownStatus(ErrorCodes::InterruptedAtShutdown,
@@ -265,8 +270,15 @@ void cleanupTask(const ShutdownTaskArgs& shutdownArgs) {
{
// This client initiation pattern is only to be used here, with plans to eliminate this
// pattern down the line.
- if (!haveClient())
+ if (!haveClient()) {
Client::initThread(getThreadName());
+
+ // TODO(SERVER-74658): Please revisit if this thread could be made killable.
+ {
+ stdx::lock_guard<Client> lk(cc());
+ cc().setSystemOperationUnkillableByStepdown(lk);
+ }
+ }
Client& client = cc();
ServiceContext::UniqueOperationContext uniqueTxn;
@@ -677,6 +689,12 @@ private:
ExitCode runMongosServer(ServiceContext* serviceContext) {
ThreadClient tc("mongosMain", serviceContext);
+ // TODO(SERVER-74658): Please revisit if this thread could be made killable.
+ {
+ stdx::lock_guard<Client> lk(*tc.get());
+ tc.get()->setSystemOperationUnkillableByStepdown(lk);
+ }
+
logMongosVersionInfo(nullptr);
// Set up the periodic runner for background job execution