summaryrefslogtreecommitdiff
path: root/src/mongo/s/query/cluster_client_cursor_impl.cpp
diff options
context:
space:
mode:
authorSteve Tarzia <steve.tarzia@mongodb.com>2022-10-26 23:05:13 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-27 00:12:58 +0000
commite3794c64dfa909a99655c34f5ca591ae56061377 (patch)
tree9c0b11030ef5b2512950910e3aa1cc1fb5b2d491 /src/mongo/s/query/cluster_client_cursor_impl.cpp
parent108528c1fdc795fa1f9571f2073668d4fc7f05c3 (diff)
downloadmongo-e3794c64dfa909a99655c34f5ca591ae56061377.tar.gz
SERVER-57469 return partial results when a shard times out
Diffstat (limited to 'src/mongo/s/query/cluster_client_cursor_impl.cpp')
-rw-r--r--src/mongo/s/query/cluster_client_cursor_impl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/s/query/cluster_client_cursor_impl.cpp b/src/mongo/s/query/cluster_client_cursor_impl.cpp
index b08a807788c..444b0615d99 100644
--- a/src/mongo/s/query/cluster_client_cursor_impl.cpp
+++ b/src/mongo/s/query/cluster_client_cursor_impl.cpp
@@ -103,6 +103,7 @@ StatusWith<ClusterQueryResult> ClusterClientCursorImpl::next() {
invariant(_opCtx);
const auto interruptStatus = _opCtx->checkForInterruptNoAssert();
if (!interruptStatus.isOK()) {
+ _maxTimeMSExpired |= (interruptStatus.code() == ErrorCodes::MaxTimeMSExpired);
return interruptStatus;
}
@@ -156,7 +157,8 @@ const PrivilegeVector& ClusterClientCursorImpl::getOriginatingPrivileges() const
}
bool ClusterClientCursorImpl::partialResultsReturned() const {
- return _root->partialResultsReturned();
+ // We may have timed out in this layer, or within the plan tree waiting for results from shards.
+ return (_maxTimeMSExpired && _params.isAllowPartialResults) || _root->partialResultsReturned();
}
std::size_t ClusterClientCursorImpl::getNumRemotes() const {