diff options
author | Jason Carey <jcarey@argv.me> | 2019-02-27 13:40:18 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2019-03-05 10:05:45 -0500 |
commit | 32a067938731d184b271ba3d7f43ca6727e3109c (patch) | |
tree | 759f22c263da841521a1653701a94e4b7c05c8f0 /src/mongo/s | |
parent | 602bfb9c52b2274d55492f73eeac8513d9048d10 (diff) | |
download | mongo-32a067938731d184b271ba3d7f43ca6727e3109c.tar.gz |
SERVER-39427 Modify interrupt semantics for opCtx
* rename opCtx->runWithoutInterruption to
runWithoutInterruptionExceptAtGlobalShutdown
* add a opCtx->setIsExecutingShutdown method which makes the op immune
to all forms of interruption, including global shutdown
This clarifies what opCtx->runWithoutInterruption actually did and
offers an escape hatch that turns off interruption at process exit for
the thread doing cleanup.
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/async_requests_sender.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/server.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/s/async_requests_sender.cpp b/src/mongo/s/async_requests_sender.cpp index 03cb8ad6d54..6296a1254f9 100644 --- a/src/mongo/s/async_requests_sender.cpp +++ b/src/mongo/s/async_requests_sender.cpp @@ -88,8 +88,6 @@ AsyncRequestsSender::~AsyncRequestsSender() { } catch (const ExceptionFor<ErrorCodes::InterruptedAtShutdown>&) { // Ignore interrupted at shutdown. No need to cleanup if we're going into process-wide // shutdown. - // - // TODO: Figure out how to do actual NonInterruptibility in SERVER-39427 } } @@ -112,7 +110,7 @@ AsyncRequestsSender::Response AsyncRequestsSender::next() { continue; } } else { - _opCtx->runWithoutInterruption([&] { _makeProgress(); }); + _opCtx->runWithoutInterruptionExceptAtGlobalShutdown([&] { _makeProgress(); }); } } return *readyResponse; diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 8f6de4c64ed..acf643ad1c7 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -199,6 +199,8 @@ void cleanupTask(ServiceContext* serviceContext) { opCtx = uniqueTxn.get(); } + opCtx->setIsExecutingShutdown(); + if (serviceContext) { serviceContext->setKillAllOperations(); |