diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2016-07-08 17:14:44 -0400 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2016-07-11 10:44:20 -0400 |
commit | 00d3b20bf51315a1bda183fcad7b4737da789a48 (patch) | |
tree | 65f45721f571bff62c1a3a68cc622b3b35fd0a9f /src/mongo/client | |
parent | bcafb88541f91de118c5c5981c7040422c0694ea (diff) | |
download | mongo-00d3b20bf51315a1bda183fcad7b4737da789a48.tar.gz |
SERVER-23750: wait outside of the DataReplicator mutex
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/fetcher.cpp | 12 | ||||
-rw-r--r-- | src/mongo/client/fetcher.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/client/fetcher.cpp b/src/mongo/client/fetcher.cpp index b042a6dc0e9..4f6e831a501 100644 --- a/src/mongo/client/fetcher.cpp +++ b/src/mongo/client/fetcher.cpp @@ -255,6 +255,7 @@ void Fetcher::cancel() { } handle = _getMoreCallbackHandle; + _inShutdown = true; } _executor->cancel(handle); @@ -288,6 +289,17 @@ void Fetcher::_callback(const RemoteCommandCallbackArgs& rcbd, const char* batch return; } + bool inShutdown = false; + { + stdx::lock_guard<stdx::mutex> lk(_mutex); + inShutdown = _inShutdown; + } + if (inShutdown) { + _work(Status(ErrorCodes::ShutdownInProgress, "fetcher shutting down"), nullptr, nullptr); + _finishCallback(); + return; + } + const BSONObj& queryResponseObj = rcbd.response.getValue().data; Status status = getStatusFromCommandResult(queryResponseObj); if (!status.isOK()) { diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h index 51130535fca..b3330eb1467 100644 --- a/src/mongo/client/fetcher.h +++ b/src/mongo/client/fetcher.h @@ -228,6 +228,9 @@ private: // Using boolean instead of a counter to avoid issues with wrap around. bool _first = true; + // _inShutdown is true after cancel() is called. + bool _inShutdown = false; + // Callback handle to the scheduled getMore command. executor::TaskExecutor::CallbackHandle _getMoreCallbackHandle; |