summaryrefslogtreecommitdiff
path: root/src/mongo/s/query/async_results_merger.cpp
diff options
context:
space:
mode:
authorRomans Kasperovics <romans.kasperovics@mongodb.com>2022-03-15 08:55:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-15 09:33:32 +0000
commit80421c5b8e5ac71e16dc005fd961901884891c47 (patch)
treef10f3369dd60df12bea2c4e7060793061d4c7486 /src/mongo/s/query/async_results_merger.cpp
parentabe5428751586d14241f94f06261c7037690557f (diff)
downloadmongo-80421c5b8e5ac71e16dc005fd961901884891c47.tar.gz
SERVER-62710 Ensure that AsyncResultsMerger attempts to kill shard cursors when maxTimeMs is exceeded
Diffstat (limited to 'src/mongo/s/query/async_results_merger.cpp')
-rw-r--r--src/mongo/s/query/async_results_merger.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/s/query/async_results_merger.cpp b/src/mongo/s/query/async_results_merger.cpp
index 56f2deff96e..363e151fbfd 100644
--- a/src/mongo/s/query/async_results_merger.cpp
+++ b/src/mongo/s/query/async_results_merger.cpp
@@ -852,6 +852,11 @@ void AsyncResultsMerger::_scheduleKillCursors(WithLock, OperationContext* opCtx)
executor::RemoteCommandRequest request(
remote.getTargetHost(), _params.getNss().db().toString(), cmdObj, opCtx);
+ // The 'RemoteCommandRequest' takes the remaining time from the 'opCtx' parameter. If
+ // the cursor was killed due to a maxTimeMs timeout, the remaining time will be 0, and
+ // the remote request will not be sent. To avoid this, we remove the timeout for the
+ // remote 'killCursor' command.
+ request.timeout = executor::RemoteCommandRequestBase::kNoTimeout;
// Send kill request; discard callback handle, if any, or failure report, if not.
_executor->scheduleRemoteCommand(request, [](auto const&) {}).getStatus().ignore();