summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKshitij Gupta <kshitij.gupta@mongodb.com>2021-11-12 04:30:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-12 14:44:06 +0000
commit3df2c98107f71668cf8058a1f6cabfc0576c835e (patch)
tree1d8c857f69493ca8482363a919288e907723c26c
parentce992d046993dd88d3993aa4c7311c8a6550d562 (diff)
downloadmongo-3df2c98107f71668cf8058a1f6cabfc0576c835e.tar.gz
SERVER-51329: Fix Unexpected non-retryable error when shutting down a
(cherry picked from commit 651f4a692aa59353954d3cd18ec3572fa9bf48aa)
-rw-r--r--src/mongo/client/scanning_replica_set_monitor.cpp2
-rw-r--r--src/mongo/client/streamable_replica_set_monitor.cpp2
-rw-r--r--src/mongo/s/query/cluster_find.cpp13
3 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/client/scanning_replica_set_monitor.cpp b/src/mongo/client/scanning_replica_set_monitor.cpp
index 0902abd94e0..03976ce43b6 100644
--- a/src/mongo/client/scanning_replica_set_monitor.cpp
+++ b/src/mongo/client/scanning_replica_set_monitor.cpp
@@ -335,7 +335,7 @@ Future<std::vector<HostAndPort>> ScanningReplicaSetMonitor::_getHostsOrRefresh(
stdx::lock_guard<Latch> lk(_state->mutex);
if (_state->isDropped) {
- return Status(ErrorCodes::ReplicaSetMonitorRemoved,
+ return Status(ErrorCodes::ShutdownInProgress,
str::stream()
<< "ScanningReplicaSetMonitor for set " << getName() << " is removed");
}
diff --git a/src/mongo/client/streamable_replica_set_monitor.cpp b/src/mongo/client/streamable_replica_set_monitor.cpp
index a3ac65a4f8d..96dd871e2fa 100644
--- a/src/mongo/client/streamable_replica_set_monitor.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor.cpp
@@ -127,7 +127,7 @@ Status makeUnsatisfiedReadPrefError(const std::string& name,
}
Status makeReplicaSetMonitorRemovedError(const std::string& name) {
- return Status(ErrorCodes::ReplicaSetMonitorRemoved,
+ return Status(ErrorCodes::ShutdownInProgress,
str::stream() << "ReplicaSetMonitor for set " << name << " is removed");
}
diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp
index d90fd43ba1d..71e62de260d 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -547,10 +547,15 @@ CursorId ClusterFind::runQuery(OperationContext* opCtx,
} else if (!ErrorCodes::isStaleShardVersionError(ex.code()) &&
ex.code() != ErrorCodes::ShardInvalidatedForTargeting &&
ex.code() != ErrorCodes::ShardNotFound) {
- // Errors other than stale metadata or from trying to reach a non existent shard are
- // fatal to the operation. Network errors and replication retries happen at the
- // level of the AsyncResultsMerger.
- ex.addContext("Encountered non-retryable error during query");
+
+ if (ErrorCodes::isRetriableError(ex.code())) {
+ ex.addContext("Encountered retryable error during query");
+ } else {
+ // Errors other than stale metadata or from trying to reach a non existent shard
+ // are fatal to the operation. Network errors and replication retries happen at
+ // the level of the AsyncResultsMerger.
+ ex.addContext("Encountered non-retryable error during query");
+ }
throw;
}