summaryrefslogtreecommitdiff
path: root/src/mongo/db/client.cpp
diff options
context:
space:
mode:
authorDaniel Vitor Morilha <daniel.morilha@mongodb.com>2021-12-21 14:50:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-21 15:40:38 +0000
commit36cb5167bbe5053bb806f5c4c060a80b2cc791c0 (patch)
tree9e0db499827e10d61763191278905b7868b1427f /src/mongo/db/client.cpp
parent19080405d9c7d08b54e70228a92d237223f2885c (diff)
downloadmongo-36cb5167bbe5053bb806f5c4c060a80b2cc791c0.tar.gz
SERVER-42971 Restore original thread name upon ThreadClient destruction
Diffstat (limited to 'src/mongo/db/client.cpp')
-rw-r--r--src/mongo/db/client.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index 6982ad9e9db..7da46be32df 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -188,12 +188,14 @@ ThreadClient::ThreadClient(StringData desc,
ServiceContext* serviceContext,
transport::SessionHandle session) {
invariantNoCurrentClient();
+ _originalThreadName = ThreadName::get(ThreadContext::get());
Client::initThread(desc, serviceContext, std::move(session));
}
ThreadClient::~ThreadClient() {
invariant(currentClient);
currentClient.reset(nullptr);
+ ThreadName::set(ThreadContext::get(), _originalThreadName);
}
Client* ThreadClient::get() const {