summaryrefslogtreecommitdiff
path: root/src/mongo/s/mongos_main.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/s/mongos_main.cpp
parent70d26d65a1e55e4da104f4f150bdc8b6d2ae5b65 (diff)
downloadmongo-c35bad3b048e8d885bf0b7517aacd2349ea81d14.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