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:46:39 +0000
commit3ca34ca0320609fe62e4af461342d478247bce85 (patch)
tree399bb9e097fea8dc6e326b7b914f48290ddfb5ab
parent4f50641a4a1a34cda2cbfdfd0ec6073c1ed7d9db (diff)
downloadmongo-3ca34ca0320609fe62e4af461342d478247bce85.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 7de1e0cf9df..9f9f1313997 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 566b570fde7..f4757417278 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 e5996e656d3..b0b4b69ad3a 100644
--- a/src/mongo/s/query/cluster_find.cpp
+++ b/src/mongo/s/query/cluster_find.cpp
@@ -578,10 +578,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;
}